aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorPaulo Matos <pmatos@igalia.com>2021-05-04 14:13:08 +0200
committerAndy Wingo <wingo@igalia.com>2021-05-11 11:19:29 +0200
commitd7086af2143d58a6535e0837c4d8789c69c6985f (patch)
tree17f56deba8b467fb5bdd2797cfd2ac57fea78671 /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parent04adfb660987072ad31756e0d04803f96c3c39f7 (diff)
downloadllvm-d7086af2143d58a6535e0837c4d8789c69c6985f.zip
llvm-d7086af2143d58a6535e0837c4d8789c69c6985f.tar.gz
llvm-d7086af2143d58a6535e0837c4d8789c69c6985f.tar.bz2
[WebAssembly] Support for WebAssembly globals in LLVM IR
This patch adds support for WebAssembly globals in LLVM IR, representing them as pointers to global values, in a non-default, non-integral address space. Instruction selection legalizes loads and stores to these pointers to new WebAssemblyISD nodes GLOBAL_GET and GLOBAL_SET. Once the lowering creates the new nodes, tablegen pattern matches those and converts them to Wasm global.get/set of the appropriate type. Based on work by Paulo Matos in https://reviews.llvm.org/D95425. Reviewed By: pmatos Differential Revision: https://reviews.llvm.org/D101608
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 135055a..94f4ae7 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -119,8 +119,9 @@ WebAssemblyTargetMachine::WebAssemblyTargetMachine(
const TargetOptions &Options, Optional<Reloc::Model> RM,
Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, bool JIT)
: LLVMTargetMachine(T,
- TT.isArch64Bit() ? "e-m:e-p:64:64-i64:64-n32:64-S128"
- : "e-m:e-p:32:32-i64:64-n32:64-S128",
+ TT.isArch64Bit()
+ ? "e-m:e-p:64:64-i64:64-n32:64-S128-ni:1"
+ : "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1",
TT, CPU, FS, Options, getEffectiveRelocModel(RM, TT),
getEffectiveCodeModel(CM, CodeModel::Large), OL),
TLOF(new WebAssemblyTargetObjectFile()) {