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