33 cl::desc(
"Enable the machine combiner pass"),
55 return make_unique<X86_64MachoTargetObjectFile>();
56 return make_unique<TargetLoweringObjectFileMachO>();
60 return make_unique<X86FreeBSDTargetObjectFile>();
62 return make_unique<X86LinuxNaClTargetObjectFile>();
64 return make_unique<X86FuchsiaTargetObjectFile>();
66 return make_unique<X86ELFTargetObjectFile>();
68 return make_unique<X86WindowsTargetObjectFile>();
70 return make_unique<TargetLoweringObjectFileCOFF>();
76 std::string
Ret =
"e";
89 Ret +=
"-i64:32-f64:32";
106 Ret +=
"-n8:16:32:64";
112 Ret +=
"-a:0:32-S32";
182 #ifdef LLVM_BUILD_GLOBAL_ISEL
185 std::unique_ptr<CallLowering> CL;
232 Key += FS.
empty() ?
"+soft-float" :
",+soft-float";
236 auto &
I = SubtargetMap[Key];
242 I = llvm::make_unique<X86Subtarget>(
TargetTriple, CPU, FS, *
this,
244 #ifndef LLVM_BUILD_GLOBAL_ISEL
247 X86GISelActualAccessor *GISel =
new X86GISelActualAccessor(
250 I->setGISelAccessor(*GISel);
260 cl::desc(
"Minimize AVX to SSE transition penalty"),
286 return getTM<X86TargetMachine>();
296 void addIRPasses()
override;
297 bool addInstSelector()
override;
298 #ifdef LLVM_BUILD_GLOBAL_ISEL
299 bool addIRTranslator()
override;
300 bool addLegalizeMachineIR()
override;
301 bool addRegBankSelect()
override;
302 bool addGlobalInstructionSelect()
override;
304 bool addILPOpts()
override;
305 bool addPreISel()
override;
306 void addPreRegAlloc()
override;
307 void addPostRegAlloc()
override;
308 void addPreEmitPass()
override;
309 void addPreSched2()
override;
314 return new X86PassConfig(
this, PM);
317 void X86PassConfig::addIRPasses() {
326 bool X86PassConfig::addInstSelector() {
331 if (
TM->getTargetTriple().isOSBinFormatELF() &&
339 #ifdef LLVM_BUILD_GLOBAL_ISEL
340 bool X86PassConfig::addIRTranslator() {
345 bool X86PassConfig::addLegalizeMachineIR() {
350 bool X86PassConfig::addRegBankSelect() {
355 bool X86PassConfig::addGlobalInstructionSelect() {
361 bool X86PassConfig::addILPOpts() {
368 bool X86PassConfig::addPreISel() {
370 const Triple &TT =
TM->getTargetTriple();
376 void X86PassConfig::addPreRegAlloc() {
386 void X86PassConfig::addPostRegAlloc() {
392 void X86PassConfig::addPreEmitPass() {
char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
The goal of this helper class is to gather the accessor to all the APIs related to GlobalISel...
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)
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
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...
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
void initializeFixupBWInstPassPass(PassRegistry &)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
FunctionPass * createX86FixupSetCC()
Return a pass that transforms setcc + movzx pairs into xor + setcc.
static std::string computeDataLayout(const Triple &TT)
TargetIRAnalysis getTargetIRAnalysis() override
Get a TargetIRAnalysis implementation for the target.
char & EarlyIfConverterID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions...
Analysis pass providing the TargetTransformInfo.
FunctionPass * createX86CallFrameOptimization()
Return a pass that optimizes the code-size of x86 call sequences.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
FunctionPass * createX86IssueVZeroUpperPass()
This pass inserts AVX vzeroupper instructions before each call to avoid transition penalty between fu...
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
FunctionPass * createX86EvexToVexInsts()
This pass replaces EVEX ecnoded of AVX-512 instructiosn by VEX encoding when possible in order to red...
StringRef substr(size_t Start, size_t N=StringRef::npos) const
Return a reference to the substring from [Start, Start + N).
void reserve(size_type N)
X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
Create an X86 target.
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
static const char * getManglingComponent(const Triple &T)
bool isOSWindows() const
Tests whether the OS is Windows.
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
Holds all the information related to register banks.
void initializeGlobalISel(PassRegistry &Registry)
Initialize all passes linked into the GlobalISel library.
FunctionPass * createX86PadShortFunctions()
Return a pass that pads short functions with NOOPs.
FunctionPass * createAtomicExpandPass(const TargetMachine *TM)
No attributes have been set.
Target-Independent Code Generator Pass Configuration Options.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
bool isOSLinux() const
Tests whether the OS is Linux.
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
void initializeEvexToVexInstPassPass(PassRegistry &)
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...
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
ScheduleDAGMILive * createGenericSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(const TargetInstrInfo *TII)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
FunctionPass * createInterleavedAccessPass(const TargetMachine *TM)
InterleavedAccess Pass - This pass identifies and matches interleaved memory accesses to target speci...
initializer< Ty > init(const Ty &Val)
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
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)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
This class describes a target machine that is implemented with the LLVM target-independent code gener...
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
bool isWindowsCoreCLREnvironment() const
~X86TargetMachine() override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
FunctionPass * createExecutionDependencyFixPass(const TargetRegisterClass *RC)
createExecutionDependencyFixPass - This pass fixes execution time problems with dependent instruction...
unsigned StackAlignmentOverride
StackAlignmentOverride - Override default stack alignment for target.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
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.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
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.
Provides the logic to select generic machine instructions.
ScheduleDAGInstrs - A ScheduleDAG subclass for scheduling lists of MachineInstrs. ...
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
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 resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
Target & getTheX86_32Target()
const X86Subtarget * getSubtargetImpl(const Function &F) const override
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
const TargetInstrInfo * TII
void initializeWinEHStatePassPass(PassRegistry &)
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
StringRef getValueAsString() const
Return the attribute's value as a string.
This file declares the IRTranslator pass.
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
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.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
FunctionPass * createX86WinEHStatePass()
Return an IR pass that inserts EH registration stack objects and explicit EH state updates...
bool isPS4() const
Tests whether the target is the PS4 platform.
Target & getTheX86_64Target()
FunctionPass * createCleanupLocalDynamicTLSPass()
This pass combines multiple accesses to local-dynamic TLS variables so that the TLS base address for ...
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.