diff options
Diffstat (limited to 'lib/Target/X86/X86Subtarget.h')
-rw-r--r-- | lib/Target/X86/X86Subtarget.h | 97 |
1 files changed, 75 insertions, 22 deletions
diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 13d1026dcaa0b..a274b797ca8f1 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -35,11 +35,10 @@ class TargetMachine; /// namespace PICStyles { enum Style { - StubPIC, // Used on i386-darwin in -fPIC mode. - StubDynamicNoPIC, // Used on i386-darwin in -mdynamic-no-pic mode. - GOT, // Used on many 32-bit unices in -fPIC mode. - RIPRel, // Used on X86-64 when not in -static mode. - None // Set when in -static mode (not PIC or DynamicNoPIC mode). + StubPIC, // Used on i386-darwin in pic mode. + GOT, // Used on 32 bit elf on when in pic mode. + RIPRel, // Used on X86-64 when in pic mode. + None // Set when not in pic mode. }; } @@ -64,12 +63,17 @@ protected: /// Which PIC style to use PICStyles::Style PICStyle; + const TargetMachine &TM; + /// SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or none supported. X86SSEEnum X86SSELevel; /// MMX, 3DNow, 3DNow Athlon, or none supported. X863DNowEnum X863DNowLevel; + /// True if the processor supports X87 instructions. + bool HasX87; + /// True if this processor has conditional move instructions /// (generally pentium pro+). bool HasCMov; @@ -134,6 +138,12 @@ protected: /// Processor has BMI2 instructions. bool HasBMI2; + /// Processor has VBMI instructions. + bool HasVBMI; + + /// Processor has Integer Fused Multiply Add + bool HasIFMA; + /// Processor has RTM instructions. bool HasRTM; @@ -155,6 +165,12 @@ protected: /// Processor has LAHF/SAHF instructions. bool HasLAHFSAHF; + /// Processor has MONITORX/MWAITX instructions. + bool HasMWAITX; + + /// Processor has Prefetch with intent to Write instruction + bool HasPFPREFETCHWT1; + /// True if BT (bit test) of memory instructions are slow. bool IsBTMemSlow; @@ -179,6 +195,10 @@ protected: /// the stack pointer. This is an optimization for Intel Atom processors. bool UseLeaForSP; + /// True if there is no performance penalty to writing only the lower parts + /// of a YMM register without clearing the upper part. + bool HasFastPartialYMMWrite; + /// True if 8-bit divisions are significantly faster than /// 32-bit divisions and should be used when possible. bool HasSlowDivide32; @@ -226,9 +246,30 @@ protected: /// Processor has PKU extenstions bool HasPKU; - /// Processot supports MPX - Memory Protection Extensions + /// Processor supports MPX - Memory Protection Extensions bool HasMPX; + /// Processor supports Invalidate Process-Context Identifier + bool HasInvPCId; + + /// Processor has VM Functions + bool HasVMFUNC; + + /// Processor has Supervisor Mode Access Protection + bool HasSMAP; + + /// Processor has Software Guard Extensions + bool HasSGX; + + /// Processor supports Flush Cache Line instruction + bool HasCLFLUSHOPT; + + /// Processor has Persistent Commit feature + bool HasPCOMMIT; + + /// Processor supports Cache Line Write Back instruction + bool HasCLWB; + /// Use software floating point for code generation. bool UseSoftFloat; @@ -271,7 +312,7 @@ public: /// This constructor initializes the data members to match that /// of the specified triple. /// - X86Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, + X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS, const X86TargetMachine &TM, unsigned StackAlignOverride); const X86TargetLowering *getTargetLowering() const override { @@ -336,6 +377,7 @@ public: PICStyles::Style getPICStyle() const { return PICStyle; } void setPICStyle(PICStyles::Style Style) { PICStyle = Style; } + bool hasX87() const { return HasX87; } bool hasCMov() const { return HasCMov; } bool hasSSE1() const { return X86SSELevel >= SSE1; } bool hasSSE2() const { return X86SSELevel >= SSE2; } @@ -374,6 +416,8 @@ public: bool hasLZCNT() const { return HasLZCNT; } bool hasBMI() const { return HasBMI; } bool hasBMI2() const { return HasBMI2; } + bool hasVBMI() const { return HasVBMI; } + bool hasIFMA() const { return HasIFMA; } bool hasRTM() const { return HasRTM; } bool hasHLE() const { return HasHLE; } bool hasADX() const { return HasADX; } @@ -381,6 +425,7 @@ public: bool hasPRFCHW() const { return HasPRFCHW; } bool hasRDSEED() const { return HasRDSEED; } bool hasLAHFSAHF() const { return HasLAHFSAHF; } + bool hasMWAITX() const { return HasMWAITX; } bool isBTMemSlow() const { return IsBTMemSlow; } bool isSHLDSlow() const { return IsSHLDSlow; } bool isUnalignedMem16Slow() const { return IsUAMem16Slow; } @@ -388,6 +433,7 @@ public: bool hasSSEUnalignedMem() const { return HasSSEUnalignedMem; } bool hasCmpxchg16b() const { return HasCmpxchg16b; } bool useLeaForSP() const { return UseLeaForSP; } + bool hasFastPartialYMMWrite() const { return HasFastPartialYMMWrite; } bool hasSlowDivide32() const { return HasSlowDivide32; } bool hasSlowDivide64() const { return HasSlowDivide64; } bool padShortFunctions() const { return PadShortFunctions; } @@ -408,6 +454,11 @@ public: bool isSLM() const { return X86ProcFamily == IntelSLM; } bool useSoftFloat() const { return UseSoftFloat; } + /// Use mfence if we have SSE2 or we're on x86-64 (even if we asked for + /// no-sse2). There isn't any reason to disable it if the target processor + /// supports it. + bool hasMFence() const { return hasSSE2() || is64Bit(); } + const Triple &getTargetTriple() const { return TargetTriple; } bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); } @@ -421,6 +472,8 @@ public: bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); } bool isTargetLinux() const { return TargetTriple.isOSLinux(); } + bool isTargetKFreeBSD() const { return TargetTriple.isOSKFreeBSD(); } + bool isTargetGlibc() const { return TargetTriple.isOSGlibc(); } bool isTargetAndroid() const { return TargetTriple.isAndroid(); } bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); } bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); } @@ -463,7 +516,6 @@ public: return !In64BitMode && (isTargetCygMing() || isTargetKnownWindowsMSVC()); } - bool isPICStyleSet() const { return PICStyle != PICStyles::None; } bool isPICStyleGOT() const { return PICStyle == PICStyles::GOT; } bool isPICStyleRIPRel() const { return PICStyle == PICStyles::RIPRel; } @@ -471,13 +523,7 @@ public: return PICStyle == PICStyles::StubPIC; } - bool isPICStyleStubNoDynamic() const { - return PICStyle == PICStyles::StubDynamicNoPIC; - } - bool isPICStyleStubAny() const { - return PICStyle == PICStyles::StubDynamicNoPIC || - PICStyle == PICStyles::StubPIC; - } + bool isPositionIndependent() const { return TM.isPositionIndependent(); } bool isCallingConvWin64(CallingConv::ID CC) const { switch (CC) { @@ -502,18 +548,25 @@ public: } } - /// ClassifyGlobalReference - Classify a global variable reference for the - /// current subtarget according to how we should reference it in a non-pcrel - /// context. - unsigned char ClassifyGlobalReference(const GlobalValue *GV, - const TargetMachine &TM)const; + /// Classify a global variable reference for the current subtarget according + /// to how we should reference it in a non-pcrel context. + unsigned char classifyLocalReference(const GlobalValue *GV) const; + + unsigned char classifyGlobalReference(const GlobalValue *GV, + const Module &M) const; + unsigned char classifyGlobalReference(const GlobalValue *GV) const; + + /// Classify a global function reference for the current subtarget. + unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, + const Module &M) const; + unsigned char classifyGlobalFunctionReference(const GlobalValue *GV) const; /// Classify a blockaddress reference for the current subtarget according to /// how we should reference it in a non-pcrel context. - unsigned char ClassifyBlockAddressReference() const; + unsigned char classifyBlockAddressReference() const; /// Return true if the subtarget allows calls to immediate address. - bool IsLegalToCallImmediateAddr(const TargetMachine &TM) const; + bool isLegalToCallImmediateAddr() const; /// This function returns the name of a function which has an interface /// like the non-standard bzero function, if such a function exists on |