From 1efcdba0e2ab414a981c13e74fab9d83d7a6f4c5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 1 Jul 2015 21:42:34 +0000 Subject: [PATCH] [WebAssembly] Define separate Target instances for 32-bit and 64-bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241193 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp | 2 +- .../WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h | 3 ++- .../WebAssembly/TargetInfo/WebAssemblyTargetInfo.cpp | 7 ++++--- lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp index f74d2e85392..d248556c62d 100644 --- a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp +++ b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp @@ -46,7 +46,7 @@ createWebAssemblyMCInstPrinter(const Triple &T, unsigned SyntaxVariant, // Force static initialization. extern "C" void LLVMInitializeWebAssemblyTargetMC() { - for (Target *T : {&TheWebAssemblyTarget}) { + for (Target *T : {&TheWebAssemblyTarget32, &TheWebAssemblyTarget64}) { // Register the MC asm info. RegisterMCAsmInfoFn X(*T, createWebAssemblyMCAsmInfo); diff --git a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h index 19c0737ffbf..24893daec7e 100644 --- a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h +++ b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h @@ -35,7 +35,8 @@ class Target; class Triple; class raw_ostream; -extern Target TheWebAssemblyTarget; +extern Target TheWebAssemblyTarget32; +extern Target TheWebAssemblyTarget64; MCAsmBackend *createWebAssemblyAsmBackend(const Target &T, const MCRegisterInfo &MRI, diff --git a/lib/Target/WebAssembly/TargetInfo/WebAssemblyTargetInfo.cpp b/lib/Target/WebAssembly/TargetInfo/WebAssemblyTargetInfo.cpp index fb339b95512..ddb1eb1d189 100644 --- a/lib/Target/WebAssembly/TargetInfo/WebAssemblyTargetInfo.cpp +++ b/lib/Target/WebAssembly/TargetInfo/WebAssemblyTargetInfo.cpp @@ -19,11 +19,12 @@ using namespace llvm; #define DEBUG_TYPE "wasm-target-info" -Target llvm::TheWebAssemblyTarget; +Target llvm::TheWebAssemblyTarget32; +Target llvm::TheWebAssemblyTarget64; extern "C" void LLVMInitializeWebAssemblyTargetInfo() { - RegisterTarget X(TheWebAssemblyTarget, "wasm32", + RegisterTarget X(TheWebAssemblyTarget32, "wasm32", "WebAssembly 32-bit"); - RegisterTarget Y(TheWebAssemblyTarget, "wasm64", + RegisterTarget Y(TheWebAssemblyTarget64, "wasm64", "WebAssembly 64-bit"); } diff --git a/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 24277a30bd3..54ab02848b0 100644 --- a/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -30,7 +30,8 @@ using namespace llvm; extern "C" void LLVMInitializeWebAssemblyTarget() { // Register the target. - RegisterTargetMachine X(TheWebAssemblyTarget); + RegisterTargetMachine X(TheWebAssemblyTarget32); + RegisterTargetMachine Y(TheWebAssemblyTarget64); } //===----------------------------------------------------------------------===// -- 2.34.1