r252201 - [WebAssembly] Update wasm builtin functions to match spec changes.
Dan Gohman via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 12:16:37 PST 2015
Author: djg
Date: Thu Nov 5 14:16:37 2015
New Revision: 252201
URL: http://llvm.org/viewvc/llvm-project?rev=252201&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:
cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
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=252201&r1=252200&r2=252201&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def Thu Nov 5 14:16:37 2015
@@ -16,8 +16,7 @@
// The format of this database matches clang/Basic/Builtins.def.
-BUILTIN(__builtin_wasm_page_size, "z", "nc")
BUILTIN(__builtin_wasm_memory_size, "z", "nc")
-BUILTIN(__builtin_wasm_resize_memory, "vz", "n")
+BUILTIN(__builtin_wasm_grow_memory, "vz", "n")
#undef BUILTIN
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=252201&r1=252200&r2=252201&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Nov 5 14:16:37 2015
@@ -7274,19 +7274,14 @@ Value *CodeGenFunction::EmitNVPTXBuiltin
Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
switch (BuiltinID) {
- case WebAssembly::BI__builtin_wasm_page_size: {
- llvm::Type *ResultType = ConvertType(E->getType());
- Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_page_size, ResultType);
- return Builder.CreateCall(Callee);
- }
case WebAssembly::BI__builtin_wasm_memory_size: {
llvm::Type *ResultType = ConvertType(E->getType());
Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_memory_size, ResultType);
return Builder.CreateCall(Callee);
}
- case WebAssembly::BI__builtin_wasm_resize_memory: {
+ case WebAssembly::BI__builtin_wasm_grow_memory: {
Value *X = EmitScalarExpr(E->getArg(0));
- Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_resize_memory, X->getType());
+ Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_grow_memory, X->getType());
return Builder.CreateCall(Callee, X);
}
Modified: cfe/trunk/test/CodeGen/builtins-wasm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-wasm.c?rev=252201&r1=252200&r2=252201&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-wasm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-wasm.c Thu Nov 5 14:16:37 2015
@@ -3,12 +3,6 @@
// RUN: %clang_cc1 -triple wasm64-unknown-unknown -O3 -emit-llvm -o - %s \
// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY64
-__SIZE_TYPE__ f0(void) {
- return __builtin_wasm_page_size();
-// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.page.size.i32()
-// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.page.size.i64()
-}
-
__SIZE_TYPE__ f1(void) {
return __builtin_wasm_memory_size();
// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32()
@@ -16,7 +10,7 @@ __SIZE_TYPE__ f1(void) {
}
void f2(long delta) {
- __builtin_wasm_resize_memory(delta);
-// WEBASSEMBLY32: call void @llvm.wasm.resize.memory.i32(i32 %{{.*}})
-// WEBASSEMBLY64: call void @llvm.wasm.resize.memory.i64(i64 %{{.*}})
+ __builtin_wasm_grow_memory(delta);
+// WEBASSEMBLY32: call void @llvm.wasm.grow.memory.i32(i32 %{{.*}})
+// WEBASSEMBLY64: call void @llvm.wasm.grow.memory.i64(i64 %{{.*}})
}
More information about the cfe-commits
mailing list