[llvm] r252202 - [WebAssembly] Update wasm builtin functions to match spec changes.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 12:17:00 PST 2015


Author: djg
Date: Thu Nov  5 14:16:59 2015
New Revision: 252202

URL: http://llvm.org/viewvc/llvm-project?rev=252202&view=rev
Log:
[WebAssembly] Update wasm builtin functions to match spec changes.

The page_size operator has been removed from the spec, and the resize_memory
operator has been changed to grow_memory.

Modified:
    llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
    llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll
    llvm/trunk/test/CodeGen/WebAssembly/memory-addr64.ll

Modified: llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td?rev=252202&r1=252201&r2=252202&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td Thu Nov  5 14:16:59 2015
@@ -14,8 +14,7 @@
 
 let TargetPrefix = "wasm" in {  // All intrinsics start with "llvm.wasm.".
 
-def int_wasm_page_size : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
 def int_wasm_memory_size : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
-def int_wasm_resize_memory : Intrinsic<[], [llvm_anyint_ty], []>;
+def int_wasm_grow_memory : Intrinsic<[], [llvm_anyint_ty], []>;
 
 }

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td?rev=252202&r1=252201&r2=252202&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td Thu Nov  5 14:16:59 2015
@@ -84,14 +84,6 @@ def STORE16_I64 : I<(outs), (ins I32:$ad
 def STORE32_I64 : I<(outs), (ins I32:$addr, I64:$val),
                     [(truncstorei32 I64:$val, I32:$addr)]>;
 
-// Page size.
-def page_size_I32 : I<(outs I32:$dst), (ins),
-                      [(set I32:$dst, (int_wasm_page_size))]>,
-                    Requires<[HasAddr32]>;
-def page_size_I64 : I<(outs I64:$dst), (ins),
-                      [(set I64:$dst, (int_wasm_page_size))]>,
-                    Requires<[HasAddr64]>;
-
 // Memory size.
 def memory_size_I32 : I<(outs I32:$dst), (ins),
                         [(set I32:$dst, (int_wasm_memory_size))]>,
@@ -100,10 +92,10 @@ def memory_size_I64 : I<(outs I64:$dst),
                         [(set I64:$dst, (int_wasm_memory_size))]>,
                       Requires<[HasAddr64]>;
 
-// Resize memory.
-def resize_memory_I32 : I<(outs), (ins I32:$delta),
-                          [(int_wasm_resize_memory I32:$delta)]>,
-                        Requires<[HasAddr32]>;
-def resize_memory_I64 : I<(outs), (ins I64:$delta),
-                          [(int_wasm_resize_memory I64:$delta)]>,
-                        Requires<[HasAddr64]>;
+// Grow memory.
+def grow_memory_I32 : I<(outs), (ins I32:$delta),
+                        [(int_wasm_grow_memory I32:$delta)]>,
+                      Requires<[HasAddr32]>;
+def grow_memory_I64 : I<(outs), (ins I64:$delta),
+                        [(int_wasm_grow_memory I64:$delta)]>,
+                      Requires<[HasAddr64]>;

Modified: llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll?rev=252202&r1=252201&r2=252202&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll Thu Nov  5 14:16:59 2015
@@ -5,20 +5,8 @@
 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
-declare i32 @llvm.wasm.page.size.i32() nounwind readnone
 declare i32 @llvm.wasm.memory.size.i32() nounwind readnone
-declare void @llvm.wasm.resize.memory.i32(i32) nounwind
-
-; CHECK-LABEL: page_size:
-; CHECK-NEXT: .result i32{{$}}
-; CHECK-NEXT: .local i32{{$}}
-; CHECK-NEXT: page_size
-; CHECK-NEXT: set_local 0, pop{{$}}
-; CHECK-NEXT: return (get_local 0){{$}}
-define i32 @page_size() {
-  %a = call i32 @llvm.wasm.page.size.i32()
-  ret i32 %a
-}
+declare void @llvm.wasm.grow.memory.i32(i32) nounwind
 
 ; CHECK-LABEL: memory_size:
 ; CHECK-NEXT: .result i32{{$}}
@@ -31,12 +19,12 @@ define i32 @memory_size() {
   ret i32 %a
 }
 
-; CHECK-LABEL: resize_memory:
+; CHECK-LABEL: grow_memory:
 ; CHECK-NEXT: .param i32
 ; CHECK-NEXT: .local i32{{$}}
-; CHECK: resize_memory (get_local 1)
+; CHECK: grow_memory (get_local 1)
 ; CHECK-NEXT: return
-define void @resize_memory(i32 %n) {
-  call void @llvm.wasm.resize.memory.i32(i32 %n)
+define void @grow_memory(i32 %n) {
+  call void @llvm.wasm.grow.memory.i32(i32 %n)
   ret void
 }

Modified: llvm/trunk/test/CodeGen/WebAssembly/memory-addr64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/memory-addr64.ll?rev=252202&r1=252201&r2=252202&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/memory-addr64.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/memory-addr64.ll Thu Nov  5 14:16:59 2015
@@ -5,20 +5,8 @@
 target datalayout = "e-p:64:64-i64:64-n32:64-S128"
 target triple = "wasm64-unknown-unknown"
 
-declare i64 @llvm.wasm.page.size.i64() nounwind readnone
 declare i64 @llvm.wasm.memory.size.i64() nounwind readnone
-declare void @llvm.wasm.resize.memory.i64(i64) nounwind
-
-; CHECK-LABEL: page_size:
-; CHECK-NEXT: .result i64{{$}}
-; CHECK-NEXT: .local i64{{$}}
-; CHECK-NEXT: page_size
-; CHECK-NEXT: set_local 0, pop{{$}}
-; CHECK-NEXT: return (get_local 0){{$}}
-define i64 @page_size() {
-  %a = call i64 @llvm.wasm.page.size.i64()
-  ret i64 %a
-}
+declare void @llvm.wasm.grow.memory.i64(i64) nounwind
 
 ; CHECK-LABEL: memory_size:
 ; CHECK-NEXT: .result i64{{$}}
@@ -31,12 +19,12 @@ define i64 @memory_size() {
   ret i64 %a
 }
 
-; CHECK-LABEL: resize_memory:
+; CHECK-LABEL: grow_memory:
 ; CHECK-NEXT: .param i64
 ; CHECK-NEXT: .local i64{{$}}
-; CHECK: resize_memory (get_local 1)
+; CHECK: grow_memory (get_local 1)
 ; CHECK-NEXT: return
-define void @resize_memory(i64 %n) {
-  call void @llvm.wasm.resize.memory.i64(i64 %n)
+define void @grow_memory(i64 %n) {
+  call void @llvm.wasm.grow.memory.i64(i64 %n)
   ret void
 }




More information about the llvm-commits mailing list