diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index c5d7835f058..087d90766be 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -103,17 +103,22 @@ static StringRef getGPUOrDefault(const Triple &TT, StringRef GPU) { return ""; } +static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) { + if (!RM.hasValue()) + return Reloc::PIC_; + return *RM; +} + AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, - TargetOptions Options, Reloc::Model RM, + TargetOptions Options, + Optional<Reloc::Model> RM, CodeModel::Model CM, CodeGenOpt::Level OptLevel) - : LLVMTargetMachine(T, computeDataLayout(TT), TT, - getGPUOrDefault(TT, CPU), FS, Options, RM, CM, - OptLevel), + : LLVMTargetMachine(T, computeDataLayout(TT), TT, getGPUOrDefault(TT, CPU), + FS, Options, getEffectiveRelocModel(RM), CM, OptLevel), TLOF(createTLOF(getTargetTriple())), - Subtarget(TT, getTargetCPU(), FS, *this), - IntrinsicInfo() { + Subtarget(TT, getTargetCPU(), FS, *this), IntrinsicInfo() { setRequiresStructuredCFG(true); initAsmInfo(); } @@ -126,7 +131,8 @@ AMDGPUTargetMachine::~AMDGPUTargetMachine() { } R600TargetMachine::R600TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, - TargetOptions Options, Reloc::Model RM, + TargetOptions Options, + Optional<Reloc::Model> RM, CodeModel::Model CM, CodeGenOpt::Level OL) : AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {} @@ -136,7 +142,8 @@ R600TargetMachine::R600TargetMachine(const Target &T, const Triple &TT, GCNTargetMachine::GCNTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, - TargetOptions Options, Reloc::Model RM, + TargetOptions Options, + Optional<Reloc::Model> RM, CodeModel::Model CM, CodeGenOpt::Level OL) : AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {} |