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"
33class InstructionSelector;
35class RegisterBankInfo;
54 NoSSE, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, AVX, AVX2, AVX512
63 X86SSEEnum X86SSELevel = NoSSE;
65#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
66 bool ATTRIBUTE = DEFAULT;
67#include "X86GenSubtargetInfo.inc"
70 Align stackAlignment = Align(4);
72 Align TileConfigAlignment = Align(4);
77 unsigned MaxInlineSizeThreshold = 128;
83 std::unique_ptr<CallLowering> CallLoweringInfo;
85 std::unique_ptr<RegisterBankInfo> RegBankInfo;
86 std::unique_ptr<InstructionSelector> InstSelector;
89 MaybeAlign StackAlignOverride;
92 unsigned PreferVectorWidthOverride;
96 unsigned PreferVectorWidth = UINT32_MAX;
99 unsigned RequiredVectorWidth;
101 X86SelectionDAGInfo TSInfo;
104 X86InstrInfo InstrInfo;
105 X86TargetLowering TLInfo;
106 X86FrameLowering FrameLowering;
112 X86Subtarget(
const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS,
113 const X86TargetMachine &TM, MaybeAlign StackAlignOverride,
114 unsigned PreferVectorWidthOverride,
115 unsigned RequiredVectorWidth);
125 return &FrameLowering;
168#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
169 bool GETTER() const { return ATTRIBUTE; }
170#include "X86GenSubtargetInfo.inc"
189 bool hasSSE1()
const {
return X86SSELevel >= SSE1; }
190 bool hasSSE2()
const {
return X86SSELevel >= SSE2; }
191 bool hasSSE3()
const {
return X86SSELevel >= SSE3; }
192 bool hasSSSE3()
const {
return X86SSELevel >= SSSE3; }
193 bool hasSSE41()
const {
return X86SSELevel >= SSE41; }
194 bool hasSSE42()
const {
return X86SSELevel >= SSE42; }
195 bool hasAVX()
const {
return X86SSELevel >= AVX; }
196 bool hasAVX2()
const {
return X86SSELevel >= AVX2; }
197 bool hasAVX512()
const {
return X86SSELevel >= AVX512; }
199 bool hasAnyFMA()
const {
return hasFMA() || hasFMA4(); }
208 return hasSSE1() || hasPRFCHW() || hasPREFETCHI();
215 return useRetpolineIndirectCalls() || useLVIControlFlowIntegrity();
218 return useRetpolineIndirectBranches() || useLVIControlFlowIntegrity();
288 bool isTargetELF()
const {
return TargetTriple.isOSBinFormatELF(); }
300 return TargetTriple.isWindowsMSVCEnvironment();
304 return TargetTriple.isWindowsCoreCLREnvironment();
308 return TargetTriple.isWindowsCygwinEnvironment();
312 return TargetTriple.isWindowsGNUEnvironment();
316 return TargetTriple.isWindowsItaniumEnvironment();
321 bool isUEFI()
const {
return TargetTriple.isUEFI(); }
397 unsigned Major = TT.getOSVersion().getMajor();
424 &Mutations)
const override;
427 return TargetSubtargetInfo::ANTIDEP_CRITICAL;
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.
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 avoidMFence() const
Avoid use of mfence forfence seq_cst, and instead use lock or.
bool useLight256BitInstructions() const
bool isTargetSolaris() const
bool hasBitScanPassThrough() 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 framepresent" 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 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
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
bool isTargetUEFI64() const
const X86RegisterInfo * getRegisterInfo() const override
void setPICStyle(PICStyles::Style Style)
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 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 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
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ 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.
The X86 backend supports a number of different styles of PIC.
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.