From 51532a524edc9ab54475c122166fbfd30b7c792d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 14 Jan 2019 18:28:10 +0000 Subject: [PATCH] [WebAssembly] Remove old builtins This removes the old grow_memory and mem.grow-style builtins, leaving just the memory.grow-style builtins. Differential Revision: https://reviews.llvm.org/D56645 llvm-svn: 351089 --- clang/include/clang/Basic/BuiltinsWebAssembly.def | 8 -------- clang/lib/CodeGen/CGBuiltin.cpp | 25 ----------------------- clang/test/CodeGen/builtins-wasm.c | 24 ---------------------- 3 files changed, 57 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def b/clang/include/clang/Basic/BuiltinsWebAssembly.def index 7b201db..55931ed 100644 --- a/clang/include/clang/Basic/BuiltinsWebAssembly.def +++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def @@ -26,14 +26,6 @@ BUILTIN(__builtin_wasm_memory_size, "zIi", "n") BUILTIN(__builtin_wasm_memory_grow, "zIiz", "n") -// These are the old names. -BUILTIN(__builtin_wasm_mem_size, "zIi", "n") -BUILTIN(__builtin_wasm_mem_grow, "zIiz", "n") - -// These are the old old names. They also lack the immediate field. -BUILTIN(__builtin_wasm_current_memory, "z", "n") -BUILTIN(__builtin_wasm_grow_memory, "zz", "n") - // Floating point min/max BUILTIN(__builtin_wasm_min_f32, "fff", "nc") BUILTIN(__builtin_wasm_max_f32, "fff", "nc") diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index b1799c0..4c17602 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -13087,31 +13087,6 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_memory_grow, ResultType); return Builder.CreateCall(Callee, Args); } - case WebAssembly::BI__builtin_wasm_mem_size: { - llvm::Type *ResultType = ConvertType(E->getType()); - Value *I = EmitScalarExpr(E->getArg(0)); - Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_mem_size, ResultType); - return Builder.CreateCall(Callee, I); - } - case WebAssembly::BI__builtin_wasm_mem_grow: { - llvm::Type *ResultType = ConvertType(E->getType()); - Value *Args[] = { - EmitScalarExpr(E->getArg(0)), - EmitScalarExpr(E->getArg(1)) - }; - Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_mem_grow, ResultType); - return Builder.CreateCall(Callee, Args); - } - case WebAssembly::BI__builtin_wasm_current_memory: { - llvm::Type *ResultType = ConvertType(E->getType()); - Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_current_memory, ResultType); - return Builder.CreateCall(Callee); - } - case WebAssembly::BI__builtin_wasm_grow_memory: { - Value *X = EmitScalarExpr(E->getArg(0)); - Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_grow_memory, X->getType()); - return Builder.CreateCall(Callee, X); - } case WebAssembly::BI__builtin_wasm_throw: { Value *Tag = EmitScalarExpr(E->getArg(0)); Value *Obj = EmitScalarExpr(E->getArg(1)); diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c index 3c2288b..4f14e90 100644 --- a/clang/test/CodeGen/builtins-wasm.c +++ b/clang/test/CodeGen/builtins-wasm.c @@ -26,30 +26,6 @@ __SIZE_TYPE__ memory_grow(__SIZE_TYPE__ delta) { // WEBASSEMBLY64: call i64 @llvm.wasm.memory.grow.i64(i32 0, i64 %{{.*}}) } -__SIZE_TYPE__ mem_size(void) { - return __builtin_wasm_mem_size(0); - // WEBASSEMBLY32: call {{i.*}} @llvm.wasm.mem.size.i32(i32 0) - // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.mem.size.i64(i32 0) -} - -__SIZE_TYPE__ mem_grow(__SIZE_TYPE__ delta) { - return __builtin_wasm_mem_grow(0, delta); - // WEBASSEMBLY32: call i32 @llvm.wasm.mem.grow.i32(i32 0, i32 %{{.*}}) - // WEBASSEMBLY64: call i64 @llvm.wasm.mem.grow.i64(i32 0, i64 %{{.*}}) -} - -__SIZE_TYPE__ current_memory(void) { - return __builtin_wasm_current_memory(); - // WEBASSEMBLY32: call {{i.*}} @llvm.wasm.current.memory.i32() - // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.current.memory.i64() -} - -__SIZE_TYPE__ grow_memory(__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 %{{.*}}) -} - void throw(unsigned int tag, void *obj) { return __builtin_wasm_throw(tag, obj); // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}}) -- 2.7.4