diff options
author | Meador Inge <meadori@codesourcery.com> | 2017-08-06 12:02:17 +0000 |
---|---|---|
committer | Meador Inge <meadori@codesourcery.com> | 2017-08-06 12:02:17 +0000 |
commit | 5d99b15d8dc3f5f9bca64bd6817a5f499a2207ce (patch) | |
tree | 4d917a055dfd66c86ac718b1122174960d82bbaf /lib/Target/AVR | |
parent | 1256b9b46d2a1b37387304dc1bb6bd5af373029a (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/AVR')
-rw-r--r-- | lib/Target/AVR/AVRTargetMachine.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Target/AVR/AVRTargetMachine.cpp b/lib/Target/AVR/AVRTargetMachine.cpp index 6430e767f3e..9865a79997c 100644 --- a/lib/Target/AVR/AVRTargetMachine.cpp +++ b/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(); |