[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 5 08:49:46 PDT 2021


sbc100 added a comment.

Does this mean that the magic `__stack_pointer` global can be referenced at the IR level?   I wonder if there are some hacks around handling of `__stack_pointer` that could be removed after this lands?



================
Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};
----------------
What does "object" mean here?   Are we just talking about reference types?  Or also wasm globals that hold integers (like `__stack_pointer`).   If its just ref types that live in this address space should this be called `WASM_ADDRESS_SPACE_ANYREF`?   If its the latter should this be called `WASM_ADDRESS_SPACE_WASM_GLOBAL`?    


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISD.def:48
+
+// Reference Types
+HANDLE_MEM_NODETYPE(GLOBAL_GET)
----------------
Is this just for ref types or also for global that hold integers too (like `__stack_pointer`)


================
Comment at: llvm/test/CodeGen/WebAssembly/global-get.ll:13
+; CHECK-NEXT: end_function
+  %v = load i32, i32 addrspace(1)* @i32_global
+  ret i32 %v
----------------
I don't suppose there is any way to give `addrspace(1)` a symbolic name is there?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101608/new/

https://reviews.llvm.org/D101608



More information about the llvm-commits mailing list