diff options
| author | David Green <david.green@arm.com> | 2018-12-07 12:10:23 +0000 |
|---|---|---|
| committer | David Green <david.green@arm.com> | 2018-12-07 12:10:23 +0000 |
| commit | ca29c271d2b951b125b7f97264ca7b927db0b1cf (patch) | |
| tree | 0c576a9c69d06179da070a855a87d460b62e4003 /llvm/lib/Target/Sparc/SparcTargetMachine.cpp | |
| parent | 700a29a153039c6176efaf7a3b7c0a274b8aafed (diff) | |
| download | bcm5719-llvm-ca29c271d2b951b125b7f97264ca7b927db0b1cf.tar.gz bcm5719-llvm-ca29c271d2b951b125b7f97264ca7b927db0b1cf.zip | |
[Targets] Add errors for tiny and kernel codemodel on targets that don't support them
Adds fatal errors for any target that does not support the Tiny or Kernel
codemodels by rejigging the getEffectiveCodeModel calls.
Differential Revision: https://reviews.llvm.org/D50141
llvm-svn: 348585
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcTargetMachine.cpp')
| -rw-r--r-- | llvm/lib/Target/Sparc/SparcTargetMachine.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp index 07f9e7250bd..5b467235f80 100644 --- a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp @@ -70,11 +70,16 @@ static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) { // pic32 PIC_ Medium GOT < 2^32 bytes // // All code models require that the text segment is smaller than 2GB. -static CodeModel::Model getEffectiveCodeModel(Optional<CodeModel::Model> CM, - Reloc::Model RM, bool Is64Bit, - bool JIT) { - if (CM) +static CodeModel::Model +getEffectiveSparcCodeModel(Optional<CodeModel::Model> CM, Reloc::Model RM, + bool Is64Bit, bool JIT) { + if (CM) { + if (*CM == CodeModel::Tiny) + report_fatal_error("Target does not support the tiny CodeModel"); + if (*CM == CodeModel::Kernel) + report_fatal_error("Target does not support the kernel CodeModel"); return *CM; + } if (Is64Bit) { if (JIT) return CodeModel::Large; @@ -88,11 +93,11 @@ SparcTargetMachine::SparcTargetMachine( 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, bool is64bit) - : LLVMTargetMachine( - T, computeDataLayout(TT, is64bit), TT, CPU, FS, Options, - getEffectiveRelocModel(RM), - getEffectiveCodeModel(CM, getEffectiveRelocModel(RM), is64bit, JIT), - OL), + : LLVMTargetMachine(T, computeDataLayout(TT, is64bit), TT, CPU, FS, Options, + getEffectiveRelocModel(RM), + getEffectiveSparcCodeModel( + CM, getEffectiveRelocModel(RM), is64bit, JIT), + OL), TLOF(make_unique<SparcELFTargetObjectFile>()), Subtarget(TT, CPU, FS, *this, is64bit), is64Bit(is64bit) { initAsmInfo(); |

