r292324 - [WebAssembly] Update grow_memory's return type.

Dan Gohman via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 17:03:35 PST 2017


Author: djg
Date: Tue Jan 17 19:03:35 2017
New Revision: 292324

URL: http://llvm.org/viewvc/llvm-project?rev=292324&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 clang intrinsic.

Modified:
    cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
    cfe/trunk/test/CodeGen/builtins-wasm.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def?rev=292324&r1=292323&r2=292324&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def Tue Jan 17 19:03:35 2017
@@ -16,9 +16,9 @@
 
 // The format of this database matches clang/Basic/Builtins.def.
 
-// Note that current_memory is not "c" (readnone) because it must be sequenced with
-// respect to grow_memory calls.
+// Note that current_memory is not "c" (readnone) because it must be sequenced
+// with respect to grow_memory calls.
 BUILTIN(__builtin_wasm_current_memory, "z", "n")
-BUILTIN(__builtin_wasm_grow_memory, "vz", "n")
+BUILTIN(__builtin_wasm_grow_memory, "zz", "n")
 
 #undef BUILTIN

Modified: cfe/trunk/test/CodeGen/builtins-wasm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-wasm.c?rev=292324&r1=292323&r2=292324&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-wasm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-wasm.c Tue Jan 17 19:03:35 2017
@@ -9,8 +9,8 @@ __SIZE_TYPE__ f1(void) {
 // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.current.memory.i64()
 }
 
-void f2(long delta) {
-  __builtin_wasm_grow_memory(delta);
-// WEBASSEMBLY32: call void @llvm.wasm.grow.memory.i32(i32 %{{.*}})
-// WEBASSEMBLY64: call void @llvm.wasm.grow.memory.i64(i64 %{{.*}})
+__SIZE_TYPE__ f2(__SIZE_TYPE__ delta) {
+  return __builtin_wasm_grow_memory(delta);
+// WEBASSEMBLY32: call i32 @llvm.wasm.grow.memory.i32(i32 %{{.*}})
+// WEBASSEMBLY64: call i64 @llvm.wasm.grow.memory.i64(i64 %{{.*}})
 }




More information about the cfe-commits mailing list