From 369a5c3b2bdb4a2aa9d5b47ccf3986d507548751 Mon Sep 17 00:00:00 2001 From: Shruti Sharma <98698727+shruti2522@users.noreply.github.com> Date: Wed, 1 May 2024 01:07:48 +0530 Subject: [PATCH] feat: add wasm32 llvm target (#1262) feat:add wasm32 llvm target Signed-off-by: shruti2522 --- kclvm/compiler/src/codegen/llvm/emit.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kclvm/compiler/src/codegen/llvm/emit.rs b/kclvm/compiler/src/codegen/llvm/emit.rs index 1259e1b8c..a795ae444 100644 --- a/kclvm/compiler/src/codegen/llvm/emit.rs +++ b/kclvm/compiler/src/codegen/llvm/emit.rs @@ -29,12 +29,13 @@ pub fn emit_code( ) -> Result<(), Box> { // Init LLVM targets LLVM_INIT.get_or_init(|| { - // TODO: WASM target. #[cfg(target_os = "linux")] inkwell::targets::Target::initialize_x86(&Default::default()); #[cfg(all(target_os = "linux", target_arch = "aarch64"))] inkwell::targets::Target::initialize_aarch64(&Default::default()); - #[cfg(not(target_os = "linux"))] + #[cfg(target_arch = "wasm32")] + inkwell::targets::Target::initialize_webassembly(&Default::default()); + #[cfg(not(any(target_os = "linux", target_arch = "wasm32")))] inkwell::targets::Target::initialize_all(&Default::default()); }); // Create a LLVM context