aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetMachine.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Target/TargetMachine.h')
-rw-r--r--include/llvm/Target/TargetMachine.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index 74e91b5790cb..563fef96acfc 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -29,15 +29,14 @@ class InstrItineraryData;
class GlobalValue;
class Mangler;
class MachineFunctionInitializer;
+class MachineModuleInfo;
class MCAsmInfo;
-class MCCodeGenInfo;
class MCContext;
class MCInstrInfo;
class MCRegisterInfo;
class MCSubtargetInfo;
class MCSymbol;
class Target;
-class DataLayout;
class TargetLibraryInfo;
class TargetFrameLowering;
class TargetIRAnalysis;
@@ -45,7 +44,6 @@ class TargetIntrinsicInfo;
class TargetLowering;
class TargetPassConfig;
class TargetRegisterInfo;
-class TargetSelectionDAGInfo;
class TargetSubtargetInfo;
class TargetTransformInfo;
class formatted_raw_ostream;
@@ -90,9 +88,9 @@ protected: // Can only create subclasses.
std::string TargetCPU;
std::string TargetFS;
- /// Low level target information such as relocation model. Non-const to
- /// allow resetting optimization level per-function.
- MCCodeGenInfo *CodeGenInfo;
+ Reloc::Model RM = Reloc::Static;
+ CodeModel::Model CMModel = CodeModel::Default;
+ CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
/// Contains target specific asm information.
const MCAsmInfo *AsmInfo;
@@ -104,11 +102,6 @@ protected: // Can only create subclasses.
unsigned RequireStructuredCFG : 1;
unsigned O0WantsFastISel : 1;
- /// This API is here to support the C API, deprecated in 3.7 release.
- /// This should never be used outside of legacy existing client.
- const DataLayout &getDataLayout() const { return DL; }
- friend struct C_API_PRIVATE_ACCESS;
-
public:
mutable TargetOptions Options;
@@ -181,6 +174,10 @@ public:
/// target default.
CodeModel::Model getCodeModel() const;
+ bool isPositionIndependent() const;
+
+ bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const;
+
/// Returns the TLS model which should be used for the given global variable.
TLSModel::Model getTLSModel(const GlobalValue *GV) const;
@@ -188,7 +185,7 @@ public:
CodeGenOpt::Level getOptLevel() const;
/// \brief Overrides the optimization level.
- void setOptLevel(CodeGenOpt::Level Level) const;
+ void setOptLevel(CodeGenOpt::Level Level);
void setFastISel(bool Enable) { Options.EnableFastISel = Enable; }
bool getO0WantsFastISel() { return O0WantsFastISel; }
@@ -223,6 +220,11 @@ public:
/// uses this to answer queries about the IR.
virtual TargetIRAnalysis getTargetIRAnalysis();
+ /// Add target-specific function passes that should be run as early as
+ /// possible in the optimization pipeline. Most TargetMachines have no such
+ /// passes.
+ virtual void addEarlyAsPossiblePasses(PassManagerBase &) {}
+
/// These enums are meant to be passed into addPassesToEmitFile to indicate
/// what type of file to emit, and returned by it to indicate what type of
/// file could actually be made.
@@ -265,6 +267,12 @@ public:
void getNameWithPrefix(SmallVectorImpl<char> &Name, const GlobalValue *GV,
Mangler &Mang, bool MayAlwaysUsePrivate = false) const;
MCSymbol *getSymbol(const GlobalValue *GV, Mangler &Mang) const;
+
+ /// True if the target uses physical regs at Prolog/Epilog insertion
+ /// time. If true (most machines), all vregs must be allocated before
+ /// PEI. If false (virtual-register machines), then callee-save register
+ /// spilling and scavenging are not needed or used.
+ virtual bool usesPhysRegsForPEI() const { return true; }
};
/// This class describes a target machine that is implemented with the LLVM
@@ -304,6 +312,13 @@ public:
bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
raw_pwrite_stream &OS,
bool DisableVerify = true) override;
+
+ /// Add MachineModuleInfo pass to pass manager.
+ MachineModuleInfo &addMachineModuleInfo(PassManagerBase &PM) const;
+
+ /// Add MachineFunctionAnalysis pass to pass manager.
+ void addMachineFunctionAnalysis(PassManagerBase &PM,
+ MachineFunctionInitializer *MFInitializer) const;
};
} // End llvm namespace