Skip to content

Commit

Permalink
[lanai] Use Optional<Reloc> in LanaiTargetMachine.
Browse files Browse the repository at this point in the history
Follow r269988 and use Optional<Reloc>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270176 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jpienaar committed May 20, 2016
1 parent 264bca3 commit 1c820cf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion lib/Target/Lanai/LanaiSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ LanaiSubtarget &LanaiSubtarget::initializeSubtargetDependencies(StringRef CPU,
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),
Expand Down
4 changes: 2 additions & 2 deletions lib/Target/Lanai/LanaiSubtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class LanaiSubtarget : public LanaiGenSubtargetInfo {
// 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.
Expand Down
21 changes: 13 additions & 8 deletions lib/Target/Lanai/LanaiTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,23 @@ static std::string computeDataLayout(const Triple &TT) {
"-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();
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Target/Lanai/LanaiTargetMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class LanaiTargetMachine : public LLVMTargetMachine {
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 *
Expand Down

0 comments on commit 1c820cf

Please sign in to comment.