about summary refs log tree commit diff
path: root/src/librustc_llvm
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2017-06-16 15:43:43 -0700
committerThomas Lively <tlively@google.com>2017-06-16 15:43:43 -0700
commita1981a64a22024bbda98cf1b76b7c751fb1dcddb (patch)
tree922379caaab0ff3e96392f4197f42e0c2746043f /src/librustc_llvm
parentfe7227f6c8704f0186091085a14fd1027920e4bb (diff)
downloadrust-a1981a64a22024bbda98cf1b76b7c751fb1dcddb.tar.gz
rust-a1981a64a22024bbda98cf1b76b7c751fb1dcddb.zip
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.
Diffstat (limited to 'src/librustc_llvm')
-rw-r--r--src/librustc_llvm/build.rs2
-rw-r--r--src/librustc_llvm/lib.rs5
2 files changed, 6 insertions, 1 deletions
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<String> {