1 //===--- X86.h - Declare X86 target feature support -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares X86 TargetInfo objects.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
17 #include "OSTargets.h"
18 #include "clang/Basic/TargetInfo.h"
19 #include "clang/Basic/TargetOptions.h"
20 #include "llvm/ADT/Triple.h"
21 #include "llvm/Support/Compiler.h"
26 // X86 target abstract base class; x86-32 and x86-64 are very close, so
27 // most of the implementation can be shared.
28 class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
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;
87 bool HasXSAVE = false;
88 bool HasXSAVEOPT = false;
89 bool HasXSAVEC = false;
90 bool HasXSAVES = false;
91 bool HasMWAITX = false;
92 bool HasCLZERO = false;
93 bool HasCLDEMOTE = false;
94 bool HasPCONFIG = false;
96 bool HasCLFLUSHOPT = false;
98 bool HasMOVBE = false;
99 bool HasPREFETCHWT1 = false;
100 bool HasRDPID = false;
101 bool HasRetpoline = false;
102 bool HasRetpolineExternalThunk = false;
103 bool HasLAHFSAHF = false;
104 bool HasWBNOINVD = false;
105 bool HasWAITPKG = false;
106 bool HasMOVDIRI = false;
107 bool HasMOVDIR64B = false;
108 bool HasPTWRITE = false;
109 bool HasINVPCID = false;
112 /// Enumeration of all of the X86 CPUs supported by Clang.
114 /// Each enumeration represents a particular CPU supported by Clang. These
115 /// loosely correspond to the options passed to '-march' or '-mtune' flags.
118 #define PROC(ENUM, STRING, IS64BIT) CK_##ENUM,
119 #include "clang/Basic/X86Target.def"
122 bool checkCPUKind(CPUKind Kind) const;
124 CPUKind getCPUKind(StringRef CPU) const;
126 std::string getCPUKindCanonicalName(CPUKind Kind) const;
128 enum FPMathKind { FP_Default, FP_SSE, FP_387 } FPMath = FP_Default;
131 X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
132 : TargetInfo(Triple) {
133 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
136 unsigned getFloatEvalMethod() const override {
137 // X87 evaluates with 80 bits "long double" precision.
138 return SSELevel == NoSSE ? 2 : 0;
141 ArrayRef<const char *> getGCCRegNames() const override;
143 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
147 ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
149 bool validateCpuSupports(StringRef Name) const override;
151 bool validateCpuIs(StringRef Name) const override;
153 bool validateCPUSpecificCPUDispatch(StringRef Name) const override;
155 char CPUSpecificManglingCharacter(StringRef Name) const override;
157 void getCPUSpecificCPUDispatchFeatures(
159 llvm::SmallVectorImpl<StringRef> &Features) const override;
161 bool validateAsmConstraint(const char *&Name,
162 TargetInfo::ConstraintInfo &info) const override;
164 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
165 bool &HasSizeMismatch) const override {
166 // esp and ebp are the only 32-bit registers the x86 backend can currently
168 if (RegName.equals("esp") || RegName.equals("ebp")) {
169 // Check that the register size is 32-bit.
170 HasSizeMismatch = RegSize != 32;
177 bool validateOutputSize(StringRef Constraint, unsigned Size) const override;
179 bool validateInputSize(StringRef Constraint, unsigned Size) const override;
182 checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override {
187 checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const override {
192 virtual bool validateOperandSize(StringRef Constraint, unsigned Size) const;
194 std::string convertConstraint(const char *&Constraint) const override;
195 const char *getClobbers() const override {
196 return "~{dirflag},~{fpsr},~{flags}";
199 StringRef getConstraintRegister(StringRef Constraint,
200 StringRef Expression) const override {
201 StringRef::iterator I, E;
202 for (I = Constraint.begin(), E = Constraint.end(); I != E; ++I) {
209 // For the register constraints, return the matching register name
222 // In case the constraint is 'r' we need to return Expression
225 // Double letters Y<x> constraints
227 if ((++I != E) && ((*I == '0') || (*I == 'z')))
235 bool useFP16ConversionIntrinsics() const override {
239 void getTargetDefines(const LangOptions &Opts,
240 MacroBuilder &Builder) const override;
242 static void setSSELevel(llvm::StringMap<bool> &Features, X86SSEEnum Level,
245 static void setMMXLevel(llvm::StringMap<bool> &Features, MMX3DNowEnum Level,
248 static void setXOPLevel(llvm::StringMap<bool> &Features, XOPEnum Level,
251 void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
252 bool Enabled) const override {
253 setFeatureEnabledImpl(Features, Name, Enabled);
256 // This exists purely to cut down on the number of virtual calls in
257 // initFeatureMap which calls this repeatedly.
258 static void setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
259 StringRef Name, bool Enabled);
262 initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
264 const std::vector<std::string> &FeaturesVec) const override;
266 bool isValidFeatureName(StringRef Name) const override;
268 bool hasFeature(StringRef Feature) const override;
270 bool handleTargetFeatures(std::vector<std::string> &Features,
271 DiagnosticsEngine &Diags) override;
273 StringRef getABI() const override {
274 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
276 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
278 if (getTriple().getArch() == llvm::Triple::x86 &&
279 MMX3DNowLevel == NoMMX3DNow)
284 bool isValidCPUName(StringRef Name) const override {
285 return checkCPUKind(getCPUKind(Name));
288 void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
290 bool setCPU(const std::string &Name) override {
291 return checkCPUKind(CPU = getCPUKind(Name));
294 bool supportsMultiVersioning() const override {
295 return getTriple().isOSBinFormatELF();
297 unsigned multiVersionSortPriority(StringRef Name) const override;
299 bool setFPMath(StringRef Name) override;
301 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
302 // Most of the non-ARM calling conventions are i386 conventions.
307 case CC_X86VectorCall:
310 case CC_PreserveMost:
313 case CC_IntelOclBicc:
314 case CC_OpenCLKernel:
321 CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override {
322 return MT == CCMT_Member ? CC_X86ThisCall : CC_C;
325 bool hasSjLjLowering() const override { return true; }
327 void setSupportedOpenCLOpts() override {
328 getSupportedOpenCLOpts().supportAll();
332 // X86-32 generic target
333 class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
335 X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
336 : X86TargetInfo(Triple, Opts) {
337 DoubleAlign = LongLongAlign = 32;
338 LongDoubleWidth = 96;
339 LongDoubleAlign = 32;
341 resetDataLayout("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
342 SizeType = UnsignedInt;
343 PtrDiffType = SignedInt;
344 IntPtrType = SignedInt;
347 // Use fpret for all types.
348 RealTypeUsesObjCFPRet =
349 ((1 << TargetInfo::Float) | (1 << TargetInfo::Double) |
350 (1 << TargetInfo::LongDouble));
352 // x86-32 has atomics up to 8 bytes
353 CPUKind Kind = getCPUKind(Opts.CPU);
354 if (Kind >= CK_i586 || Kind == CK_Generic)
355 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
356 else if (Kind >= CK_i486)
357 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
360 BuiltinVaListKind getBuiltinVaListKind() const override {
361 return TargetInfo::CharPtrBuiltinVaList;
364 int getEHDataRegisterNumber(unsigned RegNo) const override {
372 bool validateOperandSize(StringRef Constraint, unsigned Size) const override {
373 switch (Constraint[0]) {
390 return X86TargetInfo::validateOperandSize(Constraint, Size);
393 ArrayRef<Builtin::Info> getTargetBuiltins() const override;
396 class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
397 : public NetBSDTargetInfo<X86_32TargetInfo> {
399 NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
400 : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
402 unsigned getFloatEvalMethod() const override {
403 unsigned Major, Minor, Micro;
404 getTriple().getOSVersion(Major, Minor, Micro);
405 // New NetBSD uses the default rounding mode.
406 if (Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 26) || Major == 0)
407 return X86_32TargetInfo::getFloatEvalMethod();
408 // NetBSD before 6.99.26 defaults to "double" rounding.
413 class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
414 : public OpenBSDTargetInfo<X86_32TargetInfo> {
416 OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
417 : OpenBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {
418 SizeType = UnsignedLong;
419 IntPtrType = SignedLong;
420 PtrDiffType = SignedLong;
424 class LLVM_LIBRARY_VISIBILITY DarwinI386TargetInfo
425 : public DarwinTargetInfo<X86_32TargetInfo> {
427 DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
428 : DarwinTargetInfo<X86_32TargetInfo>(Triple, Opts) {
429 LongDoubleWidth = 128;
430 LongDoubleAlign = 128;
432 MaxVectorAlign = 256;
433 // The watchOS simulator uses the builtin bool type for Objective-C.
434 llvm::Triple T = llvm::Triple(Triple);
436 UseSignedCharForObjCBool = false;
437 SizeType = UnsignedLong;
438 IntPtrType = SignedLong;
439 resetDataLayout("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128");
440 HasAlignMac68kSupport = true;
443 bool handleTargetFeatures(std::vector<std::string> &Features,
444 DiagnosticsEngine &Diags) override {
445 if (!DarwinTargetInfo<X86_32TargetInfo>::handleTargetFeatures(Features,
448 // We now know the features we have: we can decide how to align vectors.
450 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
455 // x86-32 Windows target
456 class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
457 : public WindowsTargetInfo<X86_32TargetInfo> {
459 WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
460 : WindowsTargetInfo<X86_32TargetInfo>(Triple, Opts) {
461 DoubleAlign = LongLongAlign = 64;
463 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
464 resetDataLayout(IsWinCOFF
465 ? "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
466 : "e-m:e-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32");
470 // x86-32 Windows Visual Studio target
471 class LLVM_LIBRARY_VISIBILITY MicrosoftX86_32TargetInfo
472 : public WindowsX86_32TargetInfo {
474 MicrosoftX86_32TargetInfo(const llvm::Triple &Triple,
475 const TargetOptions &Opts)
476 : WindowsX86_32TargetInfo(Triple, Opts) {
477 LongDoubleWidth = LongDoubleAlign = 64;
478 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
481 void getTargetDefines(const LangOptions &Opts,
482 MacroBuilder &Builder) const override {
483 WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
484 WindowsX86_32TargetInfo::getVisualStudioDefines(Opts, Builder);
485 // The value of the following reflects processor type.
486 // 300=386, 400=486, 500=Pentium, 600=Blend (default)
487 // We lost the original triple, so we use the default.
488 Builder.defineMacro("_M_IX86", "600");
492 // x86-32 MinGW target
493 class LLVM_LIBRARY_VISIBILITY MinGWX86_32TargetInfo
494 : public WindowsX86_32TargetInfo {
496 MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
497 : WindowsX86_32TargetInfo(Triple, Opts) {
501 void getTargetDefines(const LangOptions &Opts,
502 MacroBuilder &Builder) const override {
503 WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
504 Builder.defineMacro("_X86_");
508 // x86-32 Cygwin target
509 class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
511 CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
512 : X86_32TargetInfo(Triple, Opts) {
513 this->WCharType = TargetInfo::UnsignedShort;
514 DoubleAlign = LongLongAlign = 64;
515 resetDataLayout("e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32");
518 void getTargetDefines(const LangOptions &Opts,
519 MacroBuilder &Builder) const override {
520 X86_32TargetInfo::getTargetDefines(Opts, Builder);
521 Builder.defineMacro("_X86_");
522 Builder.defineMacro("__CYGWIN__");
523 Builder.defineMacro("__CYGWIN32__");
524 addCygMingDefines(Opts, Builder);
525 DefineStd(Builder, "unix", Opts);
527 Builder.defineMacro("_GNU_SOURCE");
531 // x86-32 Haiku target
532 class LLVM_LIBRARY_VISIBILITY HaikuX86_32TargetInfo
533 : public HaikuTargetInfo<X86_32TargetInfo> {
535 HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
536 : HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
538 void getTargetDefines(const LangOptions &Opts,
539 MacroBuilder &Builder) const override {
540 HaikuTargetInfo<X86_32TargetInfo>::getTargetDefines(Opts, Builder);
541 Builder.defineMacro("__INTEL__");
546 class LLVM_LIBRARY_VISIBILITY MCUX86_32TargetInfo : public X86_32TargetInfo {
548 MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
549 : X86_32TargetInfo(Triple, Opts) {
550 LongDoubleWidth = 64;
551 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
552 resetDataLayout("e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32");
553 WIntType = UnsignedInt;
556 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
557 // On MCU we support only C calling convention.
558 return CC == CC_C ? CCCR_OK : CCCR_Warning;
561 void getTargetDefines(const LangOptions &Opts,
562 MacroBuilder &Builder) const override {
563 X86_32TargetInfo::getTargetDefines(Opts, Builder);
564 Builder.defineMacro("__iamcu");
565 Builder.defineMacro("__iamcu__");
568 bool allowsLargerPreferedTypeAlignment() const override { return false; }
571 // x86-32 RTEMS target
572 class LLVM_LIBRARY_VISIBILITY RTEMSX86_32TargetInfo : public X86_32TargetInfo {
574 RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
575 : X86_32TargetInfo(Triple, Opts) {
576 SizeType = UnsignedLong;
577 IntPtrType = SignedLong;
578 PtrDiffType = SignedLong;
581 void getTargetDefines(const LangOptions &Opts,
582 MacroBuilder &Builder) const override {
583 X86_32TargetInfo::getTargetDefines(Opts, Builder);
584 Builder.defineMacro("__INTEL__");
585 Builder.defineMacro("__rtems__");
589 // x86-64 generic target
590 class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
592 X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
593 : X86TargetInfo(Triple, Opts) {
594 const bool IsX32 = getTriple().getEnvironment() == llvm::Triple::GNUX32;
596 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
597 LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
598 LongDoubleWidth = 128;
599 LongDoubleAlign = 128;
600 LargeArrayMinWidth = 128;
601 LargeArrayAlign = 128;
603 SizeType = IsX32 ? UnsignedInt : UnsignedLong;
604 PtrDiffType = IsX32 ? SignedInt : SignedLong;
605 IntPtrType = IsX32 ? SignedInt : SignedLong;
606 IntMaxType = IsX32 ? SignedLongLong : SignedLong;
607 Int64Type = IsX32 ? SignedLongLong : SignedLong;
610 // Pointers are 32-bit in x32.
611 resetDataLayout(IsX32
612 ? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
613 : IsWinCOFF ? "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
614 : "e-m:e-i64:64-f80:128-n8:16:32:64-S128");
616 // Use fpret only for long double.
617 RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);
619 // Use fp2ret for _Complex long double.
620 ComplexLongDoubleUsesFP2Ret = true;
622 // Make __builtin_ms_va_list available.
623 HasBuiltinMSVaList = true;
625 // x86-64 has atomics up to 16 bytes.
626 MaxAtomicPromoteWidth = 128;
627 MaxAtomicInlineWidth = 64;
630 BuiltinVaListKind getBuiltinVaListKind() const override {
631 return TargetInfo::X86_64ABIBuiltinVaList;
634 int getEHDataRegisterNumber(unsigned RegNo) const override {
642 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
646 case CC_X86VectorCall:
647 case CC_IntelOclBicc:
649 case CC_PreserveMost:
652 case CC_OpenCLKernel:
659 CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override {
663 // for x32 we need it here explicitly
664 bool hasInt128Type() const override { return true; }
666 unsigned getUnwindWordWidth() const override { return 64; }
668 unsigned getRegisterWidth() const override { return 64; }
670 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
671 bool &HasSizeMismatch) const override {
672 // rsp and rbp are the only 64-bit registers the x86 backend can currently
674 if (RegName.equals("rsp") || RegName.equals("rbp")) {
675 // Check that the register size is 64-bit.
676 HasSizeMismatch = RegSize != 64;
680 // Check if the register is a 32-bit register the backend can handle.
681 return X86TargetInfo::validateGlobalRegisterVariable(RegName, RegSize,
685 void setMaxAtomicWidth() override {
686 if (hasFeature("cx16"))
687 MaxAtomicInlineWidth = 128;
690 ArrayRef<Builtin::Info> getTargetBuiltins() const override;
693 // x86-64 Windows target
694 class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
695 : public WindowsTargetInfo<X86_64TargetInfo> {
697 WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
698 : WindowsTargetInfo<X86_64TargetInfo>(Triple, Opts) {
699 LongWidth = LongAlign = 32;
700 DoubleAlign = LongLongAlign = 64;
701 IntMaxType = SignedLongLong;
702 Int64Type = SignedLongLong;
703 SizeType = UnsignedLongLong;
704 PtrDiffType = SignedLongLong;
705 IntPtrType = SignedLongLong;
708 BuiltinVaListKind getBuiltinVaListKind() const override {
709 return TargetInfo::CharPtrBuiltinVaList;
712 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
719 case CC_X86VectorCall:
720 case CC_IntelOclBicc:
721 case CC_PreserveMost:
726 case CC_OpenCLKernel:
734 // x86-64 Windows Visual Studio target
735 class LLVM_LIBRARY_VISIBILITY MicrosoftX86_64TargetInfo
736 : public WindowsX86_64TargetInfo {
738 MicrosoftX86_64TargetInfo(const llvm::Triple &Triple,
739 const TargetOptions &Opts)
740 : WindowsX86_64TargetInfo(Triple, Opts) {
741 LongDoubleWidth = LongDoubleAlign = 64;
742 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
745 void getTargetDefines(const LangOptions &Opts,
746 MacroBuilder &Builder) const override {
747 WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
748 WindowsX86_64TargetInfo::getVisualStudioDefines(Opts, Builder);
749 Builder.defineMacro("_M_X64", "100");
750 Builder.defineMacro("_M_AMD64", "100");
753 TargetInfo::CallingConvKind
754 getCallingConvKind(bool ClangABICompat4) const override {
755 return CCK_MicrosoftWin64;
759 // x86-64 MinGW target
760 class LLVM_LIBRARY_VISIBILITY MinGWX86_64TargetInfo
761 : public WindowsX86_64TargetInfo {
763 MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
764 : WindowsX86_64TargetInfo(Triple, Opts) {
765 // Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
766 // with x86 FP ops. Weird.
767 LongDoubleWidth = LongDoubleAlign = 128;
768 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
773 // x86-64 Cygwin target
774 class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
776 CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
777 : X86_64TargetInfo(Triple, Opts) {
778 this->WCharType = TargetInfo::UnsignedShort;
779 TLSSupported = false;
782 void getTargetDefines(const LangOptions &Opts,
783 MacroBuilder &Builder) const override {
784 X86_64TargetInfo::getTargetDefines(Opts, Builder);
785 Builder.defineMacro("__x86_64__");
786 Builder.defineMacro("__CYGWIN__");
787 Builder.defineMacro("__CYGWIN64__");
788 addCygMingDefines(Opts, Builder);
789 DefineStd(Builder, "unix", Opts);
791 Builder.defineMacro("_GNU_SOURCE");
795 class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
796 : public DarwinTargetInfo<X86_64TargetInfo> {
798 DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
799 : DarwinTargetInfo<X86_64TargetInfo>(Triple, Opts) {
800 Int64Type = SignedLongLong;
801 // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
802 llvm::Triple T = llvm::Triple(Triple);
804 UseSignedCharForObjCBool = false;
805 resetDataLayout("e-m:o-i64:64-f80:128-n8:16:32:64-S128");
808 bool handleTargetFeatures(std::vector<std::string> &Features,
809 DiagnosticsEngine &Diags) override {
810 if (!DarwinTargetInfo<X86_64TargetInfo>::handleTargetFeatures(Features,
813 // We now know the features we have: we can decide how to align vectors.
815 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
820 class LLVM_LIBRARY_VISIBILITY OpenBSDX86_64TargetInfo
821 : public OpenBSDTargetInfo<X86_64TargetInfo> {
823 OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
824 : OpenBSDTargetInfo<X86_64TargetInfo>(Triple, Opts) {
825 IntMaxType = SignedLongLong;
826 Int64Type = SignedLongLong;
830 // x86_32 Android target
831 class LLVM_LIBRARY_VISIBILITY AndroidX86_32TargetInfo
832 : public LinuxTargetInfo<X86_32TargetInfo> {
834 AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
835 : LinuxTargetInfo<X86_32TargetInfo>(Triple, Opts) {
837 LongDoubleWidth = 64;
838 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
842 // x86_64 Android target
843 class LLVM_LIBRARY_VISIBILITY AndroidX86_64TargetInfo
844 : public LinuxTargetInfo<X86_64TargetInfo> {
846 AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
847 : LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts) {
848 LongDoubleFormat = &llvm::APFloat::IEEEquad();
851 bool useFloat128ManglingForLongDouble() const override { return true; }
853 } // namespace targets
855 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H