54 cl::desc(
"Enable the machine combiner pass"),
58 "x86-speculative-load-hardening",
98 return llvm::make_unique<X86_64MachoTargetObjectFile>();
99 return llvm::make_unique<TargetLoweringObjectFileMachO>();
103 return llvm::make_unique<X86FreeBSDTargetObjectFile>();
105 return llvm::make_unique<X86LinuxNaClTargetObjectFile>();
107 return llvm::make_unique<X86SolarisTargetObjectFile>();
109 return llvm::make_unique<X86FuchsiaTargetObjectFile>();
111 return llvm::make_unique<X86ELFTargetObjectFile>();
113 return llvm::make_unique<TargetLoweringObjectFileCOFF>();
119 std::string
Ret =
"e";
132 Ret +=
"-i64:32-f64:32";
149 Ret +=
"-n8:16:32:64";
155 Ret +=
"-a:0:32-S32";
205 bool JIT,
bool Is64Bit) {
277 Key += FS.
empty() ?
"+soft-float" :
",+soft-float";
281 unsigned CPUFSWidth = Key.
size();
284 unsigned PreferVectorWidthOverride = 0;
289 Key +=
",prefer-vector-width=";
291 PreferVectorWidthOverride = Width;
296 unsigned RequiredVectorWidth = UINT32_MAX;
301 Key +=
",required-vector-width=";
303 RequiredVectorWidth = Width;
312 auto &
I = SubtargetMap[
Key];
318 I = llvm::make_unique<X86Subtarget>(
TargetTriple, CPU, FS, *
this,
320 PreferVectorWidthOverride,
321 RequiredVectorWidth);
331 cl::desc(
"Minimize AVX to SSE transition penalty"),
356 return getTM<X86TargetMachine>();
366 void addIRPasses()
override;
367 bool addInstSelector()
override;
368 bool addIRTranslator()
override;
369 bool addLegalizeMachineIR()
override;
370 bool addRegBankSelect()
override;
371 bool addGlobalInstructionSelect()
override;
372 bool addILPOpts()
override;
373 bool addPreISel()
override;
374 void addMachineSSAOptimization()
override;
375 void addPreRegAlloc()
override;
376 void addPostRegAlloc()
override;
377 void addPreEmitPass()
override;
378 void addPreEmitPass2()
override;
379 void addPreSched2()
override;
387 return "X86 Execution Dependency Fix";
395 "X86 Execution Domain Fix",
false,
false)
398 "X86 Execution Domain
Fix",
false, false)
401 return new X86PassConfig(*
this, PM);
404 void X86PassConfig::addIRPasses() {
418 bool X86PassConfig::addInstSelector() {
423 if (
TM->getTargetTriple().isOSBinFormatELF() &&
431 bool X86PassConfig::addIRTranslator() {
436 bool X86PassConfig::addLegalizeMachineIR() {
441 bool X86PassConfig::addRegBankSelect() {
446 bool X86PassConfig::addGlobalInstructionSelect() {
451 bool X86PassConfig::addILPOpts() {
459 bool X86PassConfig::addPreISel() {
461 const Triple &TT =
TM->getTargetTriple();
467 void X86PassConfig::addPreRegAlloc() {
482 void X86PassConfig::addMachineSSAOptimization() {
487 void X86PassConfig::addPostRegAlloc() {
493 void X86PassConfig::addPreEmitPass() {
495 addPass(
new X86ExecutionDomainFix());
513 void X86PassConfig::addPreEmitPass2() {
518 const Triple &TT =
TM->getTargetTriple();
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
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")
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void LLVMInitializeX86Target()
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...
Compute iterated dominance frontiers using a linear time algorithm.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
void initializeFixupBWInstPassPass(PassRegistry &)
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
static cl::opt< bool > EnableSpeculativeLoadHardening("x86-speculative-load-hardening", cl::desc("Enable speculative load hardening"), cl::init(false), cl::Hidden)
FunctionPass * createX86FixupSetCC()
Return a pass that transforms setcc + movzx pairs into xor + setcc.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static std::string computeDataLayout(const Triple &TT)
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
char & EarlyIfConverterID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions...
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.
FunctionPass * createX86CallFrameOptimization()
Return a pass that optimizes the code-size of x86 call sequences.
void initializeX86CallFrameOptimizationPass(PassRegistry &)
FunctionPass * createX86IssueVZeroUpperPass()
This pass inserts AVX vzeroupper instructions before each call to avoid transition penalty between fu...
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)
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form...
unsigned NoTrapAfterNoreturn
Do not emit a trap instruction for 'unreachable' IR instructions behind noreturn calls, even if TrapUnreachable is true.
FunctionPass * createShadowCallStackPass()
This pass instruments the function prolog to save the return address to a 'shadow call stack' and the...
static const char * getManglingComponent(const Triple &T)
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.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
#define INITIALIZE_PASS_DEPENDENCY(depName)
void resetTargetOptions(const Function &F) const
Reset the target options based on the function'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.
Target-Independent Code Generator Pass Configuration Options.
void initializeX86AvoidSFBPassPass(PassRegistry &)
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
void initializeEvexToVexInstPassPass(PassRegistry &)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
FunctionPass * createX86FixupLEAs()
Return a pass that selectively replaces certain instructions (like add, sub, inc, dec...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
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.
static CodeModel::Model getEffectiveCodeModel(Optional< CodeModel::Model > CM)
bool isOSWindows() const
Tests whether the OS is Windows.
char & LiveRangeShrinkID
LiveRangeShrink pass.
initializer< Ty > init(const Ty &Val)
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
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.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
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.
static bool is64Bit(const char *name)
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 &)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
void setMachineOutliner(bool Enable)
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
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.
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.
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...
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
bool isOSLinux() const
Tests whether the OS is Linux.
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
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.
FunctionPass * createX86SpeculativeLoadHardeningPass()
This pass is responsible for selecting generic machine instructions to target-specific instructions...
FunctionPass * createX86FloatingPointStackifierPass()
This function returns a pass which converts floating-point register references and pseudo instruction...
Target - Wrapper for Target specific information.
This file describes how to lower LLVM calls to machine code calls.
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.
A ScheduleDAG for scheduling lists of MachineInstr.
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.
StringRef getValueAsString() const
Return the attribute's value as a string.
void initializeX86FlagsCopyLoweringPassPass(PassRegistry &)
bool isArch64Bit() const
Test whether the architecture is 64-bit.
FunctionPass * createX86ISelDag(X86TargetMachine &TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a X86-specific DAG, ready for instruction scheduling...
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
void initializeShadowCallStackPass(PassRegistry &)
Target & getTheX86_32Target()
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.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
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.
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.