diff options
author | Dan Gohman <dan433584@gmail.com> | 2018-06-01 00:05:51 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2018-06-01 00:05:51 +0000 |
commit | 9f8ee0377244f1474a19b634203e7f3b72dc40b7 (patch) | |
tree | 4aaef206770a0c90776162b43919ceaf9ca0b21c /clang/lib/CodeGen/CGBuiltin.cpp | |
parent | d69acf3b4cd2c51ba4eb2a455fd6e9e3c0d92b4b (diff) | |
download | bcm5719-llvm-9f8ee0377244f1474a19b634203e7f3b72dc40b7.tar.gz bcm5719-llvm-9f8ee0377244f1474a19b634203e7f3b72dc40b7.zip |
[WebAssembly] Update to the new names for the memory builtin functions.
The WebAssembly committee has decided on the names `memory.size` and
`memory.grow` for the memory intrinsics, so update the clang builtin
functions to follow those names, keeping both sets of old names in place
for compatibility.
llvm-svn: 333712
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 36c811f473b..2dd9c63ffab 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -11221,6 +11221,21 @@ Value *CodeGenFunction::EmitNVPTXBuiltinExpr(unsigned BuiltinID, Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { switch (BuiltinID) { + case WebAssembly::BI__builtin_wasm_memory_size: { + llvm::Type *ResultType = ConvertType(E->getType()); + Value *I = EmitScalarExpr(E->getArg(0)); + Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_memory_size, ResultType); + return Builder.CreateCall(Callee, I); + } + case WebAssembly::BI__builtin_wasm_memory_grow: { + llvm::Type *ResultType = ConvertType(E->getType()); + Value *Args[] = { + EmitScalarExpr(E->getArg(0)), + EmitScalarExpr(E->getArg(1)) + }; + 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)); |