summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AVR/AVRTargetMachine.cpp
diff options
context:
space:
mode:
authorMeador Inge <meadori@codesourcery.com>2017-08-06 12:02:17 +0000
committerMeador Inge <meadori@codesourcery.com>2017-08-06 12:02:17 +0000
commit70ab7cc55cc9d50a80a1e26fc72e83e35929a7b9 (patch)
tree6f67cf804411cf37f46b2f37e9c8ff42a9506f93 /llvm/lib/Target/AVR/AVRTargetMachine.cpp
parent2b7479b1afe7edbca762d4deb2b6fae1cb35034a (diff)
downloadbcm5719-llvm-70ab7cc55cc9d50a80a1e26fc72e83e35929a7b9.tar.gz
bcm5719-llvm-70ab7cc55cc9d50a80a1e26fc72e83e35929a7b9.zip
[AVR] Compute code model if one is not provided
The patch from r310028 fixed things to work with the new `LLVMTargetMachine` constructor that came in on r309911. However, the fix was partial since an object of type `CodeModel::Model` must be passed to `LLVMTargetMachine` (not one of `Optional<CodeModel::Model>`). This patch fixes the problem in the same fashion that r309911 did for other machines: by checking if the passed optional code model has a value and using `CodeModel::Small` if not. llvm-svn: 310200
Diffstat (limited to 'llvm/lib/Target/AVR/AVRTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/AVR/AVRTargetMachine.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Target/AVR/AVRTargetMachine.cpp b/llvm/lib/Target/AVR/AVRTargetMachine.cpp
index 6430e767f3e..9865a79997c 100644
--- a/llvm/lib/Target/AVR/AVRTargetMachine.cpp
+++ b/llvm/lib/Target/AVR/AVRTargetMachine.cpp
@@ -40,17 +40,21 @@ static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
return RM.hasValue() ? *RM : Reloc::Static;
}
+static CodeModel::Model getEffectiveCodeModel(Optional<CodeModel::Model> CM) {
+ if (CM)
+ return *CM;
+ return CodeModel::Small;
+}
+
AVRTargetMachine::AVRTargetMachine(const Target &T, const Triple &TT,
StringRef CPU, StringRef FS,
const TargetOptions &Options,
Optional<Reloc::Model> RM,
Optional<CodeModel::Model> CM,
- CodeGenOpt::Level OL,
- bool JIT)
- : LLVMTargetMachine(
- T, AVRDataLayout, TT,
- getCPU(CPU), FS, Options, getEffectiveRelocModel(RM),
- CM, OL),
+ CodeGenOpt::Level OL, bool JIT)
+ : LLVMTargetMachine(T, AVRDataLayout, TT, getCPU(CPU), FS, Options,
+ getEffectiveRelocModel(RM), getEffectiveCodeModel(CM),
+ OL),
SubTarget(TT, getCPU(CPU), FS, *this) {
this->TLOF = make_unique<AVRTargetObjectFile>();
initAsmInfo();
OpenPOWER on IntegriCloud