LLVM  10.0.0
X86TargetMachine.cpp
Go to the documentation of this file.
1 //===-- X86TargetMachine.cpp - Define TargetMachine for the X86 -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the X86 specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "X86TargetMachine.h"
16 #include "X86.h"
17 #include "X86CallLowering.h"
18 #include "X86LegalizerInfo.h"
19 #include "X86MacroFusion.h"
20 #include "X86Subtarget.h"
21 #include "X86TargetObjectFile.h"
22 #include "X86TargetTransformInfo.h"
23 #include "llvm/ADT/Optional.h"
24 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/ADT/SmallString.h"
26 #include "llvm/ADT/StringRef.h"
27 #include "llvm/ADT/Triple.h"
36 #include "llvm/CodeGen/Passes.h"
38 #include "llvm/IR/Attributes.h"
39 #include "llvm/IR/DataLayout.h"
40 #include "llvm/IR/Function.h"
41 #include "llvm/MC/MCAsmInfo.h"
42 #include "llvm/Pass.h"
43 #include "llvm/Support/CodeGen.h"
50 #include <memory>
51 #include <string>
52 
53 using namespace llvm;
54 
55 static cl::opt<bool> EnableMachineCombinerPass("x86-machine-combiner",
56  cl::desc("Enable the machine combiner pass"),
57  cl::init(true), cl::Hidden);
58 
59 static cl::opt<bool> EnableCondBrFoldingPass("x86-condbr-folding",
60  cl::desc("Enable the conditional branch "
61  "folding pass"),
62  cl::init(false), cl::Hidden);
63 
65  // Register the target.
68 
86 }
87 
88 static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
89  if (TT.isOSBinFormatMachO()) {
90  if (TT.getArch() == Triple::x86_64)
91  return std::make_unique<X86_64MachoTargetObjectFile>();
92  return std::make_unique<TargetLoweringObjectFileMachO>();
93  }
94 
95  if (TT.isOSFreeBSD())
96  return std::make_unique<X86FreeBSDTargetObjectFile>();
97  if (TT.isOSLinux() || TT.isOSNaCl() || TT.isOSIAMCU())
98  return std::make_unique<X86LinuxNaClTargetObjectFile>();
99  if (TT.isOSSolaris())
100  return std::make_unique<X86SolarisTargetObjectFile>();
101  if (TT.isOSFuchsia())
102  return std::make_unique<X86FuchsiaTargetObjectFile>();
103  if (TT.isOSBinFormatELF())
104  return std::make_unique<X86ELFTargetObjectFile>();
105  if (TT.isOSBinFormatCOFF())
106  return std::make_unique<TargetLoweringObjectFileCOFF>();
107  llvm_unreachable("unknown subtarget type");
108 }
109 
110 static std::string computeDataLayout(const Triple &TT) {
111  // X86 is little endian
112  std::string Ret = "e";
113 
115  // X86 and x32 have 32 bit pointers.
116  if ((TT.isArch64Bit() &&
117  (TT.getEnvironment() == Triple::GNUX32 || TT.isOSNaCl())) ||
118  !TT.isArch64Bit())
119  Ret += "-p:32:32";
120 
121  // Address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers.
122  Ret += "-p270:32:32-p271:32:32-p272:64:64";
123 
124  // Some ABIs align 64 bit integers and doubles to 64 bits, others to 32.
125  if (TT.isArch64Bit() || TT.isOSWindows() || TT.isOSNaCl())
126  Ret += "-i64:64";
127  else if (TT.isOSIAMCU())
128  Ret += "-i64:32-f64:32";
129  else
130  Ret += "-f64:32:64";
131 
132  // Some ABIs align long double to 128 bits, others to 32.
133  if (TT.isOSNaCl() || TT.isOSIAMCU())
134  ; // No f80
135  else if (TT.isArch64Bit() || TT.isOSDarwin())
136  Ret += "-f80:128";
137  else
138  Ret += "-f80:32";
139 
140  if (TT.isOSIAMCU())
141  Ret += "-f128:32";
142 
143  // The registers can hold 8, 16, 32 or, in x86-64, 64 bits.
144  if (TT.isArch64Bit())
145  Ret += "-n8:16:32:64";
146  else
147  Ret += "-n8:16:32";
148 
149  // The stack is aligned to 32 bits on some ABIs and 128 bits on others.
150  if ((!TT.isArch64Bit() && TT.isOSWindows()) || TT.isOSIAMCU())
151  Ret += "-a:0:32-S32";
152  else
153  Ret += "-S128";
154 
155  return Ret;
156 }
157 
159  bool JIT,
161  bool is64Bit = TT.getArch() == Triple::x86_64;
162  if (!RM.hasValue()) {
163  // JIT codegen should use static relocations by default, since it's
164  // typically executed in process and not relocatable.
165  if (JIT)
166  return Reloc::Static;
167 
168  // Darwin defaults to PIC in 64 bit mode and dynamic-no-pic in 32 bit mode.
169  // Win64 requires rip-rel addressing, thus we force it to PIC. Otherwise we
170  // use static relocation model by default.
171  if (TT.isOSDarwin()) {
172  if (is64Bit)
173  return Reloc::PIC_;
174  return Reloc::DynamicNoPIC;
175  }
176  if (TT.isOSWindows() && is64Bit)
177  return Reloc::PIC_;
178  return Reloc::Static;
179  }
180 
181  // ELF and X86-64 don't have a distinct DynamicNoPIC model. DynamicNoPIC
182  // is defined as a model for code which may be used in static or dynamic
183  // executables but not necessarily a shared library. On X86-32 we just
184  // compile in -static mode, in x86-64 we use PIC.
185  if (*RM == Reloc::DynamicNoPIC) {
186  if (is64Bit)
187  return Reloc::PIC_;
188  if (!TT.isOSDarwin())
189  return Reloc::Static;
190  }
191 
192  // If we are on Darwin, disallow static relocation model in X86-64 mode, since
193  // the Mach-O file format doesn't support it.
194  if (*RM == Reloc::Static && TT.isOSDarwin() && is64Bit)
195  return Reloc::PIC_;
196 
197  return *RM;
198 }
199 
201  bool JIT, bool Is64Bit) {
202  if (CM) {
203  if (*CM == CodeModel::Tiny)
204  report_fatal_error("Target does not support the tiny CodeModel", false);
205  return *CM;
206  }
207  if (JIT)
208  return Is64Bit ? CodeModel::Large : CodeModel::Small;
209  return CodeModel::Small;
210 }
211 
212 /// Create an X86 target.
213 ///
215  StringRef CPU, StringRef FS,
216  const TargetOptions &Options,
219  CodeGenOpt::Level OL, bool JIT)
221  T, computeDataLayout(TT), TT, CPU, FS, Options,
222  getEffectiveRelocModel(TT, JIT, RM),
223  getEffectiveX86CodeModel(CM, JIT, TT.getArch() == Triple::x86_64),
224  OL),
225  TLOF(createTLOF(getTargetTriple())) {
226  // On PS4, the "return address" of a 'noreturn' call must still be within
227  // the calling function, and TrapUnreachable is an easy way to get that.
228  if (TT.isPS4() || TT.isOSBinFormatMachO()) {
229  this->Options.TrapUnreachable = true;
230  this->Options.NoTrapAfterNoreturn = TT.isOSBinFormatMachO();
231  }
232 
233  setMachineOutliner(true);
234 
235  initAsmInfo();
236 }
237 
239 
240 const X86Subtarget *
242  Attribute CPUAttr = F.getFnAttribute("target-cpu");
243  Attribute FSAttr = F.getFnAttribute("target-features");
244 
245  StringRef CPU = !CPUAttr.hasAttribute(Attribute::None)
246  ? CPUAttr.getValueAsString()
247  : (StringRef)TargetCPU;
249  ? FSAttr.getValueAsString()
250  : (StringRef)TargetFS;
251 
253  Key.reserve(CPU.size() + FS.size());
254  Key += CPU;
255  Key += FS;
256 
257  // FIXME: This is related to the code below to reset the target options,
258  // we need to know whether or not the soft float flag is set on the
259  // function before we can generate a subtarget. We also need to use
260  // it as a key for the subtarget since that can be the only difference
261  // between two functions.
262  bool SoftFloat =
263  F.getFnAttribute("use-soft-float").getValueAsString() == "true";
264  // If the soft float attribute is set on the function turn on the soft float
265  // subtarget feature.
266  if (SoftFloat)
267  Key += FS.empty() ? "+soft-float" : ",+soft-float";
268 
269  // Keep track of the key width after all features are added so we can extract
270  // the feature string out later.
271  unsigned CPUFSWidth = Key.size();
272 
273  // Extract prefer-vector-width attribute.
274  unsigned PreferVectorWidthOverride = 0;
275  if (F.hasFnAttribute("prefer-vector-width")) {
276  StringRef Val = F.getFnAttribute("prefer-vector-width").getValueAsString();
277  unsigned Width;
278  if (!Val.getAsInteger(0, Width)) {
279  Key += ",prefer-vector-width=";
280  Key += Val;
281  PreferVectorWidthOverride = Width;
282  }
283  }
284 
285  // Extract min-legal-vector-width attribute.
286  unsigned RequiredVectorWidth = UINT32_MAX;
287  if (F.hasFnAttribute("min-legal-vector-width")) {
288  StringRef Val =
289  F.getFnAttribute("min-legal-vector-width").getValueAsString();
290  unsigned Width;
291  if (!Val.getAsInteger(0, Width)) {
292  Key += ",min-legal-vector-width=";
293  Key += Val;
294  RequiredVectorWidth = Width;
295  }
296  }
297 
298  // Extracted here so that we make sure there is backing for the StringRef. If
299  // we assigned earlier, its possible the SmallString reallocated leaving a
300  // dangling StringRef.
301  FS = Key.slice(CPU.size(), CPUFSWidth);
302 
303  auto &I = SubtargetMap[Key];
304  if (!I) {
305  // This needs to be done before we create a new subtarget since any
306  // creation will depend on the TM and the code generation flags on the
307  // function that reside in TargetOptions.
309  I = std::make_unique<X86Subtarget>(
310  TargetTriple, CPU, FS, *this,
311  MaybeAlign(Options.StackAlignmentOverride), PreferVectorWidthOverride,
312  RequiredVectorWidth);
313  }
314  return I.get();
315 }
316 
317 //===----------------------------------------------------------------------===//
318 // Command line options for x86
319 //===----------------------------------------------------------------------===//
320 static cl::opt<bool>
321 UseVZeroUpper("x86-use-vzeroupper", cl::Hidden,
322  cl::desc("Minimize AVX to SSE transition penalty"),
323  cl::init(true));
324 
325 //===----------------------------------------------------------------------===//
326 // X86 TTI query.
327 //===----------------------------------------------------------------------===//
328 
331  return TargetTransformInfo(X86TTIImpl(this, F));
332 }
333 
334 //===----------------------------------------------------------------------===//
335 // Pass Pipeline Configuration
336 //===----------------------------------------------------------------------===//
337 
338 namespace {
339 
340 /// X86 Code Generator Pass Configuration Options.
341 class X86PassConfig : public TargetPassConfig {
342 public:
343  X86PassConfig(X86TargetMachine &TM, PassManagerBase &PM)
344  : TargetPassConfig(TM, PM) {}
345 
346  X86TargetMachine &getX86TargetMachine() const {
347  return getTM<X86TargetMachine>();
348  }
349 
351  createMachineScheduler(MachineSchedContext *C) const override {
354  return DAG;
355  }
356 
358  createPostMachineScheduler(MachineSchedContext *C) const override {
361  return DAG;
362  }
363 
364  void addIRPasses() override;
365  bool addInstSelector() override;
366  bool addIRTranslator() override;
367  bool addLegalizeMachineIR() override;
368  bool addRegBankSelect() override;
369  bool addGlobalInstructionSelect() override;
370  bool addILPOpts() override;
371  bool addPreISel() override;
372  void addMachineSSAOptimization() override;
373  void addPreRegAlloc() override;
374  void addPostRegAlloc() override;
375  void addPreEmitPass() override;
376  void addPreEmitPass2() override;
377  void addPreSched2() override;
378 
379  std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
380 };
381 
382 class X86ExecutionDomainFix : public ExecutionDomainFix {
383 public:
384  static char ID;
385  X86ExecutionDomainFix() : ExecutionDomainFix(ID, X86::VR128XRegClass) {}
386  StringRef getPassName() const override {
387  return "X86 Execution Dependency Fix";
388  }
389 };
391 
392 } // end anonymous namespace
393 
394 INITIALIZE_PASS_BEGIN(X86ExecutionDomainFix, "x86-execution-domain-fix",
395  "X86 Execution Domain Fix", false, false)
397 INITIALIZE_PASS_END(X86ExecutionDomainFix, "x86-execution-domain-fix",
398  "X86 Execution Domain Fix", false, false)
399 
401  return new X86PassConfig(*this, PM);
402 }
403 
404 void X86PassConfig::addIRPasses() {
405  addPass(createAtomicExpandPass());
406 
408 
409  if (TM->getOptLevel() != CodeGenOpt::None)
410  addPass(createInterleavedAccessPass());
411 
412  // Add passes that handle indirect branch removal and insertion of a retpoline
413  // thunk. These will be a no-op unless a function subtarget has the retpoline
414  // feature enabled.
415  addPass(createIndirectBrExpandPass());
416 
417  // Add Control Flow Guard checks.
418  const Triple &TT = TM->getTargetTriple();
419  if (TT.isOSWindows()) {
420  if (TT.getArch() == Triple::x86_64) {
421  addPass(createCFGuardDispatchPass());
422  } else {
423  addPass(createCFGuardCheckPass());
424  }
425  }
426 }
427 
428 bool X86PassConfig::addInstSelector() {
429  // Install an instruction selector.
430  addPass(createX86ISelDag(getX86TargetMachine(), getOptLevel()));
431 
432  // For ELF, cleanup any local-dynamic TLS accesses.
433  if (TM->getTargetTriple().isOSBinFormatELF() &&
436 
437  addPass(createX86GlobalBaseRegPass());
438  return false;
439 }
440 
441 bool X86PassConfig::addIRTranslator() {
442  addPass(new IRTranslator());
443  return false;
444 }
445 
446 bool X86PassConfig::addLegalizeMachineIR() {
447  addPass(new Legalizer());
448  return false;
449 }
450 
451 bool X86PassConfig::addRegBankSelect() {
452  addPass(new RegBankSelect());
453  return false;
454 }
455 
456 bool X86PassConfig::addGlobalInstructionSelect() {
457  addPass(new InstructionSelect());
458  return false;
459 }
460 
461 bool X86PassConfig::addILPOpts() {
463  addPass(createX86CondBrFolding());
464  addPass(&EarlyIfConverterID);
466  addPass(&MachineCombinerID);
467  addPass(createX86CmovConverterPass());
468  return true;
469 }
470 
471 bool X86PassConfig::addPreISel() {
472  // Only add this pass for 32-bit x86 Windows.
473  const Triple &TT = TM->getTargetTriple();
474  if (TT.isOSWindows() && TT.getArch() == Triple::x86)
475  addPass(createX86WinEHStatePass());
476  return true;
477 }
478 
479 void X86PassConfig::addPreRegAlloc() {
480  if (getOptLevel() != CodeGenOpt::None) {
481  addPass(&LiveRangeShrinkID);
482  addPass(createX86FixupSetCC());
483  addPass(createX86OptimizeLEAs());
486  }
487 
490  addPass(createX86WinAllocaExpander());
491 }
492 void X86PassConfig::addMachineSSAOptimization() {
495 }
496 
497 void X86PassConfig::addPostRegAlloc() {
499 }
500 
501 void X86PassConfig::addPreSched2() { addPass(createX86ExpandPseudoPass()); }
502 
503 void X86PassConfig::addPreEmitPass() {
504  if (getOptLevel() != CodeGenOpt::None) {
505  addPass(new X86ExecutionDomainFix());
506  addPass(createBreakFalseDeps());
507  }
508 
510 
511  if (UseVZeroUpper)
512  addPass(createX86IssueVZeroUpperPass());
513 
514  if (getOptLevel() != CodeGenOpt::None) {
515  addPass(createX86FixupBWInsts());
516  addPass(createX86PadShortFunctions());
517  addPass(createX86FixupLEAs());
518  addPass(createX86EvexToVexInsts());
519  }
521  addPass(createX86InsertPrefetchPass());
522 }
523 
524 void X86PassConfig::addPreEmitPass2() {
525  const Triple &TT = TM->getTargetTriple();
526  const MCAsmInfo *MAI = TM->getMCAsmInfo();
527 
528  addPass(createX86RetpolineThunksPass());
529 
530  // Insert extra int3 instructions after trailing call instructions to avoid
531  // issues in the unwinder.
532  if (TT.isOSWindows() && TT.getArch() == Triple::x86_64)
534 
535  // Verify basic block incoming and outgoing cfa offset and register values and
536  // correct CFA calculation rule where needed by inserting appropriate CFI
537  // instructions.
538  if (!TT.isOSDarwin() &&
539  (!TT.isOSWindows() ||
541  addPass(createCFIInstrInserter());
542  // Identify valid longjmp targets for Windows Control Flow Guard.
543  if (TT.isOSWindows())
544  addPass(createCFGuardLongjmpPass());
545 }
546 
547 std::unique_ptr<CSEConfigBase> X86PassConfig::getCSEConfig() const {
548  return getStandardCSEConfigForOpt(TM->getOptLevel());
549 }
uint64_t CallInst * C
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
Definition: Triple.h:482
char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
FunctionPass * createCFGuardCheckPass()
Insert Control FLow Guard checks on indirect function calls.
Definition: CFGuard.cpp:299
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static cl::opt< bool > EnableMachineCombinerPass("x86-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
FunctionPass * createX86OptimizeLEAs()
Return a pass that removes redundant LEA instructions and redundant address recalculations.
FunctionPass * createX86FixupBWInsts()
Return a Machine IR pass that selectively replaces certain byte and word instructions by equivalent 3...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
This class represents lattice values for constants.
Definition: AllocatorList.h:23
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
FunctionPass * createX86FloatingPointStackifierPass()
This function returns a pass which converts floating-point register references and pseudo instruction...
void initializeFixupBWInstPassPass(PassRegistry &)
void initializeFPSPass(PassRegistry &)
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:624
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
Definition: TargetMachine.h:84
FunctionPass * createX86FixupSetCC()
Return a pass that transforms setcc + movzx pairs into xor + setcc.
This file a TargetTransformInfo::Concept conforming object specific to the X86 target machine...
static std::string computeDataLayout(const Triple &TT)
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:582
char & EarlyIfConverterID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions...
ScheduleDAGMI * createGenericSchedPostRA(MachineSchedContext *C)
Create a generic scheduler with no vreg liveness or DAG mutation passes.
std::unique_ptr< ScheduleDAGMutation > createX86MacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createX86MacroFusionDAGMutation()); to X86PassConfig::crea...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.h:323
FunctionPass * createCFGuardDispatchPass()
Insert Control FLow Guard dispatches on indirect function calls.
Definition: CFGuard.cpp:303
FunctionPass * createX86CallFrameOptimization()
Return a pass that optimizes the code-size of x86 call sequences.
void initializeX86CallFrameOptimizationPass(PassRegistry &)
F(f)
FunctionPass * createX86IssueVZeroUpperPass()
This pass inserts AVX vzeroupper instructions before each call to avoid transition penalty between fu...
bool isOSFuchsia() const
Definition: Triple.h:506
FunctionPass * createX86EvexToVexInsts()
This pass replaces EVEX encoded of AVX-512 instructiosn by VEX encoding when possible in order to red...
void reserve(size_type N)
Definition: SmallVector.h:369
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form...
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
unsigned NoTrapAfterNoreturn
Do not emit a trap instruction for &#39;unreachable&#39; IR instructions behind noreturn calls, even if TrapUnreachable is true.
static const char * getManglingComponent(const Triple &T)
Definition: DataLayout.cpp:151
FunctionPass * createX86DomainReassignmentPass()
Return a Machine IR pass that reassigns instruction chains from one domain to another, when profitable.
void initializeX86CmovConverterPassPass(PassRegistry &)
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
This class provides the reaching def analysis.
FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:50
void resetTargetOptions(const Function &F) const
Reset the target options based on the function&#39;s attributes.
FunctionPass * createX86PadShortFunctions()
Return a pass that pads short functions with NOOPs.
This file contains the simple types necessary to represent the attributes associated with functions a...
No attributes have been set.
Definition: Attributes.h:72
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:147
bool isOSSolaris() const
Definition: Triple.h:512
Target-Independent Code Generator Pass Configuration Options.
void initializeX86AvoidSFBPassPass(PassRegistry &)
Key
PAL metadata keys.
static cl::opt< bool > EnableCondBrFoldingPass("x86-condbr-folding", cl::desc("Enable the conditional branch " "folding pass"), cl::init(false), cl::Hidden)
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Definition: SmallString.h:259
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
void initializeX86CondBrFoldingPassPass(PassRegistry &)
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:297
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
void initializeEvexToVexInstPassPass(PassRegistry &)
FunctionPass * createX86FixupLEAs()
Return a pass that selectively replaces certain instructions (like add, sub, inc, dec...
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:151
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
INITIALIZE_PASS_BEGIN(X86ExecutionDomainFix, "x86-execution-domain-fix", "X86 Execution Domain Fix", false, false) INITIALIZE_PASS_END(X86ExecutionDomainFix
ScheduleDAGMILive * createGenericSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:656
speculative execution
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:539
char & LiveRangeShrinkID
LiveRangeShrink pass.
std::unique_ptr< CSEConfigBase > getStandardCSEConfigForOpt(CodeGenOpt::Level Level)
Definition: CSEInfo.cpp:71
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:435
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Definition: Attributes.cpp:235
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
void initializeX86ExecutionDomainFixPass(PassRegistry &)
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Definition: RegBankSelect.h:90
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:629
FunctionPass * createX86ExpandPseudoPass()
Return a Machine IR pass that expands X86-specific pseudo instructions into a sequence of actual inst...
FunctionPass * createX86GlobalBaseRegPass()
This pass initializes a global base register for PIC on x86-32.
FunctionPass * createInterleavedAccessPass()
InterleavedAccess Pass - This pass identifies and matches interleaved memory accesses to target speci...
FunctionPass * createBreakFalseDeps()
Creates Break False Dependencies pass.
const X86Subtarget * getSubtargetImpl() const =delete
void initializeFixupLEAPassPass(PassRegistry &)
void initializeX86ExpandPseudoPass(PassRegistry &)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
void setMachineOutliner(bool Enable)
x86 execution domain fix
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:634
static CodeModel::Model getEffectiveX86CodeModel(Optional< CodeModel::Model > CM, bool JIT, bool Is64Bit)
size_t size() const
Definition: SmallVector.h:52
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
~X86TargetMachine() override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
void initializeX86DomainReassignmentPass(PassRegistry &)
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
FunctionPass * createIndirectBrExpandPass()
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Definition: StringRef.h:499
bool isOSIAMCU() const
Definition: Triple.h:516
FunctionPass * createX86CmovConverterPass()
This pass converts X86 cmov instructions into branch when profitable.
FunctionPass * createX86IndirectBranchTrackingPass()
This pass inserts ENDBR instructions before indirect jump/call destinations as part of CET IBT mechan...
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
void initializeX86SpeculativeLoadHardeningPassPass(PassRegistry &)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
Definition: Alignment.h:117
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:587
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:315
FunctionPass * createX86FlagsCopyLoweringPass()
Return a pass that lowers EFLAGS copy pseudo instructions.
x86 execution domain X86 Execution Domain Fix
unsigned StackAlignmentOverride
StackAlignmentOverride - Override default stack alignment for target.
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:130
FunctionPass * createX86SpeculativeLoadHardeningPass()
bool isOSFreeBSD() const
Definition: Triple.h:502
This pass is responsible for selecting generic machine instructions to target-specific instructions...
Target - Wrapper for Target specific information.
This file describes how to lower LLVM calls to machine code calls.
std::string TargetCPU
Definition: TargetMachine.h:85
static cl::opt< bool > UseVZeroUpper("x86-use-vzeroupper", cl::Hidden, cl::desc("Minimize AVX to SSE transition penalty"), cl::init(true))
FunctionPass * createX86WinAllocaExpander()
Return a pass that expands WinAlloca pseudo-instructions.
void initializeX86OptimizeLEAPassPass(PassRegistry &)
A ScheduleDAG for scheduling lists of MachineInstr.
bool hasValue() const
Definition: Optional.h:259
X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Create an X86 target.
FunctionPass * createX86InsertPrefetchPass()
This pass applies profiling information to insert cache prefetches.
StringRef getValueAsString() const
Return the attribute&#39;s value as a string.
Definition: Attributes.cpp:220
void initializeX86FlagsCopyLoweringPassPass(PassRegistry &)
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1298
FunctionPass * createX86ISelDag(X86TargetMachine &TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a X86-specific DAG, ready for instruction scheduling...
TargetOptions Options
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86Target()
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
#define I(x, y, z)
Definition: MD5.cpp:58
FunctionPass * createX86AvoidTrailingCallPass()
Return a pass that inserts int3 at the end of the function if it ends with a CALL instruction...
Target & getTheX86_32Target()
FunctionPass * createX86CondBrFolding()
Return a pass that folds conditional branch jumps.
std::string TargetFS
Definition: TargetMachine.h:86
FunctionPass * createX86RetpolineThunksPass()
This pass creates the thunks for the retpoline feature.
void initializeWinEHStatePassPass(PassRegistry &)
This file declares the IRTranslator pass.
FunctionPass * createX86AvoidStoreForwardingBlocks()
Return a pass that avoids creating store forward block issues in the hardware.
This file describes how to lower LLVM calls to machine code calls.
This file declares the targeting of the Machinelegalizer class for X86.
ExceptionHandling getExceptionHandlingType() const
Definition: MCAsmInfo.h:602
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Definition: Function.h:333
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition: PassRegistry.h:38
unsigned TrapUnreachable
Emit target-specific trap instruction for &#39;unreachable&#39; IR instructions.
FunctionPass * createX86DiscriminateMemOpsPass()
This pass ensures instructions featuring a memory operand have distinctive <LineNumber, Discriminator> (with respect to eachother)
This pass exposes codegen information to IR-level passes.
DWARF-like instruction based exceptions.
FunctionPass * createX86WinEHStatePass()
Return an IR pass that inserts EH registration stack objects and explicit EH state updates...
FunctionPass * createAtomicExpandPass()
Target & getTheX86_64Target()
FunctionPass * createCleanupLocalDynamicTLSPass()
This pass combines multiple accesses to local-dynamic TLS variables so that the TLS base address for ...
FunctionPass * createCFIInstrInserter()
Creates CFI Instruction Inserter pass.
void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Definition: GlobalISel.cpp:18
static bool is64Bit(const char *name)
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.