[llvm] r292322 - [WebAssembly] Update grow_memory's return type.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 17 17:02:46 PST 2017
Author: djg
Date: Tue Jan 17 19:02:45 2017
New Revision: 292322
URL: http://llvm.org/viewvc/llvm-project?rev=292322&view=rev
Log:
[WebAssembly] Update grow_memory's return type.
The grow_memory instruction now returns the previous memory size. Add the
return type to the LLVM intrinsic.
Modified:
llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll
Modified: llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td?rev=292322&r1=292321&r2=292322&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td Tue Jan 17 19:02:45 2017
@@ -17,6 +17,6 @@ let TargetPrefix = "wasm" in { // All i
// Note that current_memory is not IntrNoMem because it must be sequenced with
// respect to grow_memory calls.
def int_wasm_current_memory : Intrinsic<[llvm_anyint_ty], [], [IntrReadMem]>;
-def int_wasm_grow_memory : Intrinsic<[], [llvm_anyint_ty], []>;
+def int_wasm_grow_memory : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], []>;
}
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td?rev=292322&r1=292321&r2=292322&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td Tue Jan 17 19:02:45 2017
@@ -673,9 +673,9 @@ def CURRENT_MEMORY_I32 : I<(outs I32:$ds
Requires<[HasAddr32]>;
// Grow memory.
-def GROW_MEMORY_I32 : I<(outs), (ins i32imm:$flags, I32:$delta),
+def GROW_MEMORY_I32 : I<(outs I32:$dst), (ins i32imm:$flags, I32:$delta),
[],
- "grow_memory\t$delta", 0x40>,
+ "grow_memory\t$dst, $delta", 0x40>,
Requires<[HasAddr32]>;
} // Defs = [ARGUMENTS]
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=292322&r1=292321&r2=292322&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/memory-addr32.ll Tue Jan 17 19:02:45 2017
@@ -6,7 +6,7 @@ target datalayout = "e-m:e-p:32:32-i64:6
target triple = "wasm32-unknown-unknown"
declare i32 @llvm.wasm.current.memory.i32() nounwind readonly
-declare void @llvm.wasm.grow.memory.i32(i32) nounwind
+declare i32 @llvm.wasm.grow.memory.i32(i32) nounwind
; CHECK-LABEL: current_memory:
; CHECK-NEXT: .result i32{{$}}
@@ -19,9 +19,10 @@ define i32 @current_memory() {
; CHECK-LABEL: grow_memory:
; CHECK-NEXT: .param i32{{$}}
-; CHECK: grow_memory $0{{$}}
-; CHECK-NEXT: return{{$}}
-define void @grow_memory(i32 %n) {
- call void @llvm.wasm.grow.memory.i32(i32 %n)
- ret void
+; CHECK-NEXT: .result i32{{$}}
+; CHECK: grow_memory $push0=, $0{{$}}
+; CHECK-NEXT: return $pop0{{$}}
+define i32 @grow_memory(i32 %n) {
+ %a = call i32 @llvm.wasm.grow.memory.i32(i32 %n)
+ ret i32 %a
}
More information about the llvm-commits
mailing list