13#ifndef LLVM_LIB_TARGET_X86_X86SUBTARGET_H
14#define LLVM_LIB_TARGET_X86_X86SUBTARGET_H
29#define OPTIONS_STRUCT_DECL
30#include "X86Options.inc"
32#define GET_SUBTARGETINFO_HEADER
33#include "X86GenSubtargetInfo.inc"
39class InstructionSelector;
41class RegisterBankInfo;
59 const X86Options &CLOpts;
62 NoSSE, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, AVX, AVX2, AVX512
71 X86SSEEnum X86SSELevel = NoSSE;
73#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
74 bool ATTRIBUTE = DEFAULT;
75#include "X86GenSubtargetInfo.inc"
77 std::bitset<X86::NUM_TARGET_REGS> ReservedRReg;
81 Align stackAlignment = Align(4);
83 Align TileConfigAlignment = Align(4);
88 unsigned MaxInlineSizeThreshold = 128;
94 std::unique_ptr<CallLowering> CallLoweringInfo;
96 std::unique_ptr<RegisterBankInfo> RegBankInfo;
97 std::unique_ptr<InstructionSelector> InstSelector;
100 MaybeAlign StackAlignOverride;
103 unsigned PreferVectorWidthOverride;
107 unsigned PreferVectorWidth = UINT32_MAX;
110 unsigned RequiredVectorWidth;
112 bool HasUserReservedRegisters;
114 X86SelectionDAGInfo TSInfo;
117 X86InstrInfo InstrInfo;
118 X86TargetLowering TLInfo;
119 X86FrameLowering FrameLowering;
125 X86Subtarget(
const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS,
126 const X86TargetMachine &TM, MaybeAlign StackAlignOverride,
127 unsigned PreferVectorWidthOverride,
128 unsigned RequiredVectorWidth);
140 return &FrameLowering;
174 return ReservedRReg[i.
id()];
188#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
189 bool GETTER() const { return ATTRIBUTE; }
190#include "X86GenSubtargetInfo.inc"
209 bool hasSSE1()
const {
return X86SSELevel >= SSE1; }
210 bool hasSSE2()
const {
return X86SSELevel >= SSE2; }
211 bool hasSSE3()
const {
return X86SSELevel >= SSE3; }
212 bool hasSSSE3()
const {
return X86SSELevel >= SSSE3; }
213 bool hasSSE41()
const {
return X86SSELevel >= SSE41; }
214 bool hasSSE42()
const {
return X86SSELevel >= SSE42; }
215 bool hasAVX()
const {
return X86SSELevel >= AVX; }
216 bool hasAVX2()
const {
return X86SSELevel >= AVX2; }
217 bool hasAVX512()
const {
return X86SSELevel >= AVX512; }
219 bool hasAnyFMA()
const {
return hasFMA() || hasFMA4(); }
228 return hasSSE1() || hasPRFCHW() || hasPREFETCHI();
235 return useRetpolineIndirectCalls() || useLVIControlFlowIntegrity();
238 return useRetpolineIndirectBranches() || useLVIControlFlowIntegrity();
308 bool isTargetELF()
const {
return TargetTriple.isOSBinFormatELF(); }
321 bool isLFI()
const {
return TargetTriple.isLFI(); }
324 return TargetTriple.isWindowsMSVCEnvironment();
328 return TargetTriple.isWindowsCoreCLREnvironment();
332 return TargetTriple.isWindowsCygwinEnvironment();
336 return TargetTriple.isWindowsGNUEnvironment();
340 return TargetTriple.isWindowsItaniumEnvironment();
345 bool isUEFI()
const {
return TargetTriple.isUEFI(); }
423 unsigned Major = TT.getOSVersion().getMajor();
450 &Mutations)
const override;
453 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.
Wrapper class representing virtual and physical registers.
constexpr unsigned id() const
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 hasUserReservedRegisters() 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
bool isRegisterReservedByUser(Register i) const override
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
bool isOSWindowsOrUEFI() const
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 isTargetMusl() const
bool isTargetAndroid() const
const X86Options & getCLOpts() 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 isTargetHurd() const
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.