clang 22.0.0git
X86.h
Go to the documentation of this file.
1//===--- X86.h - Declare X86 target feature support -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares X86 TargetInfo objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
15
16#include "OSTargets.h"
20#include "llvm/Support/Compiler.h"
21#include "llvm/TargetParser/Triple.h"
22#include "llvm/TargetParser/X86TargetParser.h"
23#include <optional>
24
25namespace clang {
26namespace targets {
27
28static const unsigned X86AddrSpaceMap[] = {
29 0, // Default
30 0, // opencl_global
31 0, // opencl_local
32 0, // opencl_constant
33 0, // opencl_private
34 0, // opencl_generic
35 0, // opencl_global_device
36 0, // opencl_global_host
37 0, // cuda_device
38 0, // cuda_constant
39 0, // cuda_shared
40 0, // sycl_global
41 0, // sycl_global_device
42 0, // sycl_global_host
43 0, // sycl_local
44 0, // sycl_private
45 270, // ptr32_sptr
46 271, // ptr32_uptr
47 272, // ptr64
48 0, // hlsl_groupshared
49 0, // hlsl_constant
50 0, // hlsl_private
51 0, // hlsl_device
52 0, // hlsl_input
53 // Wasm address space values for this target are dummy values,
54 // as it is only enabled for Wasm targets.
55 20, // wasm_funcref
56};
57
58// X86 target abstract base class; x86-32 and x86-64 are very close, so
59// most of the implementation can be shared.
60class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
61
62 enum X86SSEEnum {
63 NoSSE,
64 SSE1,
65 SSE2,
66 SSE3,
67 SSSE3,
68 SSE41,
69 SSE42,
70 AVX,
71 AVX2,
72 AVX512F
73 } SSELevel = NoSSE;
74 bool HasMMX = false;
75 enum XOPEnum { NoXOP, SSE4A, FMA4, XOP } XOPLevel = NoXOP;
76 enum AddrSpace { ptr32_sptr = 270, ptr32_uptr = 271, ptr64 = 272 };
77
78 bool HasAES = false;
79 bool HasVAES = false;
80 bool HasPCLMUL = false;
81 bool HasVPCLMULQDQ = false;
82 bool HasGFNI = false;
83 bool HasLZCNT = false;
84 bool HasRDRND = false;
85 bool HasFSGSBASE = false;
86 bool HasBMI = false;
87 bool HasBMI2 = false;
88 bool HasPOPCNT = false;
89 bool HasRTM = false;
90 bool HasPRFCHW = false;
91 bool HasRDSEED = false;
92 bool HasADX = false;
93 bool HasTBM = false;
94 bool HasLWP = false;
95 bool HasFMA = false;
96 bool HasF16C = false;
97 bool HasAVX10_1 = false;
98 bool HasAVX10_2 = false;
99 bool HasAVX512CD = false;
100 bool HasAVX512VPOPCNTDQ = false;
101 bool HasAVX512VNNI = false;
102 bool HasAVX512FP16 = false;
103 bool HasAVX512BF16 = false;
104 bool HasAVX512DQ = false;
105 bool HasAVX512BITALG = false;
106 bool HasAVX512BW = false;
107 bool HasAVX512VL = false;
108 bool HasAVX512VBMI = false;
109 bool HasAVX512VBMI2 = false;
110 bool HasAVXIFMA = false;
111 bool HasAVX512IFMA = false;
112 bool HasAVX512VP2INTERSECT = false;
113 bool HasSHA = false;
114 bool HasSHA512 = false;
115 bool HasSHSTK = false;
116 bool HasSM3 = false;
117 bool HasSGX = false;
118 bool HasSM4 = false;
119 bool HasCX8 = false;
120 bool HasCX16 = false;
121 bool HasFXSR = false;
122 bool HasXSAVE = false;
123 bool HasXSAVEOPT = false;
124 bool HasXSAVEC = false;
125 bool HasXSAVES = false;
126 bool HasMWAITX = false;
127 bool HasCLZERO = false;
128 bool HasCLDEMOTE = false;
129 bool HasPCONFIG = false;
130 bool HasPKU = false;
131 bool HasCLFLUSHOPT = false;
132 bool HasCLWB = false;
133 bool HasMOVBE = false;
134 bool HasMOVRS = false;
135 bool HasPREFETCHI = false;
136 bool HasRDPID = false;
137 bool HasRDPRU = false;
138 bool HasRetpolineExternalThunk = false;
139 bool HasLAHFSAHF = false;
140 bool HasWBNOINVD = false;
141 bool HasWAITPKG = false;
142 bool HasMOVDIRI = false;
143 bool HasMOVDIR64B = false;
144 bool HasPTWRITE = false;
145 bool HasINVPCID = false;
146 bool HasENQCMD = false;
147 bool HasAVXVNNIINT16 = false;
148 bool HasAMXFP16 = false;
149 bool HasCMPCCXADD = false;
150 bool HasRAOINT = false;
151 bool HasAVXVNNIINT8 = false;
152 bool HasAVXNECONVERT = false;
153 bool HasKL = false; // For key locker
154 bool HasWIDEKL = false; // For wide key locker
155 bool HasHRESET = false;
156 bool HasAVXVNNI = false;
157 bool HasAMXTILE = false;
158 bool HasAMXINT8 = false;
159 bool HasAMXBF16 = false;
160 bool HasAMXCOMPLEX = false;
161 bool HasAMXFP8 = false;
162 bool HasAMXMOVRS = false;
163 bool HasAMXTRANSPOSE = false;
164 bool HasAMXAVX512 = false;
165 bool HasAMXTF32 = false;
166 bool HasSERIALIZE = false;
167 bool HasTSXLDTRK = false;
168 bool HasUSERMSR = false;
169 bool HasUINTR = false;
170 bool HasCRC32 = false;
171 bool HasX87 = false;
172 bool HasEGPR = false;
173 bool HasPush2Pop2 = false;
174 bool HasPPX = false;
175 bool HasNDD = false;
176 bool HasCCMP = false;
177 bool HasNF = false;
178 bool HasCF = false;
179 bool HasZU = false;
180 bool HasInlineAsmUseGPR32 = false;
181 bool HasBranchHint = false;
182
183protected:
184 llvm::X86::CPUKind CPU = llvm::X86::CK_None;
185
186 enum FPMathKind { FP_Default, FP_SSE, FP_387 } FPMath = FP_Default;
187
188public:
189 X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
190 : TargetInfo(Triple) {
192 BFloat16Format = &llvm::APFloat::BFloat();
193 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
195 HasStrictFP = true;
196 HasUnalignedAccess = true;
197
198 bool IsWinCOFF =
199 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
200 if (IsWinCOFF)
202 }
203
204 const char *getLongDoubleMangling() const override {
205 return LongDoubleFormat == &llvm::APFloat::IEEEquad() ? "g" : "e";
206 }
207
209 // X87 evaluates with 80 bits "long double" precision.
210 return SSELevel == NoSSE ? LangOptions::FPEvalMethodKind::FEM_Extended
212 }
213
214 // EvalMethod `source` is not supported for targets with `NoSSE` feature.
215 bool supportSourceEvalMethod() const override { return SSELevel > NoSSE; }
216
217 ArrayRef<const char *> getGCCRegNames() const override;
218
220 return {};
221 }
222
223 ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
224
225 bool isSPRegName(StringRef RegName) const override {
226 return RegName == "esp" || RegName == "rsp";
227 }
228
229 bool supportsCpuSupports() const override { return true; }
230 bool supportsCpuIs() const override { return true; }
231 bool supportsCpuInit() const override { return true; }
232
233 bool validateCpuSupports(StringRef FeatureStr) const override;
234
235 bool validateCpuIs(StringRef FeatureStr) const override;
236
237 bool validateCPUSpecificCPUDispatch(StringRef Name) const override;
238
239 char CPUSpecificManglingCharacter(StringRef Name) const override;
240
241 void getCPUSpecificCPUDispatchFeatures(
242 StringRef Name,
243 llvm::SmallVectorImpl<StringRef> &Features) const override;
244
245 std::optional<unsigned> getCPUCacheLineSize() const override;
246
247 bool validateAsmConstraint(const char *&Name,
248 TargetInfo::ConstraintInfo &info) const override;
249
250 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
251 bool &HasSizeMismatch) const override {
252 // esp and ebp are the only 32-bit registers the x86 backend can currently
253 // handle.
254 if (RegName == "esp" || RegName == "ebp") {
255 // Check that the register size is 32-bit.
256 HasSizeMismatch = RegSize != 32;
257 return true;
258 }
259
260 return false;
261 }
262
263 bool validateOutputSize(const llvm::StringMap<bool> &FeatureMap,
264 StringRef Constraint, unsigned Size) const override;
265
266 bool validateInputSize(const llvm::StringMap<bool> &FeatureMap,
267 StringRef Constraint, unsigned Size) const override;
268
269 bool
271 if (CPU == llvm::X86::CK_None || CPU >= llvm::X86::CK_PentiumPro)
272 return true;
274 };
275
276 bool
278 if (CPU == llvm::X86::CK_None || CPU >= llvm::X86::CK_PentiumPro)
279 return true;
281 };
282
283 virtual bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
284 StringRef Constraint, unsigned Size) const;
285
286 std::string convertConstraint(const char *&Constraint) const override;
287 std::string_view getClobbers() const override {
288 return "~{dirflag},~{fpsr},~{flags}";
289 }
290
291 StringRef getConstraintRegister(StringRef Constraint,
292 StringRef Expression) const override {
293 StringRef::iterator I, E;
294 for (I = Constraint.begin(), E = Constraint.end(); I != E; ++I) {
295 if (isalpha(*I) || *I == '@')
296 break;
297 }
298 if (I == E)
299 return "";
300 switch (*I) {
301 // For the register constraints, return the matching register name
302 case 'a':
303 return "ax";
304 case 'b':
305 return "bx";
306 case 'c':
307 return "cx";
308 case 'd':
309 return "dx";
310 case 'S':
311 return "si";
312 case 'D':
313 return "di";
314 // In case the constraint is 'r' we need to return Expression
315 case 'r':
316 return Expression;
317 // Double letters Y<x> constraints
318 case 'Y':
319 if ((++I != E) && ((*I == '0') || (*I == 'z')))
320 return "xmm0";
321 break;
322 default:
323 break;
324 }
325 return "";
326 }
327
328 bool useFP16ConversionIntrinsics() const override {
329 return false;
330 }
331
332 void getTargetDefines(const LangOptions &Opts,
333 MacroBuilder &Builder) const override;
334
335 void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
336 bool Enabled) const final;
337
338 bool
339 initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
340 StringRef CPU,
341 const std::vector<std::string> &FeaturesVec) const override;
342
343 bool isValidFeatureName(StringRef Name) const override;
344
345 bool hasFeature(StringRef Feature) const final;
346
347 bool handleTargetFeatures(std::vector<std::string> &Features,
348 DiagnosticsEngine &Diags) override;
349
350 StringRef getABI() const override {
351 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
352 return "avx512";
353 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
354 return "avx";
355 if (getTriple().getArch() == llvm::Triple::x86 && !HasMMX)
356 return "no-mmx";
357 return "";
358 }
359
360 bool supportsTargetAttributeTune() const override {
361 return true;
362 }
363
364 bool isValidCPUName(StringRef Name) const override {
365 bool Only64Bit = getTriple().getArch() != llvm::Triple::x86;
366 return llvm::X86::parseArchX86(Name, Only64Bit) != llvm::X86::CK_None;
367 }
368
369 bool isValidTuneCPUName(StringRef Name) const override {
370 if (Name == "generic")
371 return true;
372
373 // Allow 32-bit only CPUs regardless of 64-bit mode unlike isValidCPUName.
374 // NOTE: gcc rejects 32-bit mtune CPUs in 64-bit mode. But being lenient
375 // since mtune was ignored by clang for so long.
376 return llvm::X86::parseTuneCPU(Name) != llvm::X86::CK_None;
377 }
378
379 void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
380 void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values) const override;
381
382 bool setCPU(const std::string &Name) override {
383 bool Only64Bit = getTriple().getArch() != llvm::Triple::x86;
384 CPU = llvm::X86::parseArchX86(Name, Only64Bit);
385 return CPU != llvm::X86::CK_None;
386 }
387
388 llvm::APInt getFMVPriority(ArrayRef<StringRef> Features) const override;
389
390 bool setFPMath(StringRef Name) override;
391
392 bool supportsExtendIntArgs() const override {
393 return getTriple().getArch() != llvm::Triple::x86;
394 }
395
397 // Most of the non-ARM calling conventions are i386 conventions.
398 switch (CC) {
399 case CC_X86ThisCall:
400 case CC_X86FastCall:
401 case CC_X86StdCall:
402 case CC_X86VectorCall:
403 case CC_X86RegCall:
404 case CC_C:
405 case CC_PreserveMost:
406 case CC_Swift:
407 case CC_X86Pascal:
408 case CC_IntelOclBicc:
409 return CCCR_OK;
410 case CC_SwiftAsync:
411 return CCCR_Error;
412 case CC_DeviceKernel:
413 return IsOpenCL ? CCCR_OK : CCCR_Warning;
414 default:
415 return CCCR_Warning;
416 }
417 }
418
419 bool checkArithmeticFenceSupported() const override { return true; }
420
422 return CC_C;
423 }
424
425 bool hasSjLjLowering() const override { return true; }
426
428
429 uint64_t getPointerWidthV(LangAS AS) const override {
430 unsigned TargetAddrSpace = getTargetAddressSpace(AS);
431 if (TargetAddrSpace == ptr32_sptr || TargetAddrSpace == ptr32_uptr)
432 return 32;
433 if (TargetAddrSpace == ptr64)
434 return 64;
435 return PointerWidth;
436 }
437
438 uint64_t getPointerAlignV(LangAS AddrSpace) const override {
439 return getPointerWidthV(AddrSpace);
440 }
442 const TargetInfo *Aux) override {
443 TargetInfo::adjust(Diags, Opts, Aux);
444 IsOpenCL = Opts.OpenCL;
445 }
446
447private:
448 bool IsOpenCL = false;
449};
450
451// X86-32 generic target
452class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
453public:
454 X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
455 : X86TargetInfo(Triple, Opts) {
457 LongDoubleWidth = 96;
458 LongDoubleAlign = 32;
459 SuitableAlign = 128;
460 resetDataLayout(Triple.isOSBinFormatMachO()
461 ? "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:"
462 "128-f64:32:64-f80:32-n8:16:32-S128"
463 : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:"
464 "128-f64:32:64-f80:32-n8:16:32-S128",
465 Triple.isOSBinFormatMachO() ? "_" : "");
469 RegParmMax = 3;
470
471 // Use fpret for all types.
475
476 // x86-32 has atomics up to 8 bytes
479 }
480
484
485 int getEHDataRegisterNumber(unsigned RegNo) const override {
486 if (RegNo == 0)
487 return 0;
488 if (RegNo == 1)
489 return 2;
490 return -1;
491 }
492
493 bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
494 StringRef Constraint, unsigned Size) const override {
495 switch (Constraint[0]) {
496 default:
497 break;
498 case 'R':
499 case 'q':
500 case 'Q':
501 case 'a':
502 case 'b':
503 case 'c':
504 case 'd':
505 case 'S':
506 case 'D':
507 return Size <= 32;
508 case 'A':
509 return Size <= 64;
510 }
511
512 return X86TargetInfo::validateOperandSize(FeatureMap, Constraint, Size);
513 }
514
515 void setMaxAtomicWidth() override {
516 if (hasFeature("cx8"))
518 }
519
520 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
521
522 bool hasBitIntType() const override { return true; }
523 size_t getMaxBitIntWidth() const override {
524 return llvm::IntegerType::MAX_INT_BITS;
525 }
526};
527
528class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
529 : public NetBSDTargetInfo<X86_32TargetInfo> {
530public:
531 NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
532 : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
533};
534
535class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
536 : public OpenBSDTargetInfo<X86_32TargetInfo> {
537public:
538 OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
539 : OpenBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {
543 }
544};
545
546class LLVM_LIBRARY_VISIBILITY AppleMachOI386TargetInfo
547 : public AppleMachOTargetInfo<X86_32TargetInfo> {
548public:
549 AppleMachOI386TargetInfo(const llvm::Triple &Triple,
550 const TargetOptions &Opts)
551 : AppleMachOTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
552};
553
554class LLVM_LIBRARY_VISIBILITY DarwinI386TargetInfo
555 : public DarwinTargetInfo<X86_32TargetInfo> {
556public:
557 DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
558 : DarwinTargetInfo<X86_32TargetInfo>(Triple, Opts) {
559 LongDoubleWidth = 128;
560 LongDoubleAlign = 128;
561 SuitableAlign = 128;
562 MaxVectorAlign = 256;
563 // The watchOS simulator uses the builtin bool type for Objective-C.
564 llvm::Triple T = llvm::Triple(Triple);
565 if (T.isWatchOS())
567 SizeType = UnsignedLong;
569 resetDataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-"
570 "f64:32:64-f80:128-n8:16:32-S128",
571 "_");
573 }
574
575 bool handleTargetFeatures(std::vector<std::string> &Features,
576 DiagnosticsEngine &Diags) override {
578 Diags))
579 return false;
580 // We now know the features we have: we can decide how to align vectors.
582 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
583 return true;
584 }
585};
586
587// x86-32 Windows target
588class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
589 : public WindowsTargetInfo<X86_32TargetInfo> {
590public:
591 WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
592 : WindowsTargetInfo<X86_32TargetInfo>(Triple, Opts) {
594 bool IsWinCOFF =
595 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
596 bool IsMSVC = getTriple().isWindowsMSVCEnvironment();
597 std::string Layout = IsWinCOFF ? "e-m:x" : "e-m:e";
598 Layout += "-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-";
599 Layout += IsMSVC ? "f80:128" : "f80:32";
600 Layout += "-n8:16:32-a:0:32-S32";
601 resetDataLayout(Layout, IsWinCOFF ? "_" : "");
602 }
603};
604
605// x86-32 Windows Visual Studio target
606class LLVM_LIBRARY_VISIBILITY MicrosoftX86_32TargetInfo
607 : public WindowsX86_32TargetInfo {
608public:
609 MicrosoftX86_32TargetInfo(const llvm::Triple &Triple,
610 const TargetOptions &Opts)
611 : WindowsX86_32TargetInfo(Triple, Opts) {
613 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
614 }
615
617 MacroBuilder &Builder) const override {
619 // The value of the following reflects processor type.
620 // 300=386, 400=486, 500=Pentium, 600=Blend (default)
621 // We lost the original triple, so we use the default.
622 Builder.defineMacro("_M_IX86", "600");
623 }
624};
625
626// x86-32 MinGW target
627class LLVM_LIBRARY_VISIBILITY MinGWX86_32TargetInfo
628 : public WindowsX86_32TargetInfo {
629public:
630 MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
631 : WindowsX86_32TargetInfo(Triple, Opts) {
632 HasFloat128 = true;
633 }
634
636 MacroBuilder &Builder) const override {
638 Builder.defineMacro("_X86_");
639 }
640};
641
642// x86-32 Cygwin target
643class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
644public:
645 CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
646 : X86_32TargetInfo(Triple, Opts) {
649 this->UseMicrosoftManglingForC = true;
651 resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-"
652 "i128:128-f80:32-n8:16:32-a:0:32-S32",
653 "_");
654 }
655
657 MacroBuilder &Builder) const override {
659 Builder.defineMacro("_X86_");
660 Builder.defineMacro("__CYGWIN__");
661 Builder.defineMacro("__CYGWIN32__");
662 addCygMingDefines(Opts, Builder);
663 DefineStd(Builder, "unix", Opts);
664 if (Opts.CPlusPlus)
665 Builder.defineMacro("_GNU_SOURCE");
666 }
667};
668
669// x86-32 Haiku target
670class LLVM_LIBRARY_VISIBILITY HaikuX86_32TargetInfo
671 : public HaikuTargetInfo<X86_32TargetInfo> {
672public:
673 HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
674 : HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
675
677 MacroBuilder &Builder) const override {
679 Builder.defineMacro("__INTEL__");
680 }
681};
682
683// X86-32 MCU target
684class LLVM_LIBRARY_VISIBILITY MCUX86_32TargetInfo : public X86_32TargetInfo {
685public:
686 MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
687 : X86_32TargetInfo(Triple, Opts) {
688 LongDoubleWidth = 64;
690 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
691 resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-"
692 "f64:32-f128:32-n8:16:32-a:0:32-S32");
694 }
695
697 // On MCU we support only C calling convention.
698 return CC == CC_C ? CCCR_OK : CCCR_Warning;
699 }
700
702 MacroBuilder &Builder) const override {
704 Builder.defineMacro("__iamcu");
705 Builder.defineMacro("__iamcu__");
706 }
707
708 bool allowsLargerPreferedTypeAlignment() const override { return false; }
709};
710
711// x86-32 RTEMS target
712class LLVM_LIBRARY_VISIBILITY RTEMSX86_32TargetInfo : public X86_32TargetInfo {
713public:
714 RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
715 : X86_32TargetInfo(Triple, Opts) {
719 }
720
722 MacroBuilder &Builder) const override {
724 Builder.defineMacro("__INTEL__");
725 Builder.defineMacro("__rtems__");
726 }
727};
728
729// x86-64 generic target
730class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
731public:
732 X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
733 : X86TargetInfo(Triple, Opts) {
734 const bool IsX32 = getTriple().isX32();
735 bool IsWinCOFF =
736 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
737 LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
738 LongDoubleWidth = 128;
739 LongDoubleAlign = 128;
740 LargeArrayMinWidth = 128;
741 LargeArrayAlign = 128;
742 SuitableAlign = 128;
744 PtrDiffType = IsX32 ? SignedInt : SignedLong;
745 IntPtrType = IsX32 ? SignedInt : SignedLong;
748 RegParmMax = 6;
749
750 // Pointers are 32-bit in x32.
751 resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-"
752 "i64:64-i128:128-f80:128-n8:16:32:64-S128"
753 : IsWinCOFF ? "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:"
754 "64-i128:128-f80:128-n8:16:32:64-S128"
755 : "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:"
756 "64-i128:128-f80:128-n8:16:32:64-S128");
757
758 // Use fpret only for long double.
760
761 // Use fp2ret for _Complex long double.
763
764 // Make __builtin_ms_va_list available.
765 HasBuiltinMSVaList = true;
766
767 // x86-64 has atomics up to 16 bytes.
770 }
771
775
776 int getEHDataRegisterNumber(unsigned RegNo) const override {
777 if (RegNo == 0)
778 return 0;
779 if (RegNo == 1)
780 return 1;
781 return -1;
782 }
783
785 switch (CC) {
786 case CC_C:
787 case CC_Swift:
788 case CC_SwiftAsync:
789 case CC_X86VectorCall:
790 case CC_IntelOclBicc:
791 case CC_Win64:
792 case CC_PreserveMost:
793 case CC_PreserveAll:
794 case CC_PreserveNone:
795 case CC_X86RegCall:
796 return CCCR_OK;
797 case CC_DeviceKernel:
798 return IsOpenCL ? CCCR_OK : CCCR_Warning;
799 default:
800 return CCCR_Warning;
801 }
802 }
803
805 return CC_C;
806 }
807
808 // for x32 we need it here explicitly
809 bool hasInt128Type() const override { return true; }
810
811 unsigned getUnwindWordWidth() const override { return 64; }
812
813 unsigned getRegisterWidth() const override { return 64; }
814
815 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
816 bool &HasSizeMismatch) const override {
817 // rsp and rbp are the only 64-bit registers the x86 backend can currently
818 // handle.
819 if (RegName == "rsp" || RegName == "rbp") {
820 // Check that the register size is 64-bit.
821 HasSizeMismatch = RegSize != 64;
822 return true;
823 }
824
825 // Check if the register is a 32-bit register the backend can handle.
826 return X86TargetInfo::validateGlobalRegisterVariable(RegName, RegSize,
827 HasSizeMismatch);
828 }
829 void setMaxAtomicWidth() override {
830 if (hasFeature("cx16"))
832 }
833
834 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
835
836 bool hasBitIntType() const override { return true; }
837 size_t getMaxBitIntWidth() const override {
838 return llvm::IntegerType::MAX_INT_BITS;
839 }
840
842 const TargetInfo *Aux) override {
843 TargetInfo::adjust(Diags, Opts, Aux);
844 IsOpenCL = Opts.OpenCL;
845 }
846
847private:
848 bool IsOpenCL = false;
849};
850
851// x86-64 UEFI target
852class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
853 : public UEFITargetInfo<X86_64TargetInfo> {
854public:
855 UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
856 : UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
857 // The UEFI spec does not mandate specific C++ ABI, integer widths, or
858 // alignment. We are setting these defaults to match the Windows target as
859 // it is the only way to build EFI applications with Clang/LLVM today. We
860 // intend to offer flexibility by supporting choices that are not default in
861 // Windows target in the future.
862 this->TheCXXABI.set(TargetCXXABI::Microsoft);
863 LongWidth = LongAlign = 32;
866 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
874 this->resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-"
875 "i64:64-i128:128-f80:128-n8:16:32:64-S128");
876 }
877
881
883 switch (CC) {
884 case CC_C:
885 case CC_Win64:
886 case CC_X86_64SysV:
887 return CCCR_OK;
888 default:
889 return CCCR_Warning;
890 }
891 }
892
894 getCallingConvKind(bool ClangABICompat4) const override {
895 return CCK_MicrosoftWin64;
896 }
897};
898
899// x86-64 Windows target
900class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
901 : public WindowsTargetInfo<X86_64TargetInfo> {
902public:
913
917
919 switch (CC) {
920 case CC_X86StdCall:
921 case CC_X86ThisCall:
922 case CC_X86FastCall:
923 return CCCR_Ignore;
924 case CC_C:
925 case CC_X86VectorCall:
926 case CC_IntelOclBicc:
927 case CC_PreserveMost:
928 case CC_PreserveAll:
929 case CC_PreserveNone:
930 case CC_X86_64SysV:
931 case CC_Swift:
932 case CC_SwiftAsync:
933 case CC_X86RegCall:
934 case CC_DeviceKernel:
935 return CCCR_OK;
936 default:
937 return CCCR_Warning;
938 }
939 }
940};
941
942// x86-64 Windows Visual Studio target
943class LLVM_LIBRARY_VISIBILITY MicrosoftX86_64TargetInfo
944 : public WindowsX86_64TargetInfo {
945public:
946 MicrosoftX86_64TargetInfo(const llvm::Triple &Triple,
947 const TargetOptions &Opts)
948 : WindowsX86_64TargetInfo(Triple, Opts) {
950 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
951 }
952
954 MacroBuilder &Builder) const override {
956 Builder.defineMacro("_M_X64", "100");
957 Builder.defineMacro("_M_AMD64", "100");
958 }
959
961 getCallingConvKind(bool ClangABICompat4) const override {
962 return CCK_MicrosoftWin64;
963 }
964};
965
966// x86-64 MinGW target
967class LLVM_LIBRARY_VISIBILITY MinGWX86_64TargetInfo
968 : public WindowsX86_64TargetInfo {
969public:
970 MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
971 : WindowsX86_64TargetInfo(Triple, Opts) {
972 // Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
973 // with x86 FP ops. Weird.
975 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
976 HasFloat128 = true;
977 }
978};
979
980// x86-64 Cygwin target
981class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
982public:
983 CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
984 : X86_64TargetInfo(Triple, Opts) {
987 this->UseMicrosoftManglingForC = true;
988 }
989
991 MacroBuilder &Builder) const override {
993 Builder.defineMacro("__x86_64__");
994 Builder.defineMacro("__CYGWIN__");
995 Builder.defineMacro("__CYGWIN64__");
996 addCygMingDefines(Opts, Builder);
997 DefineStd(Builder, "unix", Opts);
998 if (Opts.CPlusPlus)
999 Builder.defineMacro("_GNU_SOURCE");
1000 }
1001
1003 switch (CC) {
1004 case CC_X86StdCall:
1005 case CC_X86ThisCall:
1006 case CC_X86FastCall:
1007 return CCCR_Ignore;
1008 case CC_C:
1009 case CC_X86VectorCall:
1010 case CC_IntelOclBicc:
1011 case CC_PreserveMost:
1012 case CC_PreserveAll:
1013 case CC_PreserveNone:
1014 case CC_X86_64SysV:
1015 case CC_Swift:
1016 case CC_SwiftAsync:
1017 case CC_X86RegCall:
1018 case CC_DeviceKernel:
1019 return CCCR_OK;
1020 default:
1021 return CCCR_Warning;
1022 }
1023 }
1024
1028};
1029
1030class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
1031 : public DarwinTargetInfo<X86_64TargetInfo> {
1032public:
1033 DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1034 : DarwinTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1036 // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
1037 llvm::Triple T = llvm::Triple(Triple);
1038 if (T.isiOS())
1040 resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-"
1041 "f80:128-n8:16:32:64-S128",
1042 "_");
1043 }
1044
1045 bool handleTargetFeatures(std::vector<std::string> &Features,
1046 DiagnosticsEngine &Diags) override {
1048 Diags))
1049 return false;
1050 // We now know the features we have: we can decide how to align vectors.
1052 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
1053 return true;
1054 }
1055};
1056
1057class LLVM_LIBRARY_VISIBILITY OpenBSDX86_64TargetInfo
1058 : public OpenBSDTargetInfo<X86_64TargetInfo> {
1059public:
1060 OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1061 : OpenBSDTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1064 }
1065};
1066
1067// x86_32 Android target
1068class LLVM_LIBRARY_VISIBILITY AndroidX86_32TargetInfo
1069 : public LinuxTargetInfo<X86_32TargetInfo> {
1070public:
1071 AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1072 : LinuxTargetInfo<X86_32TargetInfo>(Triple, Opts) {
1073 SuitableAlign = 32;
1074 LongDoubleWidth = 64;
1075 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
1076 }
1077};
1078
1079// x86_64 Android target
1080class LLVM_LIBRARY_VISIBILITY AndroidX86_64TargetInfo
1081 : public LinuxTargetInfo<X86_64TargetInfo> {
1082public:
1083 AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1084 : LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1085 LongDoubleFormat = &llvm::APFloat::IEEEquad();
1086 }
1087};
1088
1089// x86_32 OHOS target
1090class LLVM_LIBRARY_VISIBILITY OHOSX86_32TargetInfo
1091 : public OHOSTargetInfo<X86_32TargetInfo> {
1092public:
1093 OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1094 : OHOSTargetInfo<X86_32TargetInfo>(Triple, Opts) {
1095 SuitableAlign = 32;
1096 LongDoubleWidth = 64;
1097 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
1098 }
1099};
1100
1101// x86_64 OHOS target
1102class LLVM_LIBRARY_VISIBILITY OHOSX86_64TargetInfo
1103 : public OHOSTargetInfo<X86_64TargetInfo> {
1104public:
1105 OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1106 : OHOSTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1107 LongDoubleFormat = &llvm::APFloat::IEEEquad();
1108 }
1109};
1110} // namespace targets
1111} // namespace clang
1112#endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
static llvm::APInt getFMVPriority(const TargetInfo &TI, const CodeGenFunction::FMVResolverOption &RO)
static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target)
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Definition Module.cpp:95
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:231
FPEvalMethodKind
Possible float expression evaluation method choices.
@ FEM_Extended
Use extended type for fp arithmetic.
@ FEM_Source
Use the declared type for fp arithmetic.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
TargetInfo(const llvm::Triple &T)
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection return.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
const LangASMap * AddrSpaceMap
Definition TargetInfo.h:258
void resetDataLayout(StringRef DL, const char *UserLabelPrefix="")
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition TargetInfo.h:330
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
Definition TargetInfo.h:332
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
Definition TargetInfo.h:348
unsigned char RegParmMax
Definition TargetInfo.h:255
bool UseMicrosoftManglingForC
Definition TargetInfo.h:257
virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const =0
===-— Other target property query methods -----------------------—===//
unsigned HasUnalignedAccess
Definition TargetInfo.h:283
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux)
Set forced language options.
unsigned char MaxAtomicPromoteWidth
Definition TargetInfo.h:251
unsigned RealTypeUsesObjCFPRetMask
Definition TargetInfo.h:266
virtual void supportAllOpenCLOpts(bool V=true)
unsigned ComplexLongDoubleUsesFP2Ret
Definition TargetInfo.h:268
unsigned getTargetAddressSpace(LangAS AS) const
unsigned HasAlignMac68kSupport
Definition TargetInfo.h:264
virtual bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
unsigned char MaxAtomicInlineWidth
Definition TargetInfo.h:251
TargetCXXABI TheCXXABI
Definition TargetInfo.h:256
unsigned HasBuiltinMSVaList
Definition TargetInfo.h:271
Options for controlling the target.
AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1071
AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1083
AppleMachOI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:549
AppleMachOTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:54
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:656
CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:645
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:1025
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:990
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:1002
CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:983
DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:557
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features (e.g., +sse4).
Definition X86.h:575
DarwinTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:78
DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1033
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features (e.g., +sse4).
Definition X86.h:1045
HaikuTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:298
HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:673
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:676
LinuxTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:372
MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:686
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition X86.h:708
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:701
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:696
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:616
MicrosoftX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:609
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:953
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
Definition X86.h:961
MicrosoftX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:946
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:635
MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:630
MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:970
NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:531
NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:447
OHOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:1007
OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1093
OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1105
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
Definition OSTargets.h:30
OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:538
OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:481
OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1060
RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:714
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:721
UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:843
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:855
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:878
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:882
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
Definition X86.h:894
WindowsTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:864
WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:591
WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:903
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:914
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:918
bool isSPRegName(StringRef RegName) const override
Definition X86.h:225
bool isValidTuneCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name for tuning.
Definition X86.h:369
bool supportsCpuSupports() const override
Definition X86.h:229
bool isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
Definition X86.h:364
bool setCPU(const std::string &Name) override
Target the specified CPU.
Definition X86.h:382
X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition X86.h:189
bool supportsExtendIntArgs() const override
Whether the option -fextend-arguments={32,64} is supported on the target.
Definition X86.h:392
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target.
Definition X86.h:421
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Definition X86.h:328
bool hasSjLjLowering() const override
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm....
Definition X86.h:425
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:396
bool supportsCpuIs() const override
Definition X86.h:230
bool supportsCpuInit() const override
Definition X86.h:231
bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection branch.
Definition X86.h:277
StringRef getConstraintRegister(StringRef Constraint, StringRef Expression) const override
Extracts a register from the passed constraint (if it is a single-register constraint) and the asm la...
Definition X86.h:291
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition X86.h:287
bool supportSourceEvalMethod() const override
Definition X86.h:215
bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection return.
Definition X86.h:270
LangOptions::FPEvalMethodKind getFPEvalMethod() const override
Return the value for the C99 FLT_EVAL_METHOD macro.
Definition X86.h:208
uint64_t getPointerWidthV(LangAS AS) const override
Definition X86.h:429
void setSupportedOpenCLOpts() override
Set supported OpenCL extensions and optional core features.
Definition X86.h:427
bool supportsTargetAttributeTune() const override
Determine whether this TargetInfo supports tune in target attribute.
Definition X86.h:360
const char * getLongDoubleMangling() const override
Return the mangled code of long double.
Definition X86.h:204
virtual bool validateOperandSize(const llvm::StringMap< bool > &FeatureMap, StringRef Constraint, unsigned Size) const
Definition X86.cpp:1678
bool checkArithmeticFenceSupported() const override
Controls if __arithmetic_fence is supported in the targeted backend.
Definition X86.h:419
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition X86.h:441
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
Definition X86.h:250
StringRef getABI() const override
Get the ABI currently in use.
Definition X86.h:350
llvm::X86::CPUKind CPU
Definition X86.h:184
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition X86.h:219
uint64_t getPointerAlignV(LangAS AddrSpace) const override
Definition X86.h:438
X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:454
size_t getMaxBitIntWidth() const override
Definition X86.h:523
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition X86.h:515
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition X86.h:485
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition X86.h:522
bool validateOperandSize(const llvm::StringMap< bool > &FeatureMap, StringRef Constraint, unsigned Size) const override
Definition X86.h:493
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:481
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
Definition X86.h:815
bool hasInt128Type() const override
Determine whether the __int128 type is supported on this target.
Definition X86.h:809
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:784
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target.
Definition X86.h:804
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition X86.h:836
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition X86.h:776
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition X86.h:829
size_t getMaxBitIntWidth() const override
Definition X86.h:837
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:772
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:732
unsigned getUnwindWordWidth() const override
Definition X86.h:811
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition X86.h:841
unsigned getRegisterWidth() const override
Return the "preferred" register width on this target.
Definition X86.h:813
Defines the clang::TargetInfo interface.
static const unsigned X86AddrSpaceMap[]
Definition X86.h:28
LLVM_LIBRARY_VISIBILITY void addCygMingDefines(const clang::LangOptions &Opts, clang::MacroBuilder &Builder)
Definition Targets.cpp:82
LLVM_LIBRARY_VISIBILITY void DefineStd(clang::MacroBuilder &Builder, llvm::StringRef MacroName, const clang::LangOptions &Opts)
Define a macro name and standard variants.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
LangAS
Defines the address space values used by the address space qualifier of QualType.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition Specifiers.h:278
@ CC_X86Pascal
Definition Specifiers.h:284
@ CC_Swift
Definition Specifiers.h:293
@ CC_IntelOclBicc
Definition Specifiers.h:290
@ CC_PreserveMost
Definition Specifiers.h:295
@ CC_Win64
Definition Specifiers.h:285
@ CC_X86ThisCall
Definition Specifiers.h:282
@ CC_DeviceKernel
Definition Specifiers.h:292
@ CC_PreserveNone
Definition Specifiers.h:300
@ CC_SwiftAsync
Definition Specifiers.h:294
@ CC_X86RegCall
Definition Specifiers.h:287
@ CC_X86VectorCall
Definition Specifiers.h:283
@ CC_X86StdCall
Definition Specifiers.h:280
@ CC_X86_64SysV
Definition Specifiers.h:286
@ CC_PreserveAll
Definition Specifiers.h:296
@ CC_X86FastCall
Definition Specifiers.h:281
const llvm::fltSemantics * LongDoubleFormat
Definition TargetInfo.h:143
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
Definition TargetInfo.h:170
const llvm::fltSemantics * BFloat16Format
Definition TargetInfo.h:142
unsigned char DefaultAlignForAttributeAligned
Definition TargetInfo.h:134