14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_X86_H 15 #define LLVM_CLANG_LIB_BASIC_TARGETS_X86_H 20 #include "llvm/ADT/Triple.h" 21 #include "llvm/Support/Compiler.h" 47 } MMX3DNowLevel = NoMMX3DNow;
48 enum XOPEnum { NoXOP, SSE4A, FMA4, XOP } XOPLevel = NoXOP;
52 bool HasPCLMUL =
false;
53 bool HasVPCLMULQDQ =
false;
55 bool HasLZCNT =
false;
56 bool HasRDRND =
false;
57 bool HasFSGSBASE =
false;
60 bool HasPOPCNT =
false;
62 bool HasPRFCHW =
false;
63 bool HasRDSEED =
false;
69 bool HasAVX512CD =
false;
70 bool HasAVX512VPOPCNTDQ =
false;
71 bool HasAVX512VNNI =
false;
72 bool HasAVX512ER =
false;
73 bool HasAVX512PF =
false;
74 bool HasAVX512DQ =
false;
75 bool HasAVX512BITALG =
false;
76 bool HasAVX512BW =
false;
77 bool HasAVX512VL =
false;
78 bool HasAVX512VBMI =
false;
79 bool HasAVX512VBMI2 =
false;
80 bool HasAVX512IFMA =
false;
83 bool HasSHSTK =
false;
88 bool HasXSAVE =
false;
89 bool HasXSAVEOPT =
false;
90 bool HasXSAVEC =
false;
91 bool HasXSAVES =
false;
92 bool HasMWAITX =
false;
93 bool HasCLZERO =
false;
95 bool HasCLFLUSHOPT =
false;
97 bool HasMOVBE =
false;
98 bool HasPREFETCHWT1 =
false;
99 bool HasRetpoline =
false;
100 bool HasRetpolineExternalThunk =
false;
108 #define PROC(ENUM, STRING, IS64BIT) CK_##ENUM, 109 #include "clang/Basic/X86Target.def" 112 bool checkCPUKind(CPUKind
Kind)
const;
114 CPUKind getCPUKind(StringRef CPU)
const;
116 enum FPMathKind { FP_Default, FP_SSE, FP_387 } FPMath = FP_Default;
121 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
126 return SSELevel == NoSSE ? 2 : 0;
137 bool validateCpuSupports(StringRef Name)
const override;
139 bool validateCpuIs(StringRef Name)
const override;
141 bool validateAsmConstraint(
const char *&Name,
145 bool &HasSizeMismatch)
const override {
148 if (RegName.equals(
"esp") || RegName.equals(
"ebp")) {
150 HasSizeMismatch = RegSize != 32;
157 bool validateOutputSize(StringRef Constraint,
unsigned Size)
const override;
159 bool validateInputSize(StringRef Constraint,
unsigned Size)
const override;
161 virtual bool validateOperandSize(StringRef Constraint,
unsigned Size)
const;
163 std::string convertConstraint(
const char *&Constraint)
const override;
165 return "~{dirflag},~{fpsr},~{flags}";
169 const StringRef &Expression)
const override {
170 StringRef::iterator I, E;
171 for (I = Constraint.begin(), E = Constraint.end(); I != E; ++I) {
196 if ((++I != E) && ((*I ==
'0') || (*I ==
'z')))
211 static void setSSELevel(llvm::StringMap<bool> &Features, X86SSEEnum
Level,
214 static void setMMXLevel(llvm::StringMap<bool> &Features, MMX3DNowEnum Level,
217 static void setXOPLevel(llvm::StringMap<bool> &Features, XOPEnum Level,
221 bool Enabled)
const override {
222 setFeatureEnabledImpl(Features, Name, Enabled);
227 static void setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
228 StringRef Name,
bool Enabled);
233 const std::vector<std::string> &FeaturesVec)
const override;
235 bool isValidFeatureName(StringRef Name)
const override;
237 bool hasFeature(StringRef Feature)
const override;
239 bool handleTargetFeatures(std::vector<std::string> &Features,
243 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
245 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
247 if (getTriple().getArch() == llvm::Triple::x86 &&
248 MMX3DNowLevel == NoMMX3DNow)
254 return checkCPUKind(getCPUKind(Name));
257 bool setCPU(
const std::string &Name)
override {
258 return checkCPUKind(CPU = getCPUKind(Name));
261 bool setFPMath(StringRef Name)
override;
289 getSupportedOpenCLOpts().supportAll();
298 DoubleAlign = LongLongAlign = 32;
299 LongDoubleWidth = 96;
300 LongDoubleAlign = 32;
302 resetDataLayout(
"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
303 SizeType = UnsignedInt;
304 PtrDiffType = SignedInt;
305 IntPtrType = SignedInt;
309 RealTypeUsesObjCFPRet =
316 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
332 switch (Constraint[0]) {
362 unsigned Major, Minor, Micro;
363 getTriple().getOSVersion(Major, Minor, Micro);
365 if (Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 26) || Major == 0)
377 SizeType = UnsignedLong;
378 IntPtrType = SignedLong;
379 PtrDiffType = SignedLong;
388 LongDoubleWidth = 128;
389 LongDoubleAlign = 128;
391 MaxVectorAlign = 256;
393 llvm::Triple
T = llvm::Triple(Triple);
395 UseSignedCharForObjCBool =
false;
396 SizeType = UnsignedLong;
397 IntPtrType = SignedLong;
398 resetDataLayout(
"e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128");
399 HasAlignMac68kSupport =
true;
420 DoubleAlign = LongLongAlign = 64;
422 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
423 resetDataLayout(IsWinCOFF
424 ?
"e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 425 :
"e-m:e-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32");
436 LongDoubleWidth = LongDoubleAlign = 64;
437 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
473 DoubleAlign = LongLongAlign = 64;
474 resetDataLayout(
"e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32");
509 LongDoubleWidth = 64;
510 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
511 resetDataLayout(
"e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32");
512 WIntType = UnsignedInt;
517 return CC ==
CC_C ? CCCR_OK : CCCR_Warning;
535 SizeType = UnsignedLong;
536 IntPtrType = SignedLong;
537 PtrDiffType = SignedLong;
553 const bool IsX32 = getTriple().getEnvironment() == llvm::Triple::GNUX32;
555 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
556 LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
557 LongDoubleWidth = 128;
558 LongDoubleAlign = 128;
559 LargeArrayMinWidth = 128;
560 LargeArrayAlign = 128;
562 SizeType = IsX32 ? UnsignedInt : UnsignedLong;
563 PtrDiffType = IsX32 ? SignedInt : SignedLong;
564 IntPtrType = IsX32 ? SignedInt : SignedLong;
565 IntMaxType = IsX32 ? SignedLongLong : SignedLong;
566 Int64Type = IsX32 ? SignedLongLong : SignedLong;
570 resetDataLayout(IsX32
571 ?
"e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128" 572 : IsWinCOFF ?
"e-m:w-i64:64-f80:128-n8:16:32:64-S128" 573 :
"e-m:e-i64:64-f80:128-n8:16:32:64-S128");
579 ComplexLongDoubleUsesFP2Ret =
true;
582 HasBuiltinMSVaList =
true;
585 MaxAtomicPromoteWidth = 128;
586 MaxAtomicInlineWidth = 64;
630 bool &HasSizeMismatch)
const override {
633 if (RegName.equals(
"rsp") || RegName.equals(
"rbp")) {
635 HasSizeMismatch = RegSize != 64;
646 MaxAtomicInlineWidth = 128;
658 LongWidth = LongAlign = 32;
659 DoubleAlign = LongLongAlign = 64;
660 IntMaxType = SignedLongLong;
661 Int64Type = SignedLongLong;
662 SizeType = UnsignedLongLong;
663 PtrDiffType = SignedLongLong;
664 IntPtrType = SignedLongLong;
700 LongDoubleWidth = LongDoubleAlign = 64;
701 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
721 LongDoubleWidth = LongDoubleAlign = 128;
722 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
733 TLSSupported =
false;
754 Int64Type = SignedLongLong;
756 llvm::Triple
T = llvm::Triple(Triple);
758 UseSignedCharForObjCBool =
false;
759 resetDataLayout(
"e-m:o-i64:64-f80:128-n8:16:32:64-S128");
779 IntMaxType = SignedLongLong;
780 Int64Type = SignedLongLong;
791 LongDoubleWidth = 64;
792 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
802 LongDoubleFormat = &llvm::APFloat::IEEEquad();
809 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
void DefineStd(MacroBuilder &Builder, StringRef MacroName, const LangOptions &Opts)
DefineStd - Define a macro name and standard variants.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the 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...
bool isValidCPUName(StringRef Name) const override
brief Determine whether this TargetInfo supports the given CPU name.
unsigned getUnwindWordWidth() const override
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Options for controlling the target.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
virtual bool validateOperandSize(StringRef Constraint, unsigned Size) const
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument...
bool useFloat128ManglingForLongDouble() const override
Return true if the 'long double' type should be mangled like __float128.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
unsigned getFloatEvalMethod() const override
Return the value for the C99 FLT_EVAL_METHOD macro.
MicrosoftX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override
Gets the default calling convention for the given target and declaration context. ...
StringRef getConstraintRegister(const StringRef &Constraint, const StringRef &Expression) const override
MicrosoftX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Concrete class used by the front-end to report problems and issues.
unsigned getRegisterWidth() const override
Return the "preferred" register width on this target.
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
Exposes information about the current target.
AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
const FunctionProtoType * T
void getVisualStudioDefines(const LangOptions &Opts, MacroBuilder &Builder) const
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
bool setCPU(const std::string &Name) override
Target the specified CPU.
StringRef getABI() const override
Get the ABI currently in use.
void addCygMingDefines(const LangOptions &Opts, MacroBuilder &Builder)
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Defines the clang::TargetOptions class.
CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override
Gets the default calling convention for the given target and declaration context. ...
RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Dataflow Directional Tag Classes.
typedef char* __builtin_va_list;
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
bool validateOperandSize(StringRef Constraint, unsigned Size) const override
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument...
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
handleTargetFeatures - Perform initialization based on the user configured set of features...
bool hasSjLjLowering() const override
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm...
unsigned getFloatEvalMethod() const override
Return the value for the C99 FLT_EVAL_METHOD macro.
MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
bool hasInt128Type() const override
Determine whether the __int128 type is supported on this target.
void setSupportedOpenCLOpts() override
Set supported OpenCL extensions and optional core features.
MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro definitions for this parti...
Defines the clang::TargetInfo interface.
void setFeatureEnabled(llvm::StringMap< bool > &Features, StringRef Name, bool Enabled) const override
Enable or disable a specific target feature; the feature name must be valid.
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
handleTargetFeatures - Perform initialization based on the user configured set of features...
CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)