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
64 X86SSEEnum X86SSELevel = NoSSE;
66#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
67 bool ATTRIBUTE = DEFAULT;
68#include "X86GenSubtargetInfo.inc"
78 unsigned MaxInlineSizeThreshold = 128;
84 std::unique_ptr<CallLowering> CallLoweringInfo;
86 std::unique_ptr<RegisterBankInfo> RegBankInfo;
87 std::unique_ptr<InstructionSelector> InstSelector;
93 unsigned PreferVectorWidthOverride;
97 unsigned PreferVectorWidth = UINT32_MAX;
100 unsigned RequiredVectorWidth;
115 unsigned PreferVectorWidthOverride,
116 unsigned RequiredVectorWidth);
125 return &FrameLowering;
168#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
169 bool GETTER() const { return ATTRIBUTE; }
170#include "X86GenSubtargetInfo.inc"
174 return Is64Bit && (TargetTriple.
isX32() || TargetTriple.
isOSNaCl());
179 return Is64Bit && (!TargetTriple.
isX32() && !TargetTriple.
isOSNaCl());
193 bool hasSSE1()
const {
return X86SSELevel >= SSE1; }
194 bool hasSSE2()
const {
return X86SSELevel >= SSE2; }
195 bool hasSSE3()
const {
return X86SSELevel >= SSE3; }
196 bool hasSSSE3()
const {
return X86SSELevel >= SSSE3; }
197 bool hasSSE41()
const {
return X86SSELevel >= SSE41; }
198 bool hasSSE42()
const {
return X86SSELevel >= SSE42; }
199 bool hasAVX()
const {
return X86SSELevel >= AVX; }
200 bool hasAVX2()
const {
return X86SSELevel >= AVX2; }
201 bool hasAVX512()
const {
return X86SSELevel >= AVX512; }
203 bool hasAnyFMA()
const {
return hasFMA() || hasFMA4(); }
212 return hasSSE1() || hasPRFCHW() || hasPREFETCHI();
219 return useRetpolineIndirectCalls() || useLVIControlFlowIntegrity();
222 return useRetpolineIndirectBranches() || useLVIControlFlowIntegrity();
393 unsigned Major = TT.getOSVersion().getMajor();
420 &Mutations)
const override;
423 return TargetSubtargetInfo::ANTIDEP_CRITICAL;
Interface for Targets to specify which operations they can successfully select and how the others sho...
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, XROS, 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 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 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.