diff options
Diffstat (limited to 'lib/Target/SystemZ/SystemZTargetMachine.cpp')
-rw-r--r-- | lib/Target/SystemZ/SystemZTargetMachine.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/Target/SystemZ/SystemZTargetMachine.cpp b/lib/Target/SystemZ/SystemZTargetMachine.cpp index f305e85f6cfee..85a3f6f4a8be6 100644 --- a/lib/Target/SystemZ/SystemZTargetMachine.cpp +++ b/lib/Target/SystemZ/SystemZTargetMachine.cpp @@ -10,6 +10,7 @@ #include "SystemZTargetMachine.h" #include "SystemZTargetTransformInfo.h" #include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/TargetPassConfig.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Transforms/Scalar.h" #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" @@ -79,13 +80,22 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU, return Ret; } +static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) { + // Static code is suitable for use in a dynamic executable; there is no + // separate DynamicNoPIC model. + if (!RM.hasValue() || *RM == Reloc::DynamicNoPIC) + return Reloc::Static; + return *RM; +} + SystemZTargetMachine::SystemZTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, - Reloc::Model RM, CodeModel::Model CM, + Optional<Reloc::Model> RM, + CodeModel::Model CM, CodeGenOpt::Level OL) : LLVMTargetMachine(T, computeDataLayout(TT, CPU, FS), TT, CPU, FS, Options, - RM, CM, OL), + getEffectiveRelocModel(RM), CM, OL), TLOF(make_unique<TargetLoweringObjectFileELF>()), Subtarget(TT, CPU, FS, *this) { initAsmInfo(); @@ -112,6 +122,9 @@ public: } // end anonymous namespace void SystemZPassConfig::addIRPasses() { + if (getOptLevel() != CodeGenOpt::None) + addPass(createSystemZTDCPass()); + TargetPassConfig::addIRPasses(); } @@ -125,8 +138,7 @@ bool SystemZPassConfig::addInstSelector() { } void SystemZPassConfig::addPreSched2() { - if (getOptLevel() != CodeGenOpt::None && - getSystemZTargetMachine().getSubtargetImpl()->hasLoadStoreOnCond()) + if (getOptLevel() != CodeGenOpt::None) addPass(&IfConverterID); } |