34 #define DEBUG_TYPE "subtarget"
36 #define GET_SUBTARGETINFO_TARGET_DESC
37 #define GET_SUBTARGETINFO_CTOR
38 #include "X86GenSubtargetInfo.inc"
44 cl::desc(
"Enable early if-conversion on X86"));
134 auto *
F = dyn_cast_or_null<Function>(GV);
135 if (
F &&
F->hasFnAttribute(Attribute::NonLazyBind))
176 std::string CPUName = CPU;
182 std::string FullFS = FS;
185 FullFS =
"+64bit,+sse2," + FullFS;
187 FullFS =
"+64bit,+sse2";
193 FullFS =
"+sahf," + FullFS;
209 InstrItins = getInstrItineraryForCPU(CPUName);
214 ToggleFeature(X86::Mode64Bit);
215 else if (In32BitMode)
216 ToggleFeature(X86::Mode32Bit);
217 else if (In16BitMode)
218 ToggleFeature(X86::Mode16Bit);
226 "64-bit code requested on a subtarget that doesn't support it!");
230 if (StackAlignOverride)
237 void X86Subtarget::initializeEnvironment() {
308 initializeEnvironment();
309 initSubtargetFeatures(CPU, FS);
315 unsigned StackAlignOverride)
317 PICStyle(PICStyles::
None), TM(TM), TargetTriple(TT),
318 StackAlignOverride(StackAlignOverride),
319 In64BitMode(TargetTriple.getArch() ==
Triple::x86_64),
320 In32BitMode(TargetTriple.getArch() ==
Triple::x86 &&
321 TargetTriple.getEnvironment() !=
Triple::CODE16),
322 In16BitMode(TargetTriple.getArch() ==
Triple::x86 &&
323 TargetTriple.getEnvironment() ==
Triple::CODE16),
324 TSInfo(), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
325 TLInfo(TM, *this), FrameLowering(*this, getStackAlignment()) {
340 assert(
GISel &&
"Access to GlobalISel APIs not set");
341 return GISel->getCallLowering();
345 assert(
GISel &&
"Access to GlobalISel APIs not set");
346 return GISel->getInstructionSelector();
350 assert(
GISel &&
"Access to GlobalISel APIs not set");
351 return GISel->getLegalizerInfo();
355 assert(
GISel &&
"Access to GlobalISel APIs not set");
356 return GISel->getRegBankInfo();
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
bool HasPRFCHW
Processor has PRFCHW instructions.
bool HasFXSR
Target has FXSAVE/FXRESTOR instructions.
bool HasTBM
Target has TBM instructions.
bool HasBMI2
Processor has BMI2 instructions.
const CallLowering * getCallLowering() const override
Methods used by Global ISel.
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
A Module instance is used to store all the information related to an LLVM module. ...
bool HasLAHFSAHF
Processor has LAHF/SAHF instructions.
bool HasCDI
Processor has AVX-512 Conflict Detection Instructions.
bool HasAES
Target has AES instructions.
void setPICStyle(PICStyles::Style Style)
bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isMacOSXVersionLT - Comparison function for checking OS X version compatibility, which handles suppor...
bool HasERI
Processor has AVX-512 Exponential and Reciprocal Instructions.
unsigned MaxInlineSizeThreshold
Max.
bool LEAUsesAG
True if the LEA instruction inputs have to be ready at address generation (AG) time.
const LegalizerInfo * getLegalizerInfo() const override
bool HasFastScalarFSQRT
True if hardware SQRTSS instruction is at least as fast (latency) as RSQRTSS followed by a Newton-Rap...
static cl::opt< bool > X86EarlyIfConv("x86-early-ifcvt", cl::Hidden, cl::desc("Enable early if-conversion on X86"))
bool IsUAMem32Slow
True if unaligned memory accesses of 32-bytes are slow.
MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...
bool IsPMULLDSlow
True if the PMULLD instruction is slow compared to PMULLW/PMULHW and.
bool HasRDRAND
True if the processor has the RDRAND instruction.
bool HasFMA
Target has 3-operand fused multiply-add.
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
bool HasFastVectorFSQRT
True if hardware SQRTPS/VSQRTPS instructions are at least as fast (throughput) as RSQRTPS/VRSQRTPS fo...
Holds all the information related to register banks.
MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...
bool isTargetSolaris() const
bool hasCommonLinkage() const
bool isTargetDarwin() const
bool HasPOPCNT
True if the processor supports POPCNT.
bool HasPKU
Processor has PKU extenstions.
const InstructionSelector * getInstructionSelector() const override
This file contains the simple types necessary to represent the attributes associated with functions a...
const Triple & getTargetTriple() const
bool HasSlowDivide32
True if 8-bit divisions are significantly faster than 32-bit divisions and should be used when possib...
bool HasFastPartialYMMWrite
True if there is no performance penalty to writing only the lower parts of a YMM register without cle...
bool HasPFI
Processor has AVX-512 PreFetch Instructions.
MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...
bool HasIFMA
Processor has Integer Fused Multiply Add.
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
bool HasCmpxchg16b
True if this processor has the CMPXCHG16B instruction; this is true for most x86-64 chips...
bool HasX87
True if the processor supports X87 instructions.
bool UseLeaForSP
True if the LEA instruction should be used for adjusting the stack pointer.
X863DNowEnum X863DNowLevel
MMX, 3DNow, 3DNow Athlon, or none supported.
MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...
bool HasSSE4A
True if the processor supports SSE4A instructions.
bool CallRegIndirect
True if the Calls with memory reference should be converted to a register-based indirect call...
bool HasLZCNT
Processor has LZCNT instruction.
bool HasF16C
Processor has 16-bit floating point conversion instructions.
bool SlowIncDec
True if INC and DEC instructions are slow when writing to flags.
X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS, const X86TargetMachine &TM, unsigned StackAlignOverride)
This constructor initializes the data members to match that of the specified triple.
CodeModel::Model getCodeModel() const
Returns the code model.
bool isTargetCOFF() const
bool HasMWAITX
Processor has MONITORX/MWAITX instructions.
bool hasSinCos() const
This function returns true if the target has sincos() routine in its compiler runtime or math librari...
bool IsBTMemSlow
True if BT (bit test) of memory instructions are slow.
bool HasADX
Processor has ADX instructions.
bool HasBWI
Processor has AVX-512 Byte and Word instructions.
bool isPositionIndependent() const
bool isTargetWin32() const
std::unique_ptr< GISelAccessor > GISel
Gather the accessor points to GlobalISel-related APIs.
bool HasXOP
Target has XOP instructions.
bool SlowLEA
True if the LEA instruction with certain arguments is slow.
bool HasDQI
Processor has AVX-512 Doubleword and Quadword instructions.
bool enableEarlyIfConversion() const override
unsigned char classifyLocalReference(const GlobalValue *GV) const
Classify a global variable reference for the current subtarget according to how we should reference i...
bool IsSHLDSlow
True if SHLD instructions are slow.
InstrItineraryData InstrItins
Instruction itineraries for scheduling.
bool HasFSGSBase
Processor has FS/GS base insturctions.
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
unsigned char classifyBlockAddressReference() const
Classify a blockaddress reference for the current subtarget according to how we should reference it i...
bool IsUAMem16Slow
True if unaligned memory accesses of 16-bytes are slow.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
bool HasMPX
Processor supports MPX - Memory Protection Extensions.
bool HasX86_64
True if the processor supports X86-64 instructions.
bool HasSSEUnalignedMem
True if SSE operations can have unaligned memory operands.
unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, const Module &M) const
Classify a global function reference for the current subtarget.
bool HasXSAVES
Target has XSAVES instructions.
bool HasSHA
Processor has SHA instructions.
bool HasBMI
Processor has BMI1 instructions.
bool isTargetLinux() const
bool HasHLE
Processor has HLE.
bool HasVBMI
Processor has VBMI instructions.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool UseSoftFloat
Use software floating point for code generation.
bool HasPCLMUL
Target has carry-less multiplication.
Provides the logic to select generic machine instructions.
MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...
bool HasXSAVEOPT
Target has XSAVEOPT instructions.
X86SSEEnum X86SSELevel
SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or none supported.
unsigned char classifyGlobalReference(const GlobalValue *GV, const Module &M) const
bool HasXSAVE
Target has XSAVE instructions.
MO_PLT - On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol n...
bool HasCMov
True if this processor has conditional move instructions (generally pentium pro+).
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
bool HasFMA4
Target has 4-operand fused multiply-add.
bool HasRTM
Processor has RTM instructions.
const RegisterBankInfo * getRegBankInfo() const override
bool HasXSAVEC
Target has XSAVEC instructions.
bool HasVLX
Processor has AVX-512 Vector Length eXtenstions.
bool HasFastLZCNT
True if LZCNT instruction is fast.
const char * getBZeroEntry() const
This function returns the name of a function which has an interface like the non-standard bzero funct...
MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...
StringRef - Represent a constant reference to a string, i.e.
bool HasRDSEED
Processor has RDSEED instructions.
unsigned stackAlignment
The minimum alignment known to hold of the stack frame on entry to the function and which must be mai...
bool isTargetKFreeBSD() const
bool isLegalToCallImmediateAddr() const
Return true if the subtarget allows calls to immediate address.
bool isDeclarationForLinker() const
bool HasMOVBE
True if the processor has the MOVBE instruction.
bool PadShortFunctions
True if the short functions should be padded to prevent a stall when returning too early...
bool isAbsoluteSymbolRef() const
Returns whether this is a reference to an absolute symbol.
MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...
bool HasSlowDivide64
True if 32-bit divides are significantly faster than 64-bit divisions and should be used when possibl...