diff options
Diffstat (limited to 'contrib/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp')
-rw-r--r-- | contrib/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/contrib/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp b/contrib/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp index 37000f1..ac11a64 100644 --- a/contrib/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp +++ b/contrib/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp @@ -16,7 +16,6 @@ #include "InstPrinter/WebAssemblyInstPrinter.h" #include "WebAssemblyMCAsmInfo.h" #include "WebAssemblyTargetStreamer.h" -#include "llvm/MC/MCCodeGenInfo.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" @@ -40,6 +39,15 @@ static MCAsmInfo *createMCAsmInfo(const MCRegisterInfo & /*MRI*/, return new WebAssemblyMCAsmInfo(TT); } +static void adjustCodeGenOpts(const Triple & /*TT*/, Reloc::Model /*RM*/, + CodeModel::Model &CM) { + CodeModel::Model M = (CM == CodeModel::Default || CM == CodeModel::JITDefault) + ? CodeModel::Large + : CM; + if (M != CodeModel::Large) + report_fatal_error("Non-large code models are not supported yet"); +} + static MCInstrInfo *createMCInstrInfo() { MCInstrInfo *X = new MCInstrInfo(); InitWebAssemblyMCInstrInfo(X); @@ -57,14 +65,14 @@ static MCInstPrinter *createMCInstPrinter(const Triple & /*T*/, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) { - assert(SyntaxVariant == 0); + assert(SyntaxVariant == 0 && "WebAssembly only has one syntax variant"); return new WebAssemblyInstPrinter(MAI, MII, MRI); } static MCCodeEmitter *createCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo & /*MRI*/, - MCContext &Ctx) { - return createWebAssemblyMCCodeEmitter(MCII, Ctx); + MCContext & /*Ctx*/) { + return createWebAssemblyMCCodeEmitter(MCII); } static MCAsmBackend *createAsmBackend(const Target & /*T*/, @@ -99,6 +107,9 @@ extern "C" void LLVMInitializeWebAssemblyTargetMC() { // Register the MC instruction info. TargetRegistry::RegisterMCInstrInfo(*T, createMCInstrInfo); + // Register the MC codegen info. + TargetRegistry::registerMCAdjustCodeGenOpts(*T, adjustCodeGenOpts); + // Register the MC register info. TargetRegistry::RegisterMCRegInfo(*T, createMCRegisterInfo); |