Files
llvm-project/llvm/test/CodeGen/WebAssembly/import-module.ll
Sy Brand ae4e71241f [MC][WebAssembly] Allow strings for import modules and names in asm (#182896)
Current tooling for the WebAssembly component model uses import modules
and names such as `$root` and `[thread-index]`. Importing these from
assembly files requires support for non-valid identifiers in
`.import_name` and `.import_module` directives. This PR adds support for
specifying those as strings, e.g.:

```asm
	.import_module __wasm_component_model_builtin_thread_index, "$root"
	.import_name __wasm_component_model_builtin_thread_index, "[thread-index]"
```
2026-03-06 12:43:09 -08:00

20 lines
453 B
LLVM

; RUN: llc < %s -asm-verbose=false -wasm-keep-registers | FileCheck %s
target triple = "wasm32-unknown-unknown"
define void @test() {
call void @foo()
call void @plain()
ret void
}
declare void @foo() #0
declare void @plain()
attributes #0 = { "wasm-import-module"="bar" "wasm-import-name"="qux" }
; CHECK-NOT: .import_module plain
; CHECK: .import_module foo, "bar"
; CHECK: .import_name foo, "qux"
; CHECK-NOT: .import_module plain