LLVM  5.0.0
X86Subtarget.h
Go to the documentation of this file.
1 //===-- X86Subtarget.h - Define Subtarget for the X86 ----------*- C++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the X86 specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_X86_X86SUBTARGET_H
15 #define LLVM_LIB_TARGET_X86_X86SUBTARGET_H
16 
17 #include "X86FrameLowering.h"
18 #include "X86ISelLowering.h"
19 #include "X86InstrInfo.h"
20 #include "X86SelectionDAGInfo.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/ADT/Triple.h"
24 #include "llvm/IR/CallingConv.h"
28 #include <memory>
29 
30 #define GET_SUBTARGETINFO_HEADER
31 #include "X86GenSubtargetInfo.inc"
32 
33 namespace llvm {
34 
35 class GlobalValue;
36 
37 /// The X86 backend supports a number of different styles of PIC.
38 ///
39 namespace PICStyles {
40 
41 enum Style {
42  StubPIC, // Used on i386-darwin in pic mode.
43  GOT, // Used on 32 bit elf on when in pic mode.
44  RIPRel, // Used on X86-64 when in pic mode.
45  None // Set when not in pic mode.
46 };
47 
48 } // end namespace PICStyles
49 
50 class X86Subtarget final : public X86GenSubtargetInfo {
51 protected:
52  enum X86SSEEnum {
54  };
55 
56  enum X863DNowEnum {
58  };
59 
62  };
63 
64  /// X86 processor family: Intel Atom, and others
66 
67  /// Which PIC style to use
69 
70  const TargetMachine &TM;
71 
72  /// SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or none supported.
74 
75  /// MMX, 3DNow, 3DNow Athlon, or none supported.
77 
78  /// True if the processor supports X87 instructions.
79  bool HasX87;
80 
81  /// True if this processor has conditional move instructions
82  /// (generally pentium pro+).
83  bool HasCMov;
84 
85  /// True if the processor supports X86-64 instructions.
86  bool HasX86_64;
87 
88  /// True if the processor supports POPCNT.
89  bool HasPOPCNT;
90 
91  /// True if the processor supports SSE4A instructions.
92  bool HasSSE4A;
93 
94  /// Target has AES instructions
95  bool HasAES;
96 
97  /// Target has FXSAVE/FXRESTOR instructions
98  bool HasFXSR;
99 
100  /// Target has XSAVE instructions
101  bool HasXSAVE;
102 
103  /// Target has XSAVEOPT instructions
105 
106  /// Target has XSAVEC instructions
107  bool HasXSAVEC;
108 
109  /// Target has XSAVES instructions
110  bool HasXSAVES;
111 
112  /// Target has carry-less multiplication
113  bool HasPCLMUL;
114 
115  /// Target has 3-operand fused multiply-add
116  bool HasFMA;
117 
118  /// Target has 4-operand fused multiply-add
119  bool HasFMA4;
120 
121  /// Target has XOP instructions
122  bool HasXOP;
123 
124  /// Target has TBM instructions.
125  bool HasTBM;
126 
127  /// Target has LWP instructions
128  bool HasLWP;
129 
130  /// True if the processor has the MOVBE instruction.
131  bool HasMOVBE;
132 
133  /// True if the processor has the RDRAND instruction.
134  bool HasRDRAND;
135 
136  /// Processor has 16-bit floating point conversion instructions.
137  bool HasF16C;
138 
139  /// Processor has FS/GS base insturctions.
141 
142  /// Processor has LZCNT instruction.
143  bool HasLZCNT;
144 
145  /// Processor has BMI1 instructions.
146  bool HasBMI;
147 
148  /// Processor has BMI2 instructions.
149  bool HasBMI2;
150 
151  /// Processor has VBMI instructions.
152  bool HasVBMI;
153 
154  /// Processor has Integer Fused Multiply Add
155  bool HasIFMA;
156 
157  /// Processor has RTM instructions.
158  bool HasRTM;
159 
160  /// Processor has ADX instructions.
161  bool HasADX;
162 
163  /// Processor has SHA instructions.
164  bool HasSHA;
165 
166  /// Processor has PRFCHW instructions.
167  bool HasPRFCHW;
168 
169  /// Processor has RDSEED instructions.
170  bool HasRDSEED;
171 
172  /// Processor has LAHF/SAHF instructions.
174 
175  /// Processor has MONITORX/MWAITX instructions.
176  bool HasMWAITX;
177 
178  /// Processor has Cache Line Zero instruction
179  bool HasCLZERO;
180 
181  /// Processor has Prefetch with intent to Write instruction
183 
184  /// True if BT (bit test) of memory instructions are slow.
186 
187  /// True if SHLD instructions are slow.
189 
190  /// True if the PMULLD instruction is slow compared to PMULLW/PMULHW and
191  // PMULUDQ.
193 
194  /// True if unaligned memory accesses of 16-bytes are slow.
196 
197  /// True if unaligned memory accesses of 32-bytes are slow.
199 
200  /// True if SSE operations can have unaligned memory operands.
201  /// This may require setting a configuration bit in the processor.
203 
204  /// True if this processor has the CMPXCHG16B instruction;
205  /// this is true for most x86-64 chips, but not the first AMD chips.
207 
208  /// True if the LEA instruction should be used for adjusting
209  /// the stack pointer. This is an optimization for Intel Atom processors.
211 
212  /// True if there is no performance penalty to writing only the lower parts
213  /// of a YMM or ZMM register without clearing the upper part.
215 
216  /// True if hardware SQRTSS instruction is at least as fast (latency) as
217  /// RSQRTSS followed by a Newton-Raphson iteration.
219 
220  /// True if hardware SQRTPS/VSQRTPS instructions are at least as fast
221  /// (throughput) as RSQRTPS/VRSQRTPS followed by a Newton-Raphson iteration.
223 
224  /// True if 8-bit divisions are significantly faster than
225  /// 32-bit divisions and should be used when possible.
227 
228  /// True if 32-bit divides are significantly faster than
229  /// 64-bit divisions and should be used when possible.
231 
232  /// True if LZCNT instruction is fast.
234 
235  /// True if SHLD based rotate is fast.
237 
238  /// True if the processor has enhanced REP MOVSB/STOSB.
239  bool HasERMSB;
240 
241  /// True if the short functions should be padded to prevent
242  /// a stall when returning too early.
244 
245  /// True if the Calls with memory reference should be converted
246  /// to a register-based indirect call.
248 
249  /// True if the LEA instruction inputs have to be ready at address generation
250  /// (AG) time.
251  bool LEAUsesAG;
252 
253  /// True if the LEA instruction with certain arguments is slow
254  bool SlowLEA;
255 
256  /// True if the LEA instruction has all three source operands: base, index,
257  /// and offset or if the LEA instruction uses base and index registers where
258  /// the base is EBP, RBP,or R13
260 
261  /// True if INC and DEC instructions are slow when writing to flags
263 
264  /// Processor has AVX-512 PreFetch Instructions
265  bool HasPFI;
266 
267  /// Processor has AVX-512 Exponential and Reciprocal Instructions
268  bool HasERI;
269 
270  /// Processor has AVX-512 Conflict Detection Instructions
271  bool HasCDI;
272 
273  /// Processor has AVX-512 population count Instructions
275 
276  /// Processor has AVX-512 Doubleword and Quadword instructions
277  bool HasDQI;
278 
279  /// Processor has AVX-512 Byte and Word instructions
280  bool HasBWI;
281 
282  /// Processor has AVX-512 Vector Length eXtenstions
283  bool HasVLX;
284 
285  /// Processor has PKU extenstions
286  bool HasPKU;
287 
288  /// Processor supports MPX - Memory Protection Extensions
289  bool HasMPX;
290 
291  /// Processor has Software Guard Extensions
292  bool HasSGX;
293 
294  /// Processor supports Flush Cache Line instruction
296 
297  /// Processor supports Cache Line Write Back instruction
298  bool HasCLWB;
299 
300  /// Use software floating point for code generation.
302 
303  /// The minimum alignment known to hold of the stack frame on
304  /// entry to the function and which must be maintained by every function.
305  unsigned stackAlignment;
306 
307  /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
308  ///
310 
311  /// What processor and OS we're targeting.
313 
314  /// Instruction itineraries for scheduling
316 
317  /// Gather the accessor points to GlobalISel-related APIs.
318  /// This is used to avoid ifndefs spreading around while GISel is
319  /// an optional library.
320  std::unique_ptr<GISelAccessor> GISel;
321 
322 private:
323  /// Override the stack alignment.
324  unsigned StackAlignOverride;
325 
326  /// True if compiling for 64-bit, false for 16-bit or 32-bit.
327  bool In64BitMode;
328 
329  /// True if compiling for 32-bit, false for 16-bit or 64-bit.
330  bool In32BitMode;
331 
332  /// True if compiling for 16-bit, false for 32-bit or 64-bit.
333  bool In16BitMode;
334 
335  X86SelectionDAGInfo TSInfo;
336  // Ordering here is important. X86InstrInfo initializes X86RegisterInfo which
337  // X86TargetLowering needs.
338  X86InstrInfo InstrInfo;
339  X86TargetLowering TLInfo;
340  X86FrameLowering FrameLowering;
341 
342 public:
343  /// This constructor initializes the data members to match that
344  /// of the specified triple.
345  ///
346  X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
347  const X86TargetMachine &TM, unsigned StackAlignOverride);
348 
349  /// This object will take onwership of \p GISelAccessor.
350  void setGISelAccessor(GISelAccessor &GISel) { this->GISel.reset(&GISel); }
351 
352  const X86TargetLowering *getTargetLowering() const override {
353  return &TLInfo;
354  }
355 
356  const X86InstrInfo *getInstrInfo() const override { return &InstrInfo; }
357 
358  const X86FrameLowering *getFrameLowering() const override {
359  return &FrameLowering;
360  }
361 
362  const X86SelectionDAGInfo *getSelectionDAGInfo() const override {
363  return &TSInfo;
364  }
365 
366  const X86RegisterInfo *getRegisterInfo() const override {
367  return &getInstrInfo()->getRegisterInfo();
368  }
369 
370  /// Returns the minimum alignment known to hold of the
371  /// stack frame on entry to the function and which must be maintained by every
372  /// function for this subtarget.
373  unsigned getStackAlignment() const { return stackAlignment; }
374 
375  /// Returns the maximum memset / memcpy size
376  /// that still makes it profitable to inline the call.
378 
379  /// ParseSubtargetFeatures - Parses features string setting specified
380  /// subtarget options. Definition of function is auto generated by tblgen.
382 
383  /// Methods used by Global ISel
384  const CallLowering *getCallLowering() const override;
385  const InstructionSelector *getInstructionSelector() const override;
386  const LegalizerInfo *getLegalizerInfo() const override;
387  const RegisterBankInfo *getRegBankInfo() const override;
388 
389 private:
390  /// Initialize the full set of dependencies so we can use an initializer
391  /// list for X86Subtarget.
392  X86Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
393  void initializeEnvironment();
394  void initSubtargetFeatures(StringRef CPU, StringRef FS);
395 
396 public:
397  /// Is this x86_64? (disregarding specific ABI / programming model)
398  bool is64Bit() const {
399  return In64BitMode;
400  }
401 
402  bool is32Bit() const {
403  return In32BitMode;
404  }
405 
406  bool is16Bit() const {
407  return In16BitMode;
408  }
409 
410  /// Is this x86_64 with the ILP32 programming model (x32 ABI)?
411  bool isTarget64BitILP32() const {
412  return In64BitMode && (TargetTriple.getEnvironment() == Triple::GNUX32 ||
414  }
415 
416  /// Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
417  bool isTarget64BitLP64() const {
418  return In64BitMode && (TargetTriple.getEnvironment() != Triple::GNUX32 &&
420  }
421 
424 
425  bool hasX87() const { return HasX87; }
426  bool hasCMov() const { return HasCMov; }
427  bool hasSSE1() const { return X86SSELevel >= SSE1; }
428  bool hasSSE2() const { return X86SSELevel >= SSE2; }
429  bool hasSSE3() const { return X86SSELevel >= SSE3; }
430  bool hasSSSE3() const { return X86SSELevel >= SSSE3; }
431  bool hasSSE41() const { return X86SSELevel >= SSE41; }
432  bool hasSSE42() const { return X86SSELevel >= SSE42; }
433  bool hasAVX() const { return X86SSELevel >= AVX; }
434  bool hasAVX2() const { return X86SSELevel >= AVX2; }
435  bool hasAVX512() const { return X86SSELevel >= AVX512F; }
436  bool hasFp256() const { return hasAVX(); }
437  bool hasInt256() const { return hasAVX2(); }
438  bool hasSSE4A() const { return HasSSE4A; }
439  bool hasMMX() const { return X863DNowLevel >= MMX; }
440  bool has3DNow() const { return X863DNowLevel >= ThreeDNow; }
441  bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; }
442  bool hasPOPCNT() const { return HasPOPCNT; }
443  bool hasAES() const { return HasAES; }
444  bool hasFXSR() const { return HasFXSR; }
445  bool hasXSAVE() const { return HasXSAVE; }
446  bool hasXSAVEOPT() const { return HasXSAVEOPT; }
447  bool hasXSAVEC() const { return HasXSAVEC; }
448  bool hasXSAVES() const { return HasXSAVES; }
449  bool hasPCLMUL() const { return HasPCLMUL; }
450  // Prefer FMA4 to FMA - its better for commutation/memory folding and
451  // has equal or better performance on all supported targets.
452  bool hasFMA() const { return (HasFMA || hasAVX512()) && !HasFMA4; }
453  bool hasFMA4() const { return HasFMA4; }
454  bool hasAnyFMA() const { return hasFMA() || hasFMA4(); }
455  bool hasXOP() const { return HasXOP; }
456  bool hasTBM() const { return HasTBM; }
457  bool hasLWP() const { return HasLWP; }
458  bool hasMOVBE() const { return HasMOVBE; }
459  bool hasRDRAND() const { return HasRDRAND; }
460  bool hasF16C() const { return HasF16C; }
461  bool hasFSGSBase() const { return HasFSGSBase; }
462  bool hasLZCNT() const { return HasLZCNT; }
463  bool hasBMI() const { return HasBMI; }
464  bool hasBMI2() const { return HasBMI2; }
465  bool hasVBMI() const { return HasVBMI; }
466  bool hasIFMA() const { return HasIFMA; }
467  bool hasRTM() const { return HasRTM; }
468  bool hasADX() const { return HasADX; }
469  bool hasSHA() const { return HasSHA; }
470  bool hasPRFCHW() const { return HasPRFCHW; }
471  bool hasRDSEED() const { return HasRDSEED; }
472  bool hasLAHFSAHF() const { return HasLAHFSAHF; }
473  bool hasMWAITX() const { return HasMWAITX; }
474  bool hasCLZERO() const { return HasCLZERO; }
475  bool isBTMemSlow() const { return IsBTMemSlow; }
476  bool isSHLDSlow() const { return IsSHLDSlow; }
477  bool isPMULLDSlow() const { return IsPMULLDSlow; }
478  bool isUnalignedMem16Slow() const { return IsUAMem16Slow; }
479  bool isUnalignedMem32Slow() const { return IsUAMem32Slow; }
480  bool hasSSEUnalignedMem() const { return HasSSEUnalignedMem; }
481  bool hasCmpxchg16b() const { return HasCmpxchg16b; }
482  bool useLeaForSP() const { return UseLeaForSP; }
485  }
486  bool hasFastScalarFSQRT() const { return HasFastScalarFSQRT; }
487  bool hasFastVectorFSQRT() const { return HasFastVectorFSQRT; }
488  bool hasFastLZCNT() const { return HasFastLZCNT; }
489  bool hasFastSHLDRotate() const { return HasFastSHLDRotate; }
490  bool hasERMSB() const { return HasERMSB; }
491  bool hasSlowDivide32() const { return HasSlowDivide32; }
492  bool hasSlowDivide64() const { return HasSlowDivide64; }
493  bool padShortFunctions() const { return PadShortFunctions; }
494  bool callRegIndirect() const { return CallRegIndirect; }
495  bool LEAusesAG() const { return LEAUsesAG; }
496  bool slowLEA() const { return SlowLEA; }
497  bool slow3OpsLEA() const { return Slow3OpsLEA; }
498  bool slowIncDec() const { return SlowIncDec; }
499  bool hasCDI() const { return HasCDI; }
500  bool hasVPOPCNTDQ() const { return HasVPOPCNTDQ; }
501  bool hasPFI() const { return HasPFI; }
502  bool hasERI() const { return HasERI; }
503  bool hasDQI() const { return HasDQI; }
504  bool hasBWI() const { return HasBWI; }
505  bool hasVLX() const { return HasVLX; }
506  bool hasPKU() const { return HasPKU; }
507  bool hasMPX() const { return HasMPX; }
508  bool hasCLFLUSHOPT() const { return HasCLFLUSHOPT; }
509 
510  bool isXRaySupported() const override { return is64Bit(); }
511 
512  bool isAtom() const { return X86ProcFamily == IntelAtom; }
513  bool isSLM() const { return X86ProcFamily == IntelSLM; }
514  bool useSoftFloat() const { return UseSoftFloat; }
515 
516  /// Use mfence if we have SSE2 or we're on x86-64 (even if we asked for
517  /// no-sse2). There isn't any reason to disable it if the target processor
518  /// supports it.
519  bool hasMFence() const { return hasSSE2() || is64Bit(); }
520 
521  const Triple &getTargetTriple() const { return TargetTriple; }
522 
523  bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
524  bool isTargetFreeBSD() const { return TargetTriple.isOSFreeBSD(); }
525  bool isTargetDragonFly() const { return TargetTriple.isOSDragonFly(); }
526  bool isTargetSolaris() const { return TargetTriple.isOSSolaris(); }
527  bool isTargetPS4() const { return TargetTriple.isPS4CPU(); }
528 
529  bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
530  bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
531  bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
532 
533  bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
534  bool isTargetKFreeBSD() const { return TargetTriple.isOSKFreeBSD(); }
535  bool isTargetGlibc() const { return TargetTriple.isOSGlibc(); }
536  bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
537  bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
538  bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
539  bool isTargetNaCl64() const { return isTargetNaCl() && is64Bit(); }
540  bool isTargetMCU() const { return TargetTriple.isOSIAMCU(); }
541  bool isTargetFuchsia() const { return TargetTriple.isOSFuchsia(); }
542 
543  bool isTargetWindowsMSVC() const {
545  }
546 
549  }
550 
551  bool isTargetWindowsCoreCLR() const {
553  }
554 
555  bool isTargetWindowsCygwin() const {
557  }
558 
559  bool isTargetWindowsGNU() const {
561  }
562 
563  bool isTargetWindowsItanium() const {
565  }
566 
567  bool isTargetCygMing() const { return TargetTriple.isOSCygMing(); }
568 
569  bool isOSWindows() const { return TargetTriple.isOSWindows(); }
570 
571  bool isTargetWin64() const {
572  return In64BitMode && TargetTriple.isOSWindows();
573  }
574 
575  bool isTargetWin32() const {
576  return !In64BitMode && (isTargetCygMing() || isTargetKnownWindowsMSVC());
577  }
578 
579  bool isPICStyleGOT() const { return PICStyle == PICStyles::GOT; }
580  bool isPICStyleRIPRel() const { return PICStyle == PICStyles::RIPRel; }
581 
582  bool isPICStyleStubPIC() const {
583  return PICStyle == PICStyles::StubPIC;
584  }
585 
586  bool isPositionIndependent() const { return TM.isPositionIndependent(); }
587 
589  switch (CC) {
590  // On Win64, all these conventions just use the default convention.
591  case CallingConv::C:
592  case CallingConv::Fast:
598  return isTargetWin64();
599  // This convention allows using the Win64 convention on other targets.
600  case CallingConv::Win64:
601  return true;
602  // This convention allows using the SysV convention on Windows targets.
604  return false;
605  // Otherwise, who knows what this is.
606  default:
607  return false;
608  }
609  }
610 
611  /// Classify a global variable reference for the current subtarget according
612  /// to how we should reference it in a non-pcrel context.
613  unsigned char classifyLocalReference(const GlobalValue *GV) const;
614 
615  unsigned char classifyGlobalReference(const GlobalValue *GV,
616  const Module &M) const;
617  unsigned char classifyGlobalReference(const GlobalValue *GV) const;
618 
619  /// Classify a global function reference for the current subtarget.
620  unsigned char classifyGlobalFunctionReference(const GlobalValue *GV,
621  const Module &M) const;
622  unsigned char classifyGlobalFunctionReference(const GlobalValue *GV) const;
623 
624  /// Classify a blockaddress reference for the current subtarget according to
625  /// how we should reference it in a non-pcrel context.
626  unsigned char classifyBlockAddressReference() const;
627 
628  /// Return true if the subtarget allows calls to immediate address.
629  bool isLegalToCallImmediateAddr() const;
630 
631  /// This function returns the name of a function which has an interface
632  /// like the non-standard bzero function, if such a function exists on
633  /// the current subtarget and it is considered prefereable over
634  /// memset with zero passed as the second argument. Otherwise it
635  /// returns null.
636  const char *getBZeroEntry() const;
637 
638  /// This function returns true if the target has sincos() routine in its
639  /// compiler runtime or math libraries.
640  bool hasSinCos() const;
641 
642  /// Enable the MachineScheduler pass for all X86 subtargets.
643  bool enableMachineScheduler() const override { return true; }
644 
645  // TODO: Update the regression tests and return true.
646  bool supportPrintSchedInfo() const override { return false; }
647 
648  bool enableEarlyIfConversion() const override;
649 
650  /// Return the instruction itineraries based on the subtarget selection.
651  const InstrItineraryData *getInstrItineraryData() const override {
652  return &InstrItins;
653  }
654 
655  AntiDepBreakMode getAntiDepBreakMode() const override {
656  return TargetSubtargetInfo::ANTIDEP_CRITICAL;
657  }
658 };
659 
660 } // end namespace llvm
661 
662 #endif // LLVM_LIB_TARGET_X86_X86SUBTARGET_H
bool hasIFMA() const
Definition: X86Subtarget.h:466
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
unsigned getMaxInlineSizeThreshold() const
Returns the maximum memset / memcpy size that still makes it profitable to inline the call...
Definition: X86Subtarget.h:377
bool HasPRFCHW
Processor has PRFCHW instructions.
Definition: X86Subtarget.h:167
const X86RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
Definition: X86InstrInfo.h:187
bool hasF16C() const
Definition: X86Subtarget.h:460
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
Definition: CallingConv.h:144
bool HasFXSR
Target has FXSAVE/FXRESTOR instructions.
Definition: X86Subtarget.h:98
bool HasTBM
Target has TBM instructions.
Definition: X86Subtarget.h:125
bool hasDQI() const
Definition: X86Subtarget.h:503
bool HasBMI2
Processor has BMI2 instructions.
Definition: X86Subtarget.h:149
bool hasFastVectorFSQRT() const
Definition: X86Subtarget.h:487
The goal of this helper class is to gather the accessor to all the APIs related to GlobalISel...
Definition: GISelAccessor.h:29
bool hasSSE3() const
Definition: X86Subtarget.h:429
bool supportPrintSchedInfo() const override
Definition: X86Subtarget.h:646
bool slow3OpsLEA() const
Definition: X86Subtarget.h:497
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:566
bool isTargetWindowsCygwin() const
Definition: X86Subtarget.h:555
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:587
bool HasSGX
Processor has Software Guard Extensions.
Definition: X86Subtarget.h:292
const CallLowering * getCallLowering() const override
Methods used by Global ISel.
bool hasX87() const
Definition: X86Subtarget.h:425
bool hasPFI() const
Definition: X86Subtarget.h:501
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
bool HasLAHFSAHF
Processor has LAHF/SAHF instructions.
Definition: X86Subtarget.h:173
bool hasXSAVES() const
Definition: X86Subtarget.h:448
bool isTargetCygMing() const
Definition: X86Subtarget.h:567
bool hasFastSHLDRotate() const
Definition: X86Subtarget.h:489
const X86InstrInfo * getInstrInfo() const override
Definition: X86Subtarget.h:356
bool HasCDI
Processor has AVX-512 Conflict Detection Instructions.
Definition: X86Subtarget.h:271
bool slowIncDec() const
Definition: X86Subtarget.h:498
bool HasAES
Target has AES instructions.
Definition: X86Subtarget.h:95
bool isTargetMachO() const
Definition: X86Subtarget.h:531
const X86FrameLowering * getFrameLowering() const override
Definition: X86Subtarget.h:358
void setPICStyle(PICStyles::Style Style)
Definition: X86Subtarget.h:423
const TargetMachine & TM
Definition: X86Subtarget.h:70
bool isTargetPS4() const
Definition: X86Subtarget.h:527
bool HasERI
Processor has AVX-512 Exponential and Reciprocal Instructions.
Definition: X86Subtarget.h:268
bool enableMachineScheduler() const override
Enable the MachineScheduler pass for all X86 subtargets.
Definition: X86Subtarget.h:643
bool hasFMA4() const
Definition: X86Subtarget.h:453
bool hasFSGSBase() const
Definition: X86Subtarget.h:461
bool hasBMI() const
Definition: X86Subtarget.h:463
unsigned MaxInlineSizeThreshold
Max.
Definition: X86Subtarget.h:309
bool hasXSAVEOPT() const
Definition: X86Subtarget.h:446
bool HasERMSB
True if the processor has enhanced REP MOVSB/STOSB.
Definition: X86Subtarget.h:239
bool LEAUsesAG
True if the LEA instruction inputs have to be ready at address generation (AG) time.
Definition: X86Subtarget.h:251
bool HasVPOPCNTDQ
Processor has AVX-512 population count Instructions.
Definition: X86Subtarget.h:274
const LegalizerInfo * getLegalizerInfo() const override
bool hasVLX() const
Definition: X86Subtarget.h:505
bool isTargetKnownWindowsMSVC() const
Definition: X86Subtarget.h:547
bool HasFastScalarFSQRT
True if hardware SQRTSS instruction is at least as fast (latency) as RSQRTSS followed by a Newton-Rap...
Definition: X86Subtarget.h:218
bool hasSSE41() const
Definition: X86Subtarget.h:431
bool IsUAMem32Slow
True if unaligned memory accesses of 32-bytes are slow.
Definition: X86Subtarget.h:198
bool HasLWP
Target has LWP instructions.
Definition: X86Subtarget.h:128
bool isTargetWindowsCoreCLR() const
Definition: X86Subtarget.h:551
bool isOSIAMCU() const
Definition: Triple.h:496
bool isOSDragonFly() const
Definition: Triple.h:486
X86_ThisCall - Similar to X86_StdCall.
Definition: CallingConv.h:111
bool IsPMULLDSlow
True if the PMULLD instruction is slow compared to PMULLW/PMULHW and.
Definition: X86Subtarget.h:192
bool HasRDRAND
True if the processor has the RDRAND instruction.
Definition: X86Subtarget.h:134
bool hasRDSEED() const
Definition: X86Subtarget.h:471
bool hasBWI() const
Definition: X86Subtarget.h:504
bool hasCmpxchg16b() const
Definition: X86Subtarget.h:481
bool hasPCLMUL() const
Definition: X86Subtarget.h:449
bool hasLAHFSAHF() const
Definition: X86Subtarget.h:472
bool HasFastPartialYMMorZMMWrite
True if there is no performance penalty to writing only the lower parts of a YMM or ZMM register with...
Definition: X86Subtarget.h:214
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:610
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:551
bool HasCLWB
Processor supports Cache Line Write Back instruction.
Definition: X86Subtarget.h:298
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:540
bool HasFMA
Target has 3-operand fused multiply-add.
Definition: X86Subtarget.h:116
bool HasFastVectorFSQRT
True if hardware SQRTPS/VSQRTPS instructions are at least as fast (throughput) as RSQRTPS/VRSQRTPS fo...
Definition: X86Subtarget.h:222
bool isTargetFuchsia() const
Definition: X86Subtarget.h:541
bool isTargetNaCl64() const
Definition: X86Subtarget.h:539
Holds all the information related to register banks.
void setGISelAccessor(GISelAccessor &GISel)
This object will take onwership of GISelAccessor.
Definition: X86Subtarget.h:350
bool isTargetAndroid() const
Definition: X86Subtarget.h:536
bool is16Bit() const
Definition: X86Subtarget.h:406
bool isTargetSolaris() const
Definition: X86Subtarget.h:526
bool hasERMSB() const
Definition: X86Subtarget.h:490
const InstrItineraryData * getInstrItineraryData() const override
Return the instruction itineraries based on the subtarget selection.
Definition: X86Subtarget.h:651
bool hasVBMI() const
Definition: X86Subtarget.h:465
PICStyles::Style getPICStyle() const
Definition: X86Subtarget.h:422
bool isTargetDarwin() const
Definition: X86Subtarget.h:523
bool HasCLFLUSHOPT
Processor supports Flush Cache Line instruction.
Definition: X86Subtarget.h:295
bool HasPOPCNT
True if the processor supports POPCNT.
Definition: X86Subtarget.h:89
bool HasPKU
Processor has PKU extenstions.
Definition: X86Subtarget.h:286
bool isTargetGlibc() const
Definition: X86Subtarget.h:535
const InstructionSelector * getInstructionSelector() const override
bool hasAES() const
Definition: X86Subtarget.h:443
bool hasMPX() const
Definition: X86Subtarget.h:507
bool hasSHA() const
Definition: X86Subtarget.h:469
const Triple & getTargetTriple() const
Definition: X86Subtarget.h:521
bool HasSlowDivide32
True if 8-bit divisions are significantly faster than 32-bit divisions and should be used when possib...
Definition: X86Subtarget.h:226
bool isTargetWindowsItanium() const
Definition: X86Subtarget.h:563
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
Definition: CallingConv.h:158
unsigned getStackAlignment() const
Returns the minimum alignment known to hold of the stack frame on entry to the function and which mus...
Definition: X86Subtarget.h:373
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:512
bool hasMMX() const
Definition: X86Subtarget.h:439
bool hasADX() const
Definition: X86Subtarget.h:468
bool HasPFI
Processor has AVX-512 PreFetch Instructions.
Definition: X86Subtarget.h:265
bool hasLZCNT() const
Definition: X86Subtarget.h:462
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:561
bool hasFastLZCNT() const
Definition: X86Subtarget.h:488
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:556
bool HasIFMA
Processor has Integer Fused Multiply Add.
Definition: X86Subtarget.h:155
bool hasTBM() const
Definition: X86Subtarget.h:456
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
Definition: X86Subtarget.h:398
bool HasCmpxchg16b
True if this processor has the CMPXCHG16B instruction; this is true for most x86-64 chips...
Definition: X86Subtarget.h:206
bool isTargetWindowsGNU() const
Definition: X86Subtarget.h:559
bool isPICStyleRIPRel() const
Definition: X86Subtarget.h:580
bool slowLEA() const
Definition: X86Subtarget.h:496
bool HasX87
True if the processor supports X87 instructions.
Definition: X86Subtarget.h:79
bool isTargetMCU() const
Definition: X86Subtarget.h:540
Itinerary data supplied by a subtarget to be used by a target.
bool hasSSSE3() const
Definition: X86Subtarget.h:430
bool UseLeaForSP
True if the LEA instruction should be used for adjusting the stack pointer.
Definition: X86Subtarget.h:210
X863DNowEnum X863DNowLevel
MMX, 3DNow, 3DNow Athlon, or none supported.
Definition: X86Subtarget.h:76
bool HasSSE4A
True if the processor supports SSE4A instructions.
Definition: X86Subtarget.h:92
bool CallRegIndirect
True if the Calls with memory reference should be converted to a register-based indirect call...
Definition: X86Subtarget.h:247
bool HasLZCNT
Processor has LZCNT instruction.
Definition: X86Subtarget.h:143
bool HasF16C
Processor has 16-bit floating point conversion instructions.
Definition: X86Subtarget.h:137
bool SlowIncDec
True if INC and DEC instructions are slow when writing to flags.
Definition: X86Subtarget.h:262
bool hasSSE2() const
Definition: X86Subtarget.h:428
const X86TargetLowering * getTargetLowering() const override
Definition: X86Subtarget.h:352
X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS, const X86TargetMachine &TM, unsigned StackAlignOverride)
This constructor initializes the data members to match that of the specified triple.
bool useSoftFloat() const
Definition: X86Subtarget.h:514
bool hasSSEUnalignedMem() const
Definition: X86Subtarget.h:480
bool hasAnyFMA() const
Definition: X86Subtarget.h:454
bool isCallingConvWin64(CallingConv::ID CC) const
Definition: X86Subtarget.h:588
bool hasBMI2() const
Definition: X86Subtarget.h:464
bool isWindowsGNUEnvironment() const
Definition: Triple.h:535
bool isTargetCOFF() const
Definition: X86Subtarget.h:530
bool HasMWAITX
Processor has MONITORX/MWAITX instructions.
Definition: X86Subtarget.h:176
bool HasPFPREFETCHWT1
Processor has Prefetch with intent to Write instruction.
Definition: X86Subtarget.h:182
bool hasSinCos() const
This function returns true if the target has sincos() routine in its compiler runtime or math librari...
bool isPICStyleStubPIC() const
Definition: X86Subtarget.h:582
bool IsBTMemSlow
True if BT (bit test) of memory instructions are slow.
Definition: X86Subtarget.h:185
bool useLeaForSP() const
Definition: X86Subtarget.h:482
bool HasADX
Processor has ADX instructions.
Definition: X86Subtarget.h:161
bool HasBWI
Processor has AVX-512 Byte and Word instructions.
Definition: X86Subtarget.h:280
bool isXRaySupported() const override
Definition: X86Subtarget.h:510
bool isPositionIndependent() const
Definition: X86Subtarget.h:586
bool hasAVX2() const
Definition: X86Subtarget.h:434
bool isTargetWin32() const
Definition: X86Subtarget.h:575
bool hasSlowDivide64() const
Definition: X86Subtarget.h:492
bool HasFastSHLDRotate
True if SHLD based rotate is fast.
Definition: X86Subtarget.h:236
std::unique_ptr< GISelAccessor > GISel
Gather the accessor points to GlobalISel-related APIs.
Definition: X86Subtarget.h:320
bool hasFastPartialYMMorZMMWrite() const
Definition: X86Subtarget.h:483
bool hasMOVBE() const
Definition: X86Subtarget.h:458
bool isOSFuchsia() const
Definition: Triple.h:482
bool isPositionIndependent() const
PICStyles::Style PICStyle
Which PIC style to use.
Definition: X86Subtarget.h:68
bool hasFp256() const
Definition: X86Subtarget.h:436
bool HasXOP
Target has XOP instructions.
Definition: X86Subtarget.h:122
bool hasPKU() const
Definition: X86Subtarget.h:506
bool SlowLEA
True if the LEA instruction with certain arguments is slow.
Definition: X86Subtarget.h:254
bool HasDQI
Processor has AVX-512 Doubleword and Quadword instructions.
Definition: X86Subtarget.h:277
bool enableEarlyIfConversion() const override
unsigned char classifyLocalReference(const GlobalValue *GV) const
Classify a global variable reference for the current subtarget according to how we should reference i...
bool has3DNowA() const
Definition: X86Subtarget.h:441
bool isSHLDSlow() const
Definition: X86Subtarget.h:476
X86_FastCall - 'fast' analog of X86_StdCall.
Definition: CallingConv.h:92
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:582
bool isWindowsCoreCLREnvironment() const
Definition: Triple.h:523
bool isOSWindows() const
Definition: X86Subtarget.h:569
bool IsSHLDSlow
True if SHLD instructions are slow.
Definition: X86Subtarget.h:188
bool isPICStyleGOT() const
Definition: X86Subtarget.h:579
InstrItineraryData InstrItins
Instruction itineraries for scheduling.
Definition: X86Subtarget.h:315
bool hasMWAITX() const
Definition: X86Subtarget.h:473
bool HasFSGSBase
Processor has FS/GS base insturctions.
Definition: X86Subtarget.h:140
unsigned char classifyBlockAddressReference() const
Classify a blockaddress reference for the current subtarget according to how we should reference it i...
bool IsUAMem16Slow
True if unaligned memory accesses of 16-bytes are slow.
Definition: X86Subtarget.h:195
bool hasRDRAND() const
Definition: X86Subtarget.h:459
bool isOSSolaris() const
Definition: Triple.h:488
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool hasXOP() const
Definition: X86Subtarget.h:455
bool hasXSAVE() const
Definition: X86Subtarget.h:445
const X86RegisterInfo * getRegisterInfo() const override
Definition: X86Subtarget.h:366
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:466
bool hasSSE4A() const
Definition: X86Subtarget.h:438
Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins.
Definition: CallingConv.h:140
bool HasMPX
Processor supports MPX - Memory Protection Extensions.
Definition: X86Subtarget.h:289
X86ProcFamilyEnum X86ProcFamily
X86 processor family: Intel Atom, and others.
Definition: X86Subtarget.h:65
bool HasX86_64
True if the processor supports X86-64 instructions.
Definition: X86Subtarget.h:86
bool HasSSEUnalignedMem
True if SSE operations can have unaligned memory operands.
Definition: X86Subtarget.h:202
bool isTargetWindowsMSVC() const
Definition: X86Subtarget.h:543
unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, const Module &M) const
Classify a global function reference for the current subtarget.
bool HasXSAVES
Target has XSAVES instructions.
Definition: X86Subtarget.h:110
X86_StdCall - stdcall is the calling conventions mostly used by the Win32 API.
Definition: CallingConv.h:87
bool isTarget64BitILP32() const
Is this x86_64 with the ILP32 programming model (x32 ABI)?
Definition: X86Subtarget.h:411
bool isTargetELF() const
Definition: X86Subtarget.h:529
bool HasSHA
Processor has SHA instructions.
Definition: X86Subtarget.h:164
bool HasBMI
Processor has BMI1 instructions.
Definition: X86Subtarget.h:146
bool hasFXSR() const
Definition: X86Subtarget.h:444
bool isUnalignedMem32Slow() const
Definition: X86Subtarget.h:479
bool isTargetLinux() const
Definition: X86Subtarget.h:533
bool HasVBMI
Processor has VBMI instructions.
Definition: X86Subtarget.h:152
bool Slow3OpsLEA
True if the LEA instruction has all three source operands: base, index, and offset or if the LEA inst...
Definition: X86Subtarget.h:259
bool hasCDI() const
Definition: X86Subtarget.h:499
C - The default llvm calling convention, compatible with C.
Definition: CallingConv.h:35
bool has3DNow() const
Definition: X86Subtarget.h:440
bool UseSoftFloat
Use software floating point for code generation.
Definition: X86Subtarget.h:301
bool hasInt256() const
Definition: X86Subtarget.h:437
bool hasCMov() const
Definition: X86Subtarget.h:426
bool isTargetDragonFly() const
Definition: X86Subtarget.h:525
bool hasPOPCNT() const
Definition: X86Subtarget.h:442
bool hasSSE1() const
Definition: X86Subtarget.h:427
The C convention as implemented on Windows/x86-64 and AArch64.
Definition: CallingConv.h:154
bool HasPCLMUL
Target has carry-less multiplication.
Definition: X86Subtarget.h:113
bool hasPRFCHW() const
Definition: X86Subtarget.h:470
Provides the logic to select generic machine instructions.
bool isAtom() const
Definition: X86Subtarget.h:512
bool hasFastScalarFSQRT() const
Definition: X86Subtarget.h:486
bool is32Bit() const
Definition: X86Subtarget.h:402
bool isBTMemSlow() const
Definition: X86Subtarget.h:475
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:577
const X86SelectionDAGInfo * getSelectionDAGInfo() const override
Definition: X86Subtarget.h:362
bool HasXSAVEOPT
Target has XSAVEOPT instructions.
Definition: X86Subtarget.h:104
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:571
bool hasSSE42() const
Definition: X86Subtarget.h:432
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:531
bool isTarget64BitLP64() const
Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
Definition: X86Subtarget.h:417
X86SSEEnum X86SSELevel
SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or none supported.
Definition: X86Subtarget.h:73
unsigned char classifyGlobalReference(const GlobalValue *GV, const Module &M) const
bool hasAVX512() const
Definition: X86Subtarget.h:435
bool LEAusesAG() const
Definition: X86Subtarget.h:495
Fast - This calling convention attempts to make calls as fast as possible (e.g.
Definition: CallingConv.h:43
bool isPS4CPU() const
Tests whether the target is the PS4 CPU.
Definition: Triple.h:597
bool HasXSAVE
Target has XSAVE instructions.
Definition: X86Subtarget.h:101
bool isUnalignedMem16Slow() const
Definition: X86Subtarget.h:478
bool hasVPOPCNTDQ() const
Definition: X86Subtarget.h:500
bool isOSFreeBSD() const
Definition: Triple.h:478
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:299
bool hasLWP() const
Definition: X86Subtarget.h:457
bool hasRTM() const
Definition: X86Subtarget.h:467
bool HasCMov
True if this processor has conditional move instructions (generally pentium pro+).
Definition: X86Subtarget.h:83
bool isTargetWin64() const
Definition: X86Subtarget.h:571
bool isSLM() const
Definition: X86Subtarget.h:513
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Definition: Triple.h:519
bool HasFMA4
Target has 4-operand fused multiply-add.
Definition: X86Subtarget.h:119
bool HasRTM
Processor has RTM instructions.
Definition: X86Subtarget.h:158
bool hasCLFLUSHOPT() const
Definition: X86Subtarget.h:508
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:527
bool isTargetFreeBSD() const
Definition: X86Subtarget.h:524
const RegisterBankInfo * getRegBankInfo() const override
bool HasXSAVEC
Target has XSAVEC instructions.
Definition: X86Subtarget.h:107
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:56
bool HasVLX
Processor has AVX-512 Vector Length eXtenstions.
Definition: X86Subtarget.h:283
bool HasFastLZCNT
True if LZCNT instruction is fast.
Definition: X86Subtarget.h:233
const char * getBZeroEntry() const
This function returns the name of a function which has an interface like the non-standard bzero funct...
bool padShortFunctions() const
Definition: X86Subtarget.h:493
bool hasERI() const
Definition: X86Subtarget.h:502
bool callRegIndirect() const
Definition: X86Subtarget.h:494
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool HasRDSEED
Processor has RDSEED instructions.
Definition: X86Subtarget.h:170
AntiDepBreakMode getAntiDepBreakMode() const override
Definition: X86Subtarget.h:655
unsigned stackAlignment
The minimum alignment known to hold of the stack frame on entry to the function and which must be mai...
Definition: X86Subtarget.h:305
bool hasMFence() const
Use mfence if we have SSE2 or we're on x86-64 (even if we asked for no-sse2).
Definition: X86Subtarget.h:519
bool isTargetKFreeBSD() const
Definition: X86Subtarget.h:534
bool hasFMA() const
Definition: X86Subtarget.h:452
bool hasCLZERO() const
Definition: X86Subtarget.h:474
bool isTargetNaCl32() const
Definition: X86Subtarget.h:538
bool isPMULLDSlow() const
Definition: X86Subtarget.h:477
Triple TargetTriple
What processor and OS we're targeting.
Definition: X86Subtarget.h:312
bool isLegalToCallImmediateAddr() const
Return true if the subtarget allows calls to immediate address.
bool HasMOVBE
True if the processor has the MOVBE instruction.
Definition: X86Subtarget.h:131
bool PadShortFunctions
True if the short functions should be padded to prevent a stall when returning too early...
Definition: X86Subtarget.h:243
bool hasAVX() const
Definition: X86Subtarget.h:433
bool HasCLZERO
Processor has Cache Line Zero instruction.
Definition: X86Subtarget.h:179
bool hasXSAVEC() const
Definition: X86Subtarget.h:447
bool hasSlowDivide32() const
Definition: X86Subtarget.h:491
bool isTargetNaCl() const
Definition: X86Subtarget.h:537
bool HasSlowDivide64
True if 32-bit divides are significantly faster than 64-bit divisions and should be used when possibl...
Definition: X86Subtarget.h:230