[llvm] r270176 - [lanai] Use Optional<Reloc> in LanaiTargetMachine.
Jacques Pienaar via llvm-commits
llvm-commits at lists.llvm.org
Thu May 19 20:21:37 PDT 2016
Author: jpienaar
Date: Thu May 19 22:21:37 2016
New Revision: 270176
URL: http://llvm.org/viewvc/llvm-project?rev=270176&view=rev
Log:
[lanai] Use Optional<Reloc> in LanaiTargetMachine.
Follow r269988 and use Optional<Reloc>.
Modified:
llvm/trunk/lib/Target/Lanai/LanaiSubtarget.cpp
llvm/trunk/lib/Target/Lanai/LanaiSubtarget.h
llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp
llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.h
Modified: llvm/trunk/lib/Target/Lanai/LanaiSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiSubtarget.cpp?rev=270176&r1=270175&r2=270176&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiSubtarget.cpp Thu May 19 22:21:37 2016
@@ -40,7 +40,6 @@ LanaiSubtarget &LanaiSubtarget::initiali
LanaiSubtarget::LanaiSubtarget(const Triple &TargetTriple, StringRef Cpu,
StringRef FeatureString, const TargetMachine &TM,
const TargetOptions &Options,
- Reloc::Model RelocationModel,
CodeModel::Model CodeModel,
CodeGenOpt::Level OptLevel)
: LanaiGenSubtargetInfo(TargetTriple, Cpu, FeatureString),
Modified: llvm/trunk/lib/Target/Lanai/LanaiSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiSubtarget.h?rev=270176&r1=270175&r2=270176&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiSubtarget.h (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiSubtarget.h Thu May 19 22:21:37 2016
@@ -34,8 +34,8 @@ public:
// of the specified triple.
LanaiSubtarget(const Triple &TargetTriple, StringRef Cpu,
StringRef FeatureString, const TargetMachine &TM,
- const TargetOptions &Options, Reloc::Model RelocationModel,
- CodeModel::Model CodeModel, CodeGenOpt::Level OptLevel);
+ const TargetOptions &Options, CodeModel::Model CodeModel,
+ CodeGenOpt::Level OptLevel);
// ParseSubtargetFeatures - Parses features string setting specified
// subtarget options. Definition of function is auto generated by tblgen.
Modified: llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp?rev=270176&r1=270175&r2=270176&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp Thu May 19 22:21:37 2016
@@ -47,18 +47,23 @@ static std::string computeDataLayout(con
"-S64"; // 64 bit natural stack alignment
}
-LanaiTargetMachine::LanaiTargetMachine(const Target &TheTarget,
- const Triple &TargetTriple,
+static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+ Optional<Reloc::Model> RM) {
+ if (!RM.hasValue())
+ return Reloc::Static;
+ return *RM;
+}
+
+LanaiTargetMachine::LanaiTargetMachine(const Target &T, const Triple &TT,
StringRef Cpu, StringRef FeatureString,
const TargetOptions &Options,
- Reloc::Model RelocationModel,
+ Optional<Reloc::Model> RM,
CodeModel::Model CodeModel,
CodeGenOpt::Level OptLevel)
- : LLVMTargetMachine(TheTarget, computeDataLayout(TargetTriple),
- TargetTriple, Cpu, FeatureString, Options,
- RelocationModel, CodeModel, OptLevel),
- Subtarget(TargetTriple, Cpu, FeatureString, *this, Options,
- RelocationModel, CodeModel, OptLevel),
+ : LLVMTargetMachine(T, computeDataLayout(TargetTriple), TT, Cpu,
+ FeatureString, Options, getEffectiveRelocModel(TT, RM),
+ CodeModel, OptLevel),
+ Subtarget(TT, Cpu, FeatureString, *this, Options, CodeModel, OptLevel),
TLOF(new LanaiTargetObjectFile()) {
initAsmInfo();
}
Modified: llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.h?rev=270176&r1=270175&r2=270176&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.h (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.h Thu May 19 22:21:37 2016
@@ -32,7 +32,8 @@ class LanaiTargetMachine : public LLVMTa
public:
LanaiTargetMachine(const Target &TheTarget, const Triple &TargetTriple,
StringRef Cpu, StringRef FeatureString,
- const TargetOptions &Options, Reloc::Model RelocationModel,
+ const TargetOptions &Options,
+ Optional<Reloc::Model> RelocationModel,
CodeModel::Model CodeModel, CodeGenOpt::Level OptLevel);
const LanaiSubtarget *
More information about the llvm-commits
mailing list