xref: /aosp_15_r20/external/llvm/lib/Target/X86/X86Subtarget.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- X86Subtarget.h - Define Subtarget for the X86 ----------*- C++ -*--===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file declares the X86 specific subclass of TargetSubtargetInfo.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_X86_X86SUBTARGET_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_X86_X86SUBTARGET_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "X86FrameLowering.h"
18*9880d681SAndroid Build Coastguard Worker #include "X86ISelLowering.h"
19*9880d681SAndroid Build Coastguard Worker #include "X86InstrInfo.h"
20*9880d681SAndroid Build Coastguard Worker #include "X86SelectionDAGInfo.h"
21*9880d681SAndroid Build Coastguard Worker #include "llvm/ADT/Triple.h"
22*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/CallingConv.h"
23*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetSubtargetInfo.h"
24*9880d681SAndroid Build Coastguard Worker #include <string>
25*9880d681SAndroid Build Coastguard Worker 
26*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_HEADER
27*9880d681SAndroid Build Coastguard Worker #include "X86GenSubtargetInfo.inc"
28*9880d681SAndroid Build Coastguard Worker 
29*9880d681SAndroid Build Coastguard Worker namespace llvm {
30*9880d681SAndroid Build Coastguard Worker class GlobalValue;
31*9880d681SAndroid Build Coastguard Worker class StringRef;
32*9880d681SAndroid Build Coastguard Worker class TargetMachine;
33*9880d681SAndroid Build Coastguard Worker 
34*9880d681SAndroid Build Coastguard Worker /// The X86 backend supports a number of different styles of PIC.
35*9880d681SAndroid Build Coastguard Worker ///
36*9880d681SAndroid Build Coastguard Worker namespace PICStyles {
37*9880d681SAndroid Build Coastguard Worker enum Style {
38*9880d681SAndroid Build Coastguard Worker   StubPIC,          // Used on i386-darwin in pic mode.
39*9880d681SAndroid Build Coastguard Worker   GOT,              // Used on 32 bit elf on when in pic mode.
40*9880d681SAndroid Build Coastguard Worker   RIPRel,           // Used on X86-64 when in pic mode.
41*9880d681SAndroid Build Coastguard Worker   None              // Set when not in pic mode.
42*9880d681SAndroid Build Coastguard Worker };
43*9880d681SAndroid Build Coastguard Worker }
44*9880d681SAndroid Build Coastguard Worker 
45*9880d681SAndroid Build Coastguard Worker class X86Subtarget final : public X86GenSubtargetInfo {
46*9880d681SAndroid Build Coastguard Worker 
47*9880d681SAndroid Build Coastguard Worker protected:
48*9880d681SAndroid Build Coastguard Worker   enum X86SSEEnum {
49*9880d681SAndroid Build Coastguard Worker     NoSSE, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, AVX, AVX2, AVX512F
50*9880d681SAndroid Build Coastguard Worker   };
51*9880d681SAndroid Build Coastguard Worker 
52*9880d681SAndroid Build Coastguard Worker   enum X863DNowEnum {
53*9880d681SAndroid Build Coastguard Worker     NoThreeDNow, MMX, ThreeDNow, ThreeDNowA
54*9880d681SAndroid Build Coastguard Worker   };
55*9880d681SAndroid Build Coastguard Worker 
56*9880d681SAndroid Build Coastguard Worker   enum X86ProcFamilyEnum {
57*9880d681SAndroid Build Coastguard Worker     Others, IntelAtom, IntelSLM
58*9880d681SAndroid Build Coastguard Worker   };
59*9880d681SAndroid Build Coastguard Worker 
60*9880d681SAndroid Build Coastguard Worker   /// X86 processor family: Intel Atom, and others
61*9880d681SAndroid Build Coastguard Worker   X86ProcFamilyEnum X86ProcFamily;
62*9880d681SAndroid Build Coastguard Worker 
63*9880d681SAndroid Build Coastguard Worker   /// Which PIC style to use
64*9880d681SAndroid Build Coastguard Worker   PICStyles::Style PICStyle;
65*9880d681SAndroid Build Coastguard Worker 
66*9880d681SAndroid Build Coastguard Worker   const TargetMachine &TM;
67*9880d681SAndroid Build Coastguard Worker 
68*9880d681SAndroid Build Coastguard Worker   /// SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or none supported.
69*9880d681SAndroid Build Coastguard Worker   X86SSEEnum X86SSELevel;
70*9880d681SAndroid Build Coastguard Worker 
71*9880d681SAndroid Build Coastguard Worker   /// MMX, 3DNow, 3DNow Athlon, or none supported.
72*9880d681SAndroid Build Coastguard Worker   X863DNowEnum X863DNowLevel;
73*9880d681SAndroid Build Coastguard Worker 
74*9880d681SAndroid Build Coastguard Worker   /// True if the processor supports X87 instructions.
75*9880d681SAndroid Build Coastguard Worker   bool HasX87;
76*9880d681SAndroid Build Coastguard Worker 
77*9880d681SAndroid Build Coastguard Worker   /// True if this processor has conditional move instructions
78*9880d681SAndroid Build Coastguard Worker   /// (generally pentium pro+).
79*9880d681SAndroid Build Coastguard Worker   bool HasCMov;
80*9880d681SAndroid Build Coastguard Worker 
81*9880d681SAndroid Build Coastguard Worker   /// True if the processor supports X86-64 instructions.
82*9880d681SAndroid Build Coastguard Worker   bool HasX86_64;
83*9880d681SAndroid Build Coastguard Worker 
84*9880d681SAndroid Build Coastguard Worker   /// True if the processor supports POPCNT.
85*9880d681SAndroid Build Coastguard Worker   bool HasPOPCNT;
86*9880d681SAndroid Build Coastguard Worker 
87*9880d681SAndroid Build Coastguard Worker   /// True if the processor supports SSE4A instructions.
88*9880d681SAndroid Build Coastguard Worker   bool HasSSE4A;
89*9880d681SAndroid Build Coastguard Worker 
90*9880d681SAndroid Build Coastguard Worker   /// Target has AES instructions
91*9880d681SAndroid Build Coastguard Worker   bool HasAES;
92*9880d681SAndroid Build Coastguard Worker 
93*9880d681SAndroid Build Coastguard Worker   /// Target has FXSAVE/FXRESTOR instructions
94*9880d681SAndroid Build Coastguard Worker   bool HasFXSR;
95*9880d681SAndroid Build Coastguard Worker 
96*9880d681SAndroid Build Coastguard Worker   /// Target has XSAVE instructions
97*9880d681SAndroid Build Coastguard Worker   bool HasXSAVE;
98*9880d681SAndroid Build Coastguard Worker   /// Target has XSAVEOPT instructions
99*9880d681SAndroid Build Coastguard Worker   bool HasXSAVEOPT;
100*9880d681SAndroid Build Coastguard Worker   /// Target has XSAVEC instructions
101*9880d681SAndroid Build Coastguard Worker   bool HasXSAVEC;
102*9880d681SAndroid Build Coastguard Worker   /// Target has XSAVES instructions
103*9880d681SAndroid Build Coastguard Worker   bool HasXSAVES;
104*9880d681SAndroid Build Coastguard Worker 
105*9880d681SAndroid Build Coastguard Worker   /// Target has carry-less multiplication
106*9880d681SAndroid Build Coastguard Worker   bool HasPCLMUL;
107*9880d681SAndroid Build Coastguard Worker 
108*9880d681SAndroid Build Coastguard Worker   /// Target has 3-operand fused multiply-add
109*9880d681SAndroid Build Coastguard Worker   bool HasFMA;
110*9880d681SAndroid Build Coastguard Worker 
111*9880d681SAndroid Build Coastguard Worker   /// Target has 4-operand fused multiply-add
112*9880d681SAndroid Build Coastguard Worker   bool HasFMA4;
113*9880d681SAndroid Build Coastguard Worker 
114*9880d681SAndroid Build Coastguard Worker   /// Target has XOP instructions
115*9880d681SAndroid Build Coastguard Worker   bool HasXOP;
116*9880d681SAndroid Build Coastguard Worker 
117*9880d681SAndroid Build Coastguard Worker   /// Target has TBM instructions.
118*9880d681SAndroid Build Coastguard Worker   bool HasTBM;
119*9880d681SAndroid Build Coastguard Worker 
120*9880d681SAndroid Build Coastguard Worker   /// True if the processor has the MOVBE instruction.
121*9880d681SAndroid Build Coastguard Worker   bool HasMOVBE;
122*9880d681SAndroid Build Coastguard Worker 
123*9880d681SAndroid Build Coastguard Worker   /// True if the processor has the RDRAND instruction.
124*9880d681SAndroid Build Coastguard Worker   bool HasRDRAND;
125*9880d681SAndroid Build Coastguard Worker 
126*9880d681SAndroid Build Coastguard Worker   /// Processor has 16-bit floating point conversion instructions.
127*9880d681SAndroid Build Coastguard Worker   bool HasF16C;
128*9880d681SAndroid Build Coastguard Worker 
129*9880d681SAndroid Build Coastguard Worker   /// Processor has FS/GS base insturctions.
130*9880d681SAndroid Build Coastguard Worker   bool HasFSGSBase;
131*9880d681SAndroid Build Coastguard Worker 
132*9880d681SAndroid Build Coastguard Worker   /// Processor has LZCNT instruction.
133*9880d681SAndroid Build Coastguard Worker   bool HasLZCNT;
134*9880d681SAndroid Build Coastguard Worker 
135*9880d681SAndroid Build Coastguard Worker   /// Processor has BMI1 instructions.
136*9880d681SAndroid Build Coastguard Worker   bool HasBMI;
137*9880d681SAndroid Build Coastguard Worker 
138*9880d681SAndroid Build Coastguard Worker   /// Processor has BMI2 instructions.
139*9880d681SAndroid Build Coastguard Worker   bool HasBMI2;
140*9880d681SAndroid Build Coastguard Worker 
141*9880d681SAndroid Build Coastguard Worker   /// Processor has VBMI instructions.
142*9880d681SAndroid Build Coastguard Worker   bool HasVBMI;
143*9880d681SAndroid Build Coastguard Worker 
144*9880d681SAndroid Build Coastguard Worker   /// Processor has Integer Fused Multiply Add
145*9880d681SAndroid Build Coastguard Worker   bool HasIFMA;
146*9880d681SAndroid Build Coastguard Worker 
147*9880d681SAndroid Build Coastguard Worker   /// Processor has RTM instructions.
148*9880d681SAndroid Build Coastguard Worker   bool HasRTM;
149*9880d681SAndroid Build Coastguard Worker 
150*9880d681SAndroid Build Coastguard Worker   /// Processor has HLE.
151*9880d681SAndroid Build Coastguard Worker   bool HasHLE;
152*9880d681SAndroid Build Coastguard Worker 
153*9880d681SAndroid Build Coastguard Worker   /// Processor has ADX instructions.
154*9880d681SAndroid Build Coastguard Worker   bool HasADX;
155*9880d681SAndroid Build Coastguard Worker 
156*9880d681SAndroid Build Coastguard Worker   /// Processor has SHA instructions.
157*9880d681SAndroid Build Coastguard Worker   bool HasSHA;
158*9880d681SAndroid Build Coastguard Worker 
159*9880d681SAndroid Build Coastguard Worker   /// Processor has PRFCHW instructions.
160*9880d681SAndroid Build Coastguard Worker   bool HasPRFCHW;
161*9880d681SAndroid Build Coastguard Worker 
162*9880d681SAndroid Build Coastguard Worker   /// Processor has RDSEED instructions.
163*9880d681SAndroid Build Coastguard Worker   bool HasRDSEED;
164*9880d681SAndroid Build Coastguard Worker 
165*9880d681SAndroid Build Coastguard Worker   /// Processor has LAHF/SAHF instructions.
166*9880d681SAndroid Build Coastguard Worker   bool HasLAHFSAHF;
167*9880d681SAndroid Build Coastguard Worker 
168*9880d681SAndroid Build Coastguard Worker   /// Processor has MONITORX/MWAITX instructions.
169*9880d681SAndroid Build Coastguard Worker   bool HasMWAITX;
170*9880d681SAndroid Build Coastguard Worker 
171*9880d681SAndroid Build Coastguard Worker   /// Processor has Prefetch with intent to Write instruction
172*9880d681SAndroid Build Coastguard Worker   bool HasPFPREFETCHWT1;
173*9880d681SAndroid Build Coastguard Worker 
174*9880d681SAndroid Build Coastguard Worker   /// True if BT (bit test) of memory instructions are slow.
175*9880d681SAndroid Build Coastguard Worker   bool IsBTMemSlow;
176*9880d681SAndroid Build Coastguard Worker 
177*9880d681SAndroid Build Coastguard Worker   /// True if SHLD instructions are slow.
178*9880d681SAndroid Build Coastguard Worker   bool IsSHLDSlow;
179*9880d681SAndroid Build Coastguard Worker 
180*9880d681SAndroid Build Coastguard Worker   /// True if unaligned memory accesses of 16-bytes are slow.
181*9880d681SAndroid Build Coastguard Worker   bool IsUAMem16Slow;
182*9880d681SAndroid Build Coastguard Worker 
183*9880d681SAndroid Build Coastguard Worker   /// True if unaligned memory accesses of 32-bytes are slow.
184*9880d681SAndroid Build Coastguard Worker   bool IsUAMem32Slow;
185*9880d681SAndroid Build Coastguard Worker 
186*9880d681SAndroid Build Coastguard Worker   /// True if SSE operations can have unaligned memory operands.
187*9880d681SAndroid Build Coastguard Worker   /// This may require setting a configuration bit in the processor.
188*9880d681SAndroid Build Coastguard Worker   bool HasSSEUnalignedMem;
189*9880d681SAndroid Build Coastguard Worker 
190*9880d681SAndroid Build Coastguard Worker   /// True if this processor has the CMPXCHG16B instruction;
191*9880d681SAndroid Build Coastguard Worker   /// this is true for most x86-64 chips, but not the first AMD chips.
192*9880d681SAndroid Build Coastguard Worker   bool HasCmpxchg16b;
193*9880d681SAndroid Build Coastguard Worker 
194*9880d681SAndroid Build Coastguard Worker   /// True if the LEA instruction should be used for adjusting
195*9880d681SAndroid Build Coastguard Worker   /// the stack pointer. This is an optimization for Intel Atom processors.
196*9880d681SAndroid Build Coastguard Worker   bool UseLeaForSP;
197*9880d681SAndroid Build Coastguard Worker 
198*9880d681SAndroid Build Coastguard Worker   /// True if there is no performance penalty to writing only the lower parts
199*9880d681SAndroid Build Coastguard Worker   /// of a YMM register without clearing the upper part.
200*9880d681SAndroid Build Coastguard Worker   bool HasFastPartialYMMWrite;
201*9880d681SAndroid Build Coastguard Worker 
202*9880d681SAndroid Build Coastguard Worker   /// True if 8-bit divisions are significantly faster than
203*9880d681SAndroid Build Coastguard Worker   /// 32-bit divisions and should be used when possible.
204*9880d681SAndroid Build Coastguard Worker   bool HasSlowDivide32;
205*9880d681SAndroid Build Coastguard Worker 
206*9880d681SAndroid Build Coastguard Worker   /// True if 16-bit divides are significantly faster than
207*9880d681SAndroid Build Coastguard Worker   /// 64-bit divisions and should be used when possible.
208*9880d681SAndroid Build Coastguard Worker   bool HasSlowDivide64;
209*9880d681SAndroid Build Coastguard Worker 
210*9880d681SAndroid Build Coastguard Worker   /// True if the short functions should be padded to prevent
211*9880d681SAndroid Build Coastguard Worker   /// a stall when returning too early.
212*9880d681SAndroid Build Coastguard Worker   bool PadShortFunctions;
213*9880d681SAndroid Build Coastguard Worker 
214*9880d681SAndroid Build Coastguard Worker   /// True if the Calls with memory reference should be converted
215*9880d681SAndroid Build Coastguard Worker   /// to a register-based indirect call.
216*9880d681SAndroid Build Coastguard Worker   bool CallRegIndirect;
217*9880d681SAndroid Build Coastguard Worker 
218*9880d681SAndroid Build Coastguard Worker   /// True if the LEA instruction inputs have to be ready at address generation
219*9880d681SAndroid Build Coastguard Worker   /// (AG) time.
220*9880d681SAndroid Build Coastguard Worker   bool LEAUsesAG;
221*9880d681SAndroid Build Coastguard Worker 
222*9880d681SAndroid Build Coastguard Worker   /// True if the LEA instruction with certain arguments is slow
223*9880d681SAndroid Build Coastguard Worker   bool SlowLEA;
224*9880d681SAndroid Build Coastguard Worker 
225*9880d681SAndroid Build Coastguard Worker   /// True if INC and DEC instructions are slow when writing to flags
226*9880d681SAndroid Build Coastguard Worker   bool SlowIncDec;
227*9880d681SAndroid Build Coastguard Worker 
228*9880d681SAndroid Build Coastguard Worker   /// Processor has AVX-512 PreFetch Instructions
229*9880d681SAndroid Build Coastguard Worker   bool HasPFI;
230*9880d681SAndroid Build Coastguard Worker 
231*9880d681SAndroid Build Coastguard Worker   /// Processor has AVX-512 Exponential and Reciprocal Instructions
232*9880d681SAndroid Build Coastguard Worker   bool HasERI;
233*9880d681SAndroid Build Coastguard Worker 
234*9880d681SAndroid Build Coastguard Worker   /// Processor has AVX-512 Conflict Detection Instructions
235*9880d681SAndroid Build Coastguard Worker   bool HasCDI;
236*9880d681SAndroid Build Coastguard Worker 
237*9880d681SAndroid Build Coastguard Worker   /// Processor has AVX-512 Doubleword and Quadword instructions
238*9880d681SAndroid Build Coastguard Worker   bool HasDQI;
239*9880d681SAndroid Build Coastguard Worker 
240*9880d681SAndroid Build Coastguard Worker   /// Processor has AVX-512 Byte and Word instructions
241*9880d681SAndroid Build Coastguard Worker   bool HasBWI;
242*9880d681SAndroid Build Coastguard Worker 
243*9880d681SAndroid Build Coastguard Worker   /// Processor has AVX-512 Vector Length eXtenstions
244*9880d681SAndroid Build Coastguard Worker   bool HasVLX;
245*9880d681SAndroid Build Coastguard Worker 
246*9880d681SAndroid Build Coastguard Worker   /// Processor has PKU extenstions
247*9880d681SAndroid Build Coastguard Worker   bool HasPKU;
248*9880d681SAndroid Build Coastguard Worker 
249*9880d681SAndroid Build Coastguard Worker   /// Processor supports MPX - Memory Protection Extensions
250*9880d681SAndroid Build Coastguard Worker   bool HasMPX;
251*9880d681SAndroid Build Coastguard Worker 
252*9880d681SAndroid Build Coastguard Worker   /// Processor supports Invalidate Process-Context Identifier
253*9880d681SAndroid Build Coastguard Worker   bool HasInvPCId;
254*9880d681SAndroid Build Coastguard Worker 
255*9880d681SAndroid Build Coastguard Worker   /// Processor has VM Functions
256*9880d681SAndroid Build Coastguard Worker   bool HasVMFUNC;
257*9880d681SAndroid Build Coastguard Worker 
258*9880d681SAndroid Build Coastguard Worker   /// Processor has Supervisor Mode Access Protection
259*9880d681SAndroid Build Coastguard Worker   bool HasSMAP;
260*9880d681SAndroid Build Coastguard Worker 
261*9880d681SAndroid Build Coastguard Worker   /// Processor has Software Guard Extensions
262*9880d681SAndroid Build Coastguard Worker   bool HasSGX;
263*9880d681SAndroid Build Coastguard Worker 
264*9880d681SAndroid Build Coastguard Worker   /// Processor supports Flush Cache Line instruction
265*9880d681SAndroid Build Coastguard Worker   bool HasCLFLUSHOPT;
266*9880d681SAndroid Build Coastguard Worker 
267*9880d681SAndroid Build Coastguard Worker   /// Processor has Persistent Commit feature
268*9880d681SAndroid Build Coastguard Worker   bool HasPCOMMIT;
269*9880d681SAndroid Build Coastguard Worker 
270*9880d681SAndroid Build Coastguard Worker   /// Processor supports Cache Line Write Back instruction
271*9880d681SAndroid Build Coastguard Worker   bool HasCLWB;
272*9880d681SAndroid Build Coastguard Worker 
273*9880d681SAndroid Build Coastguard Worker   /// Use software floating point for code generation.
274*9880d681SAndroid Build Coastguard Worker   bool UseSoftFloat;
275*9880d681SAndroid Build Coastguard Worker 
276*9880d681SAndroid Build Coastguard Worker   /// The minimum alignment known to hold of the stack frame on
277*9880d681SAndroid Build Coastguard Worker   /// entry to the function and which must be maintained by every function.
278*9880d681SAndroid Build Coastguard Worker   unsigned stackAlignment;
279*9880d681SAndroid Build Coastguard Worker 
280*9880d681SAndroid Build Coastguard Worker   /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
281*9880d681SAndroid Build Coastguard Worker   ///
282*9880d681SAndroid Build Coastguard Worker   unsigned MaxInlineSizeThreshold;
283*9880d681SAndroid Build Coastguard Worker 
284*9880d681SAndroid Build Coastguard Worker   /// What processor and OS we're targeting.
285*9880d681SAndroid Build Coastguard Worker   Triple TargetTriple;
286*9880d681SAndroid Build Coastguard Worker 
287*9880d681SAndroid Build Coastguard Worker   /// Instruction itineraries for scheduling
288*9880d681SAndroid Build Coastguard Worker   InstrItineraryData InstrItins;
289*9880d681SAndroid Build Coastguard Worker 
290*9880d681SAndroid Build Coastguard Worker private:
291*9880d681SAndroid Build Coastguard Worker 
292*9880d681SAndroid Build Coastguard Worker   /// Override the stack alignment.
293*9880d681SAndroid Build Coastguard Worker   unsigned StackAlignOverride;
294*9880d681SAndroid Build Coastguard Worker 
295*9880d681SAndroid Build Coastguard Worker   /// True if compiling for 64-bit, false for 16-bit or 32-bit.
296*9880d681SAndroid Build Coastguard Worker   bool In64BitMode;
297*9880d681SAndroid Build Coastguard Worker 
298*9880d681SAndroid Build Coastguard Worker   /// True if compiling for 32-bit, false for 16-bit or 64-bit.
299*9880d681SAndroid Build Coastguard Worker   bool In32BitMode;
300*9880d681SAndroid Build Coastguard Worker 
301*9880d681SAndroid Build Coastguard Worker   /// True if compiling for 16-bit, false for 32-bit or 64-bit.
302*9880d681SAndroid Build Coastguard Worker   bool In16BitMode;
303*9880d681SAndroid Build Coastguard Worker 
304*9880d681SAndroid Build Coastguard Worker   X86SelectionDAGInfo TSInfo;
305*9880d681SAndroid Build Coastguard Worker   // Ordering here is important. X86InstrInfo initializes X86RegisterInfo which
306*9880d681SAndroid Build Coastguard Worker   // X86TargetLowering needs.
307*9880d681SAndroid Build Coastguard Worker   X86InstrInfo InstrInfo;
308*9880d681SAndroid Build Coastguard Worker   X86TargetLowering TLInfo;
309*9880d681SAndroid Build Coastguard Worker   X86FrameLowering FrameLowering;
310*9880d681SAndroid Build Coastguard Worker 
311*9880d681SAndroid Build Coastguard Worker public:
312*9880d681SAndroid Build Coastguard Worker   /// This constructor initializes the data members to match that
313*9880d681SAndroid Build Coastguard Worker   /// of the specified triple.
314*9880d681SAndroid Build Coastguard Worker   ///
315*9880d681SAndroid Build Coastguard Worker   X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
316*9880d681SAndroid Build Coastguard Worker                const X86TargetMachine &TM, unsigned StackAlignOverride);
317*9880d681SAndroid Build Coastguard Worker 
getTargetLowering()318*9880d681SAndroid Build Coastguard Worker   const X86TargetLowering *getTargetLowering() const override {
319*9880d681SAndroid Build Coastguard Worker     return &TLInfo;
320*9880d681SAndroid Build Coastguard Worker   }
getInstrInfo()321*9880d681SAndroid Build Coastguard Worker   const X86InstrInfo *getInstrInfo() const override { return &InstrInfo; }
getFrameLowering()322*9880d681SAndroid Build Coastguard Worker   const X86FrameLowering *getFrameLowering() const override {
323*9880d681SAndroid Build Coastguard Worker     return &FrameLowering;
324*9880d681SAndroid Build Coastguard Worker   }
getSelectionDAGInfo()325*9880d681SAndroid Build Coastguard Worker   const X86SelectionDAGInfo *getSelectionDAGInfo() const override {
326*9880d681SAndroid Build Coastguard Worker     return &TSInfo;
327*9880d681SAndroid Build Coastguard Worker   }
getRegisterInfo()328*9880d681SAndroid Build Coastguard Worker   const X86RegisterInfo *getRegisterInfo() const override {
329*9880d681SAndroid Build Coastguard Worker     return &getInstrInfo()->getRegisterInfo();
330*9880d681SAndroid Build Coastguard Worker   }
331*9880d681SAndroid Build Coastguard Worker 
332*9880d681SAndroid Build Coastguard Worker   /// Returns the minimum alignment known to hold of the
333*9880d681SAndroid Build Coastguard Worker   /// stack frame on entry to the function and which must be maintained by every
334*9880d681SAndroid Build Coastguard Worker   /// function for this subtarget.
getStackAlignment()335*9880d681SAndroid Build Coastguard Worker   unsigned getStackAlignment() const { return stackAlignment; }
336*9880d681SAndroid Build Coastguard Worker 
337*9880d681SAndroid Build Coastguard Worker   /// Returns the maximum memset / memcpy size
338*9880d681SAndroid Build Coastguard Worker   /// that still makes it profitable to inline the call.
getMaxInlineSizeThreshold()339*9880d681SAndroid Build Coastguard Worker   unsigned getMaxInlineSizeThreshold() const { return MaxInlineSizeThreshold; }
340*9880d681SAndroid Build Coastguard Worker 
341*9880d681SAndroid Build Coastguard Worker   /// ParseSubtargetFeatures - Parses features string setting specified
342*9880d681SAndroid Build Coastguard Worker   /// subtarget options.  Definition of function is auto generated by tblgen.
343*9880d681SAndroid Build Coastguard Worker   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
344*9880d681SAndroid Build Coastguard Worker 
345*9880d681SAndroid Build Coastguard Worker private:
346*9880d681SAndroid Build Coastguard Worker   /// Initialize the full set of dependencies so we can use an initializer
347*9880d681SAndroid Build Coastguard Worker   /// list for X86Subtarget.
348*9880d681SAndroid Build Coastguard Worker   X86Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
349*9880d681SAndroid Build Coastguard Worker   void initializeEnvironment();
350*9880d681SAndroid Build Coastguard Worker   void initSubtargetFeatures(StringRef CPU, StringRef FS);
351*9880d681SAndroid Build Coastguard Worker public:
352*9880d681SAndroid Build Coastguard Worker   /// Is this x86_64? (disregarding specific ABI / programming model)
is64Bit()353*9880d681SAndroid Build Coastguard Worker   bool is64Bit() const {
354*9880d681SAndroid Build Coastguard Worker     return In64BitMode;
355*9880d681SAndroid Build Coastguard Worker   }
356*9880d681SAndroid Build Coastguard Worker 
is32Bit()357*9880d681SAndroid Build Coastguard Worker   bool is32Bit() const {
358*9880d681SAndroid Build Coastguard Worker     return In32BitMode;
359*9880d681SAndroid Build Coastguard Worker   }
360*9880d681SAndroid Build Coastguard Worker 
is16Bit()361*9880d681SAndroid Build Coastguard Worker   bool is16Bit() const {
362*9880d681SAndroid Build Coastguard Worker     return In16BitMode;
363*9880d681SAndroid Build Coastguard Worker   }
364*9880d681SAndroid Build Coastguard Worker 
365*9880d681SAndroid Build Coastguard Worker   /// Is this x86_64 with the ILP32 programming model (x32 ABI)?
isTarget64BitILP32()366*9880d681SAndroid Build Coastguard Worker   bool isTarget64BitILP32() const {
367*9880d681SAndroid Build Coastguard Worker     return In64BitMode && (TargetTriple.getEnvironment() == Triple::GNUX32 ||
368*9880d681SAndroid Build Coastguard Worker                            TargetTriple.isOSNaCl());
369*9880d681SAndroid Build Coastguard Worker   }
370*9880d681SAndroid Build Coastguard Worker 
371*9880d681SAndroid Build Coastguard Worker   /// Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
isTarget64BitLP64()372*9880d681SAndroid Build Coastguard Worker   bool isTarget64BitLP64() const {
373*9880d681SAndroid Build Coastguard Worker     return In64BitMode && (TargetTriple.getEnvironment() != Triple::GNUX32 &&
374*9880d681SAndroid Build Coastguard Worker                            !TargetTriple.isOSNaCl());
375*9880d681SAndroid Build Coastguard Worker   }
376*9880d681SAndroid Build Coastguard Worker 
getPICStyle()377*9880d681SAndroid Build Coastguard Worker   PICStyles::Style getPICStyle() const { return PICStyle; }
setPICStyle(PICStyles::Style Style)378*9880d681SAndroid Build Coastguard Worker   void setPICStyle(PICStyles::Style Style)  { PICStyle = Style; }
379*9880d681SAndroid Build Coastguard Worker 
hasX87()380*9880d681SAndroid Build Coastguard Worker   bool hasX87() const { return HasX87; }
hasCMov()381*9880d681SAndroid Build Coastguard Worker   bool hasCMov() const { return HasCMov; }
hasSSE1()382*9880d681SAndroid Build Coastguard Worker   bool hasSSE1() const { return X86SSELevel >= SSE1; }
hasSSE2()383*9880d681SAndroid Build Coastguard Worker   bool hasSSE2() const { return X86SSELevel >= SSE2; }
hasSSE3()384*9880d681SAndroid Build Coastguard Worker   bool hasSSE3() const { return X86SSELevel >= SSE3; }
hasSSSE3()385*9880d681SAndroid Build Coastguard Worker   bool hasSSSE3() const { return X86SSELevel >= SSSE3; }
hasSSE41()386*9880d681SAndroid Build Coastguard Worker   bool hasSSE41() const { return X86SSELevel >= SSE41; }
hasSSE42()387*9880d681SAndroid Build Coastguard Worker   bool hasSSE42() const { return X86SSELevel >= SSE42; }
hasAVX()388*9880d681SAndroid Build Coastguard Worker   bool hasAVX() const { return X86SSELevel >= AVX; }
hasAVX2()389*9880d681SAndroid Build Coastguard Worker   bool hasAVX2() const { return X86SSELevel >= AVX2; }
hasAVX512()390*9880d681SAndroid Build Coastguard Worker   bool hasAVX512() const { return X86SSELevel >= AVX512F; }
hasFp256()391*9880d681SAndroid Build Coastguard Worker   bool hasFp256() const { return hasAVX(); }
hasInt256()392*9880d681SAndroid Build Coastguard Worker   bool hasInt256() const { return hasAVX2(); }
hasSSE4A()393*9880d681SAndroid Build Coastguard Worker   bool hasSSE4A() const { return HasSSE4A; }
hasMMX()394*9880d681SAndroid Build Coastguard Worker   bool hasMMX() const { return X863DNowLevel >= MMX; }
has3DNow()395*9880d681SAndroid Build Coastguard Worker   bool has3DNow() const { return X863DNowLevel >= ThreeDNow; }
has3DNowA()396*9880d681SAndroid Build Coastguard Worker   bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; }
hasPOPCNT()397*9880d681SAndroid Build Coastguard Worker   bool hasPOPCNT() const { return HasPOPCNT; }
hasAES()398*9880d681SAndroid Build Coastguard Worker   bool hasAES() const { return HasAES; }
hasFXSR()399*9880d681SAndroid Build Coastguard Worker   bool hasFXSR() const { return HasFXSR; }
hasXSAVE()400*9880d681SAndroid Build Coastguard Worker   bool hasXSAVE() const { return HasXSAVE; }
hasXSAVEOPT()401*9880d681SAndroid Build Coastguard Worker   bool hasXSAVEOPT() const { return HasXSAVEOPT; }
hasXSAVEC()402*9880d681SAndroid Build Coastguard Worker   bool hasXSAVEC() const { return HasXSAVEC; }
hasXSAVES()403*9880d681SAndroid Build Coastguard Worker   bool hasXSAVES() const { return HasXSAVES; }
hasPCLMUL()404*9880d681SAndroid Build Coastguard Worker   bool hasPCLMUL() const { return HasPCLMUL; }
405*9880d681SAndroid Build Coastguard Worker   // Prefer FMA4 to FMA - its better for commutation/memory folding and
406*9880d681SAndroid Build Coastguard Worker   // has equal or better performance on all supported targets.
hasFMA()407*9880d681SAndroid Build Coastguard Worker   bool hasFMA() const { return HasFMA && !HasFMA4; }
hasFMA4()408*9880d681SAndroid Build Coastguard Worker   bool hasFMA4() const { return HasFMA4; }
hasAnyFMA()409*9880d681SAndroid Build Coastguard Worker   bool hasAnyFMA() const { return hasFMA() || hasFMA4() || hasAVX512(); }
hasXOP()410*9880d681SAndroid Build Coastguard Worker   bool hasXOP() const { return HasXOP; }
hasTBM()411*9880d681SAndroid Build Coastguard Worker   bool hasTBM() const { return HasTBM; }
hasMOVBE()412*9880d681SAndroid Build Coastguard Worker   bool hasMOVBE() const { return HasMOVBE; }
hasRDRAND()413*9880d681SAndroid Build Coastguard Worker   bool hasRDRAND() const { return HasRDRAND; }
hasF16C()414*9880d681SAndroid Build Coastguard Worker   bool hasF16C() const { return HasF16C; }
hasFSGSBase()415*9880d681SAndroid Build Coastguard Worker   bool hasFSGSBase() const { return HasFSGSBase; }
hasLZCNT()416*9880d681SAndroid Build Coastguard Worker   bool hasLZCNT() const { return HasLZCNT; }
hasBMI()417*9880d681SAndroid Build Coastguard Worker   bool hasBMI() const { return HasBMI; }
hasBMI2()418*9880d681SAndroid Build Coastguard Worker   bool hasBMI2() const { return HasBMI2; }
hasVBMI()419*9880d681SAndroid Build Coastguard Worker   bool hasVBMI() const { return HasVBMI; }
hasIFMA()420*9880d681SAndroid Build Coastguard Worker   bool hasIFMA() const { return HasIFMA; }
hasRTM()421*9880d681SAndroid Build Coastguard Worker   bool hasRTM() const { return HasRTM; }
hasHLE()422*9880d681SAndroid Build Coastguard Worker   bool hasHLE() const { return HasHLE; }
hasADX()423*9880d681SAndroid Build Coastguard Worker   bool hasADX() const { return HasADX; }
hasSHA()424*9880d681SAndroid Build Coastguard Worker   bool hasSHA() const { return HasSHA; }
hasPRFCHW()425*9880d681SAndroid Build Coastguard Worker   bool hasPRFCHW() const { return HasPRFCHW; }
hasRDSEED()426*9880d681SAndroid Build Coastguard Worker   bool hasRDSEED() const { return HasRDSEED; }
hasLAHFSAHF()427*9880d681SAndroid Build Coastguard Worker   bool hasLAHFSAHF() const { return HasLAHFSAHF; }
hasMWAITX()428*9880d681SAndroid Build Coastguard Worker   bool hasMWAITX() const { return HasMWAITX; }
isBTMemSlow()429*9880d681SAndroid Build Coastguard Worker   bool isBTMemSlow() const { return IsBTMemSlow; }
isSHLDSlow()430*9880d681SAndroid Build Coastguard Worker   bool isSHLDSlow() const { return IsSHLDSlow; }
isUnalignedMem16Slow()431*9880d681SAndroid Build Coastguard Worker   bool isUnalignedMem16Slow() const { return IsUAMem16Slow; }
isUnalignedMem32Slow()432*9880d681SAndroid Build Coastguard Worker   bool isUnalignedMem32Slow() const { return IsUAMem32Slow; }
hasSSEUnalignedMem()433*9880d681SAndroid Build Coastguard Worker   bool hasSSEUnalignedMem() const { return HasSSEUnalignedMem; }
hasCmpxchg16b()434*9880d681SAndroid Build Coastguard Worker   bool hasCmpxchg16b() const { return HasCmpxchg16b; }
useLeaForSP()435*9880d681SAndroid Build Coastguard Worker   bool useLeaForSP() const { return UseLeaForSP; }
hasFastPartialYMMWrite()436*9880d681SAndroid Build Coastguard Worker   bool hasFastPartialYMMWrite() const { return HasFastPartialYMMWrite; }
hasSlowDivide32()437*9880d681SAndroid Build Coastguard Worker   bool hasSlowDivide32() const { return HasSlowDivide32; }
hasSlowDivide64()438*9880d681SAndroid Build Coastguard Worker   bool hasSlowDivide64() const { return HasSlowDivide64; }
padShortFunctions()439*9880d681SAndroid Build Coastguard Worker   bool padShortFunctions() const { return PadShortFunctions; }
callRegIndirect()440*9880d681SAndroid Build Coastguard Worker   bool callRegIndirect() const { return CallRegIndirect; }
LEAusesAG()441*9880d681SAndroid Build Coastguard Worker   bool LEAusesAG() const { return LEAUsesAG; }
slowLEA()442*9880d681SAndroid Build Coastguard Worker   bool slowLEA() const { return SlowLEA; }
slowIncDec()443*9880d681SAndroid Build Coastguard Worker   bool slowIncDec() const { return SlowIncDec; }
hasCDI()444*9880d681SAndroid Build Coastguard Worker   bool hasCDI() const { return HasCDI; }
hasPFI()445*9880d681SAndroid Build Coastguard Worker   bool hasPFI() const { return HasPFI; }
hasERI()446*9880d681SAndroid Build Coastguard Worker   bool hasERI() const { return HasERI; }
hasDQI()447*9880d681SAndroid Build Coastguard Worker   bool hasDQI() const { return HasDQI; }
hasBWI()448*9880d681SAndroid Build Coastguard Worker   bool hasBWI() const { return HasBWI; }
hasVLX()449*9880d681SAndroid Build Coastguard Worker   bool hasVLX() const { return HasVLX; }
hasPKU()450*9880d681SAndroid Build Coastguard Worker   bool hasPKU() const { return HasPKU; }
hasMPX()451*9880d681SAndroid Build Coastguard Worker   bool hasMPX() const { return HasMPX; }
452*9880d681SAndroid Build Coastguard Worker 
isAtom()453*9880d681SAndroid Build Coastguard Worker   bool isAtom() const { return X86ProcFamily == IntelAtom; }
isSLM()454*9880d681SAndroid Build Coastguard Worker   bool isSLM() const { return X86ProcFamily == IntelSLM; }
useSoftFloat()455*9880d681SAndroid Build Coastguard Worker   bool useSoftFloat() const { return UseSoftFloat; }
456*9880d681SAndroid Build Coastguard Worker 
457*9880d681SAndroid Build Coastguard Worker   /// Use mfence if we have SSE2 or we're on x86-64 (even if we asked for
458*9880d681SAndroid Build Coastguard Worker   /// no-sse2). There isn't any reason to disable it if the target processor
459*9880d681SAndroid Build Coastguard Worker   /// supports it.
hasMFence()460*9880d681SAndroid Build Coastguard Worker   bool hasMFence() const { return hasSSE2() || is64Bit(); }
461*9880d681SAndroid Build Coastguard Worker 
getTargetTriple()462*9880d681SAndroid Build Coastguard Worker   const Triple &getTargetTriple() const { return TargetTriple; }
463*9880d681SAndroid Build Coastguard Worker 
isTargetDarwin()464*9880d681SAndroid Build Coastguard Worker   bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
isTargetFreeBSD()465*9880d681SAndroid Build Coastguard Worker   bool isTargetFreeBSD() const { return TargetTriple.isOSFreeBSD(); }
isTargetDragonFly()466*9880d681SAndroid Build Coastguard Worker   bool isTargetDragonFly() const { return TargetTriple.isOSDragonFly(); }
isTargetSolaris()467*9880d681SAndroid Build Coastguard Worker   bool isTargetSolaris() const { return TargetTriple.isOSSolaris(); }
isTargetPS4()468*9880d681SAndroid Build Coastguard Worker   bool isTargetPS4() const { return TargetTriple.isPS4(); }
469*9880d681SAndroid Build Coastguard Worker 
isTargetELF()470*9880d681SAndroid Build Coastguard Worker   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
isTargetCOFF()471*9880d681SAndroid Build Coastguard Worker   bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
isTargetMachO()472*9880d681SAndroid Build Coastguard Worker   bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
473*9880d681SAndroid Build Coastguard Worker 
isTargetLinux()474*9880d681SAndroid Build Coastguard Worker   bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
isTargetKFreeBSD()475*9880d681SAndroid Build Coastguard Worker   bool isTargetKFreeBSD() const { return TargetTriple.isOSKFreeBSD(); }
isTargetGlibc()476*9880d681SAndroid Build Coastguard Worker   bool isTargetGlibc() const { return TargetTriple.isOSGlibc(); }
isTargetAndroid()477*9880d681SAndroid Build Coastguard Worker   bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
isTargetNaCl()478*9880d681SAndroid Build Coastguard Worker   bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
isTargetNaCl32()479*9880d681SAndroid Build Coastguard Worker   bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
isTargetNaCl64()480*9880d681SAndroid Build Coastguard Worker   bool isTargetNaCl64() const { return isTargetNaCl() && is64Bit(); }
isTargetMCU()481*9880d681SAndroid Build Coastguard Worker   bool isTargetMCU() const { return TargetTriple.isOSIAMCU(); }
482*9880d681SAndroid Build Coastguard Worker 
isTargetWindowsMSVC()483*9880d681SAndroid Build Coastguard Worker   bool isTargetWindowsMSVC() const {
484*9880d681SAndroid Build Coastguard Worker     return TargetTriple.isWindowsMSVCEnvironment();
485*9880d681SAndroid Build Coastguard Worker   }
486*9880d681SAndroid Build Coastguard Worker 
isTargetKnownWindowsMSVC()487*9880d681SAndroid Build Coastguard Worker   bool isTargetKnownWindowsMSVC() const {
488*9880d681SAndroid Build Coastguard Worker     return TargetTriple.isKnownWindowsMSVCEnvironment();
489*9880d681SAndroid Build Coastguard Worker   }
490*9880d681SAndroid Build Coastguard Worker 
isTargetWindowsCoreCLR()491*9880d681SAndroid Build Coastguard Worker   bool isTargetWindowsCoreCLR() const {
492*9880d681SAndroid Build Coastguard Worker     return TargetTriple.isWindowsCoreCLREnvironment();
493*9880d681SAndroid Build Coastguard Worker   }
494*9880d681SAndroid Build Coastguard Worker 
isTargetWindowsCygwin()495*9880d681SAndroid Build Coastguard Worker   bool isTargetWindowsCygwin() const {
496*9880d681SAndroid Build Coastguard Worker     return TargetTriple.isWindowsCygwinEnvironment();
497*9880d681SAndroid Build Coastguard Worker   }
498*9880d681SAndroid Build Coastguard Worker 
isTargetWindowsGNU()499*9880d681SAndroid Build Coastguard Worker   bool isTargetWindowsGNU() const {
500*9880d681SAndroid Build Coastguard Worker     return TargetTriple.isWindowsGNUEnvironment();
501*9880d681SAndroid Build Coastguard Worker   }
502*9880d681SAndroid Build Coastguard Worker 
isTargetWindowsItanium()503*9880d681SAndroid Build Coastguard Worker   bool isTargetWindowsItanium() const {
504*9880d681SAndroid Build Coastguard Worker     return TargetTriple.isWindowsItaniumEnvironment();
505*9880d681SAndroid Build Coastguard Worker   }
506*9880d681SAndroid Build Coastguard Worker 
isTargetCygMing()507*9880d681SAndroid Build Coastguard Worker   bool isTargetCygMing() const { return TargetTriple.isOSCygMing(); }
508*9880d681SAndroid Build Coastguard Worker 
isOSWindows()509*9880d681SAndroid Build Coastguard Worker   bool isOSWindows() const { return TargetTriple.isOSWindows(); }
510*9880d681SAndroid Build Coastguard Worker 
isTargetWin64()511*9880d681SAndroid Build Coastguard Worker   bool isTargetWin64() const {
512*9880d681SAndroid Build Coastguard Worker     return In64BitMode && TargetTriple.isOSWindows();
513*9880d681SAndroid Build Coastguard Worker   }
514*9880d681SAndroid Build Coastguard Worker 
isTargetWin32()515*9880d681SAndroid Build Coastguard Worker   bool isTargetWin32() const {
516*9880d681SAndroid Build Coastguard Worker     return !In64BitMode && (isTargetCygMing() || isTargetKnownWindowsMSVC());
517*9880d681SAndroid Build Coastguard Worker   }
518*9880d681SAndroid Build Coastguard Worker 
isPICStyleGOT()519*9880d681SAndroid Build Coastguard Worker   bool isPICStyleGOT() const { return PICStyle == PICStyles::GOT; }
isPICStyleRIPRel()520*9880d681SAndroid Build Coastguard Worker   bool isPICStyleRIPRel() const { return PICStyle == PICStyles::RIPRel; }
521*9880d681SAndroid Build Coastguard Worker 
isPICStyleStubPIC()522*9880d681SAndroid Build Coastguard Worker   bool isPICStyleStubPIC() const {
523*9880d681SAndroid Build Coastguard Worker     return PICStyle == PICStyles::StubPIC;
524*9880d681SAndroid Build Coastguard Worker   }
525*9880d681SAndroid Build Coastguard Worker 
isPositionIndependent()526*9880d681SAndroid Build Coastguard Worker   bool isPositionIndependent() const { return TM.isPositionIndependent(); }
527*9880d681SAndroid Build Coastguard Worker 
isCallingConvWin64(CallingConv::ID CC)528*9880d681SAndroid Build Coastguard Worker   bool isCallingConvWin64(CallingConv::ID CC) const {
529*9880d681SAndroid Build Coastguard Worker     switch (CC) {
530*9880d681SAndroid Build Coastguard Worker     // On Win64, all these conventions just use the default convention.
531*9880d681SAndroid Build Coastguard Worker     case CallingConv::C:
532*9880d681SAndroid Build Coastguard Worker     case CallingConv::Fast:
533*9880d681SAndroid Build Coastguard Worker     case CallingConv::X86_FastCall:
534*9880d681SAndroid Build Coastguard Worker     case CallingConv::X86_StdCall:
535*9880d681SAndroid Build Coastguard Worker     case CallingConv::X86_ThisCall:
536*9880d681SAndroid Build Coastguard Worker     case CallingConv::X86_VectorCall:
537*9880d681SAndroid Build Coastguard Worker     case CallingConv::Intel_OCL_BI:
538*9880d681SAndroid Build Coastguard Worker       return isTargetWin64();
539*9880d681SAndroid Build Coastguard Worker     // This convention allows using the Win64 convention on other targets.
540*9880d681SAndroid Build Coastguard Worker     case CallingConv::X86_64_Win64:
541*9880d681SAndroid Build Coastguard Worker       return true;
542*9880d681SAndroid Build Coastguard Worker     // This convention allows using the SysV convention on Windows targets.
543*9880d681SAndroid Build Coastguard Worker     case CallingConv::X86_64_SysV:
544*9880d681SAndroid Build Coastguard Worker       return false;
545*9880d681SAndroid Build Coastguard Worker     // Otherwise, who knows what this is.
546*9880d681SAndroid Build Coastguard Worker     default:
547*9880d681SAndroid Build Coastguard Worker       return false;
548*9880d681SAndroid Build Coastguard Worker     }
549*9880d681SAndroid Build Coastguard Worker   }
550*9880d681SAndroid Build Coastguard Worker 
551*9880d681SAndroid Build Coastguard Worker   /// Classify a global variable reference for the current subtarget according
552*9880d681SAndroid Build Coastguard Worker   /// to how we should reference it in a non-pcrel context.
553*9880d681SAndroid Build Coastguard Worker   unsigned char classifyLocalReference(const GlobalValue *GV) const;
554*9880d681SAndroid Build Coastguard Worker 
555*9880d681SAndroid Build Coastguard Worker   unsigned char classifyGlobalReference(const GlobalValue *GV,
556*9880d681SAndroid Build Coastguard Worker                                         const Module &M) const;
557*9880d681SAndroid Build Coastguard Worker   unsigned char classifyGlobalReference(const GlobalValue *GV) const;
558*9880d681SAndroid Build Coastguard Worker 
559*9880d681SAndroid Build Coastguard Worker   /// Classify a global function reference for the current subtarget.
560*9880d681SAndroid Build Coastguard Worker   unsigned char classifyGlobalFunctionReference(const GlobalValue *GV,
561*9880d681SAndroid Build Coastguard Worker                                                 const Module &M) const;
562*9880d681SAndroid Build Coastguard Worker   unsigned char classifyGlobalFunctionReference(const GlobalValue *GV) const;
563*9880d681SAndroid Build Coastguard Worker 
564*9880d681SAndroid Build Coastguard Worker   /// Classify a blockaddress reference for the current subtarget according to
565*9880d681SAndroid Build Coastguard Worker   /// how we should reference it in a non-pcrel context.
566*9880d681SAndroid Build Coastguard Worker   unsigned char classifyBlockAddressReference() const;
567*9880d681SAndroid Build Coastguard Worker 
568*9880d681SAndroid Build Coastguard Worker   /// Return true if the subtarget allows calls to immediate address.
569*9880d681SAndroid Build Coastguard Worker   bool isLegalToCallImmediateAddr() const;
570*9880d681SAndroid Build Coastguard Worker 
571*9880d681SAndroid Build Coastguard Worker   /// This function returns the name of a function which has an interface
572*9880d681SAndroid Build Coastguard Worker   /// like the non-standard bzero function, if such a function exists on
573*9880d681SAndroid Build Coastguard Worker   /// the current subtarget and it is considered prefereable over
574*9880d681SAndroid Build Coastguard Worker   /// memset with zero passed as the second argument. Otherwise it
575*9880d681SAndroid Build Coastguard Worker   /// returns null.
576*9880d681SAndroid Build Coastguard Worker   const char *getBZeroEntry() const;
577*9880d681SAndroid Build Coastguard Worker 
578*9880d681SAndroid Build Coastguard Worker   /// This function returns true if the target has sincos() routine in its
579*9880d681SAndroid Build Coastguard Worker   /// compiler runtime or math libraries.
580*9880d681SAndroid Build Coastguard Worker   bool hasSinCos() const;
581*9880d681SAndroid Build Coastguard Worker 
582*9880d681SAndroid Build Coastguard Worker   /// Enable the MachineScheduler pass for all X86 subtargets.
enableMachineScheduler()583*9880d681SAndroid Build Coastguard Worker   bool enableMachineScheduler() const override { return true; }
584*9880d681SAndroid Build Coastguard Worker 
585*9880d681SAndroid Build Coastguard Worker   bool enableEarlyIfConversion() const override;
586*9880d681SAndroid Build Coastguard Worker 
587*9880d681SAndroid Build Coastguard Worker   /// Return the instruction itineraries based on the subtarget selection.
getInstrItineraryData()588*9880d681SAndroid Build Coastguard Worker   const InstrItineraryData *getInstrItineraryData() const override {
589*9880d681SAndroid Build Coastguard Worker     return &InstrItins;
590*9880d681SAndroid Build Coastguard Worker   }
591*9880d681SAndroid Build Coastguard Worker 
getAntiDepBreakMode()592*9880d681SAndroid Build Coastguard Worker   AntiDepBreakMode getAntiDepBreakMode() const override {
593*9880d681SAndroid Build Coastguard Worker     return TargetSubtargetInfo::ANTIDEP_CRITICAL;
594*9880d681SAndroid Build Coastguard Worker   }
595*9880d681SAndroid Build Coastguard Worker };
596*9880d681SAndroid Build Coastguard Worker 
597*9880d681SAndroid Build Coastguard Worker } // End llvm namespace
598*9880d681SAndroid Build Coastguard Worker 
599*9880d681SAndroid Build Coastguard Worker #endif
600