From 4f7d65a7a24a26018f39f4e1143ead64d95559fc Mon Sep 17 00:00:00 2001 From: Derek Schuff <dschuff@google.com> Date: Mon, 2 May 2016 17:26:19 +0000 Subject: [PATCH] [WebAssembly] Rename memory_size intrinsic to current_memory This follows the recent change in the wasm spec. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268256 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/BuiltinsWebAssembly.def | 4 ++-- lib/CodeGen/CGBuiltin.cpp | 4 ++-- test/CodeGen/builtins-wasm.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/clang/Basic/BuiltinsWebAssembly.def b/include/clang/Basic/BuiltinsWebAssembly.def index 975433523ad..97b59a1fd86 100644 --- a/include/clang/Basic/BuiltinsWebAssembly.def +++ b/include/clang/Basic/BuiltinsWebAssembly.def @@ -16,9 +16,9 @@ // The format of this database matches clang/Basic/Builtins.def. -// Note that memory_size is not "c" (readnone) because it must be sequenced with +// Note that current_memory is not "c" (readnone) because it must be sequenced with // respect to grow_memory calls. -BUILTIN(__builtin_wasm_memory_size, "z", "n") +BUILTIN(__builtin_wasm_current_memory, "z", "n") BUILTIN(__builtin_wasm_grow_memory, "vz", "n") #undef BUILTIN diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 56438ae613b..a68394bfc71 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -7441,9 +7441,9 @@ Value *CodeGenFunction::EmitNVPTXBuiltinExpr(unsigned BuiltinID, Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { switch (BuiltinID) { - case WebAssembly::BI__builtin_wasm_memory_size: { + case WebAssembly::BI__builtin_wasm_current_memory: { llvm::Type *ResultType = ConvertType(E->getType()); - Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_memory_size, ResultType); + Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_current_memory, ResultType); return Builder.CreateCall(Callee); } case WebAssembly::BI__builtin_wasm_grow_memory: { diff --git a/test/CodeGen/builtins-wasm.c b/test/CodeGen/builtins-wasm.c index 15f2e9dbf32..135e32976b7 100644 --- a/test/CodeGen/builtins-wasm.c +++ b/test/CodeGen/builtins-wasm.c @@ -4,9 +4,9 @@ // RUN: | FileCheck %s -check-prefix=WEBASSEMBLY64 __SIZE_TYPE__ f1(void) { - return __builtin_wasm_memory_size(); -// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32() -// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.memory.size.i64() + return __builtin_wasm_current_memory(); +// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.current.memory.i32() +// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.current.memory.i64() } void f2(long delta) { -- GitLab