Go to the documentation of this file.
13 #ifndef LLVM_LIB_TARGET_X86_X86SUBTARGET_H
14 #define LLVM_LIB_TARGET_X86_X86SUBTARGET_H
26 #define GET_SUBTARGETINFO_HEADER
27 #include "X86GenSubtargetInfo.inc"
33 class InstructionSelector;
35 class RegisterBankInfo;
54 NoSSE, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, AVX, AVX2, AVX512
58 NoThreeDNow, MMX, ThreeDNow, ThreeDNowA
67 X86SSEEnum X86SSELevel = NoSSE;
70 X863DNowEnum X863DNowLevel = NoThreeDNow;
72 #define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
73 bool ATTRIBUTE = DEFAULT;
74 #include "X86GenSubtargetInfo.inc"
84 unsigned MaxInlineSizeThreshold = 128;
90 std::unique_ptr<CallLowering> CallLoweringInfo;
92 std::unique_ptr<RegisterBankInfo> RegBankInfo;
93 std::unique_ptr<InstructionSelector> InstSelector;
99 unsigned PreferVectorWidthOverride;
103 unsigned PreferVectorWidth = UINT32_MAX;
106 unsigned RequiredVectorWidth;
121 unsigned PreferVectorWidthOverride,
122 unsigned RequiredVectorWidth);
131 return &FrameLowering;
174 #define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
175 bool GETTER() const { return ATTRIBUTE; }
176 #include "X86GenSubtargetInfo.inc"
180 return Is64Bit && (TargetTriple.
isX32() || TargetTriple.
isOSNaCl());
185 return Is64Bit && (!TargetTriple.
isX32() && !TargetTriple.
isOSNaCl());
199 bool hasSSE1()
const {
return X86SSELevel >= SSE1; }
200 bool hasSSE2()
const {
return X86SSELevel >= SSE2; }
201 bool hasSSE3()
const {
return X86SSELevel >= SSE3; }
202 bool hasSSSE3()
const {
return X86SSELevel >= SSSE3; }
203 bool hasSSE41()
const {
return X86SSELevel >= SSE41; }
204 bool hasSSE42()
const {
return X86SSELevel >= SSE42; }
205 bool hasAVX()
const {
return X86SSELevel >= AVX; }
206 bool hasAVX2()
const {
return X86SSELevel >= AVX2; }
207 bool hasAVX512()
const {
return X86SSELevel >= AVX512; }
209 bool hasMMX()
const {
return X863DNowLevel >= MMX; }
212 bool hasAnyFMA()
const {
return hasFMA() || hasFMA4(); }
218 return hasThreeDNow() || hasPRFCHW() || hasPREFETCHWT1();
231 return useRetpolineIndirectCalls() || useLVIControlFlowIntegrity();
234 return useRetpolineIndirectBranches() || useLVIControlFlowIntegrity();
382 unsigned Major = TT.getOSVersion().getMajor();
409 &Mutations)
const override;
412 return TargetSubtargetInfo::ANTIDEP_CRITICAL;
418 #endif // LLVM_LIB_TARGET_X86_X86SUBTARGET_H
unsigned getRequiredVectorWidth() const
bool hasSSEPrefetch() const
const X86FrameLowering * getFrameLowering() const override
This is an optimization pass for GlobalISel generic memory operations.
unsigned getTileConfigSize() const
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
bool isTargetLinux() const
const X86InstrInfo * getInstrInfo() const override
static bool is64Bit(const char *name)
bool isPS() const
Tests whether the target is the PS4 or PS5 platform.
bool isTarget64BitILP32() const
Is this x86_64 with the ILP32 programming model (x32 ABI)?
Triple - Helper class for working with autoconf configuration names.
bool isLegalToCallImmediateAddr() const
Return true if the subtarget allows calls to immediate address.
bool isTargetNaCl() const
bool isXRaySupported() const override
bool isWindowsItaniumEnvironment() const
unsigned getPreferVectorWidth() const
bool isPICStyleRIPRel() const
bool isOSLinux() const
Tests whether the OS is Linux.
bool isTargetWin64() const
X86Subtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, const X86TargetMachine &TM, MaybeAlign StackAlignOverride, unsigned PreferVectorWidthOverride, unsigned RequiredVectorWidth)
This constructor initializes the data members to match that of the specified triple.
bool canUseLAHFSAHF() const
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
bool isTargetSolaris() const
Align getStackAlignment() const
Returns the minimum alignment known to hold of the stack frame on entry to the function and which mus...
@ Intel_OCL_BI
Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins.
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
bool isPICStyleStubPIC() const
bool isAndroid() const
Tests whether the target is Android.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
bool isTargetKFreeBSD() const
@ Tail
Tail - This calling convention attemps to make calls as fast as possible while guaranteeing that tail...
bool isTargetGlibc() const
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit).
bool canExtendTo512DQ() const
bool isTargetWin32() const
const X86RegisterInfo * getRegisterInfo() const override
bool isTargetWindowsCoreCLR() const
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
void getPostRAMutations(std::vector< std::unique_ptr< ScheduleDAGMutation >> &Mutations) const override
Align getTileConfigAlignment() const
unsigned char classifyGlobalReference(const GlobalValue *GV, const Module &M) const
bool isTargetMachO() const
const LegalizerInfo * getLegalizerInfo() const override
This struct is a compact representation of a valid (non-zero power of two) alignment.
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool isTarget64BitLP64() const
Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
unsigned char classifyLocalReference(const GlobalValue *GV) const
Classify a global variable reference for the current subtarget according to how we should reference i...
bool enableMachineScheduler() const override
Enable the MachineScheduler pass for all X86 subtargets.
const RegisterBankInfo * getRegBankInfo() const override
bool isTargetCygMing() const
bool hasPrefetchW() const
const X86SelectionDAGInfo * getSelectionDAGInfo() const override
bool enableEarlyIfConversion() const override
bool isOSDragonFly() const
Holds all the information related to register banks.
Provides the logic to select generic machine instructions.
InstructionSelector * getInstructionSelector() const override
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
bool hasThreeDNow() const
bool isTargetCOFF() const
bool isOSGlibc() const
Tests whether the OS uses glibc.
bool isWindowsCoreCLREnvironment() const
Primary interface to the complete machine description for the target machine.
const X86TargetLowering * getTargetLowering() const override
bool useIndirectThunkBranches() const
bool hasThreeDNowA() const
bool isTargetDragonFly() const
A Module instance is used to store all the information related to an LLVM module.
unsigned char classifyBlockAddressReference() const
Classify a blockaddress reference for the current subtarget according to how we should reference it i...
@ C
C - The default llvm calling convention, compatible with C.
@ Fast
Fast - This calling convention attempts to make calls as fast as possible (e.g.
bool isTargetDarwin() const
bool isTargetFuchsia() const
bool canUseCMPXCHG16B() const
StringRef - Represent a constant reference to a string, i.e.
@ X86_64_SysV
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
void setPICStyle(PICStyles::Style Style)
const X86RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
@ X86_ThisCall
X86_ThisCall - Similar to X86_StdCall.
bool isTargetWindowsGNU() const
bool isOSWindows() const
Tests whether the OS is Windows.
bool isTargetFreeBSD() const
@ Win64
The C convention as implemented on Windows/x86-64 and AArch64.
bool hasMFence() const
Use mfence if we have SSE2 or we're on x86-64 (even if we asked for no-sse2).
bool isTargetWindowsMSVC() const
@ X86_StdCall
X86_StdCall - stdcall is the calling conventions mostly used by the Win32 API.
bool isCallingConvWin64(CallingConv::ID CC) const
bool canUseCMPXCHG8B() const
bool isWindowsGNUEnvironment() const
bool isTargetAndroid() const
unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, const Module &M) const
Classify a global function reference for the current subtarget.
bool canExtendTo512BW() const
bool isTargetWindowsItanium() const
const Triple & getTargetTriple() const
AntiDepBreakMode getAntiDepBreakMode() const override
bool isTargetNaCl32() const
bool isX32() const
Tests whether the target is X32.
@ X86_FastCall
X86_FastCall - 'fast' analog of X86_StdCall.
PICStyles::Style getPICStyle() const
const char LLVMTargetMachineRef TM
bool useAVX512Regs() const
const CallLowering * getCallLowering() const override
Methods used by Global ISel.
bool enableIndirectBrExpand() const override
If we are using indirect thunks, we need to expand indirectbr to avoid it lowering to an actual indir...
bool isTargetWindowsCygwin() const
unsigned getMaxInlineSizeThreshold() const
Returns the maximum memset / memcpy size that still makes it profitable to inline the call.
@ X86_VectorCall
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
bool isPositionIndependent() const
bool isPICStyleGOT() const
bool useIndirectThunkCalls() const
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
bool swiftAsyncContextIsDynamicallySet() const
Return whether FrameLowering should always set the "extended frame present" bit in FP,...
bool isTargetNaCl64() const
@ SwiftTail
SwiftTail - This follows the Swift calling convention in how arguments are passed but guarantees tail...
bool isWindowsCygwinEnvironment() const