mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[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
This commit is contained in:
parent
0bf71c9768
commit
809a734968
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user