From a1981a64a22024bbda98cf1b76b7c751fb1dcddb Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 16 Jun 2017 15:43:43 -0700 Subject: Add target to use LLVM wasm backend The new target is wasm32-experimental-emscripten. Adds a new configuration option to opt in to building experimental LLVM backends such as the WebAssembly backend. The target name was chosen to be similar to the existing wasm32-unknown-emscripten target so that the build and tests would work with minimal other code changes. When/if the new target replaces the old target, simply renaming it should just work. --- src/librustc_llvm/build.rs | 2 +- src/librustc_llvm/lib.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/librustc_llvm') diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index bdfc0a2fe85..01b37a55f4f 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -93,7 +93,7 @@ fn main() { let mut optional_components = vec!["x86", "arm", "aarch64", "mips", "powerpc", "pnacl", - "systemz", "jsbackend", "msp430", "sparc", "nvptx"]; + "systemz", "jsbackend", "webassembly", "msp430", "sparc", "nvptx"]; let mut version_cmd = Command::new(&llvm_config); version_cmd.arg("--version"); diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 790d493f191..e2d0b204837 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -389,6 +389,11 @@ pub fn initialize_available_targets() { LLVMInitializeHexagonTargetMC, LLVMInitializeHexagonAsmPrinter, LLVMInitializeHexagonAsmParser); + init_target!(llvm_component = "webassembly", + LLVMInitializeWebAssemblyTargetInfo, + LLVMInitializeWebAssemblyTarget, + LLVMInitializeWebAssemblyTargetMC, + LLVMInitializeWebAssemblyAsmPrinter); } pub fn last_error() -> Option { -- cgit 1.4.1-3-g733a5