From db1579bf88f1a45d81d3648745067afa4ac95956 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 19 Mar 2019 04:58:59 +0000 Subject: [PATCH] [WebAssembly] Change wasm.throw's first argument to an immediate Summary: `wasm.throw` builtin's first 'tag' argument should be an immediate index into the event section. Reviewers: dschuff, craig.topper Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59448 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356436 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/BuiltinsWebAssembly.def | 2 +- test/CodeGen/builtins-wasm.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/clang/Basic/BuiltinsWebAssembly.def b/include/clang/Basic/BuiltinsWebAssembly.def index e109ee620b..57ebb27ab4 100644 --- a/include/clang/Basic/BuiltinsWebAssembly.def +++ b/include/clang/Basic/BuiltinsWebAssembly.def @@ -36,7 +36,7 @@ BUILTIN(__builtin_wasm_min_f64, "ddd", "nc") BUILTIN(__builtin_wasm_max_f64, "ddd", "nc") // Exception handling builtins. -TARGET_BUILTIN(__builtin_wasm_throw, "vUiv*", "r", "exception-handling") +TARGET_BUILTIN(__builtin_wasm_throw, "vIUiv*", "r", "exception-handling") TARGET_BUILTIN(__builtin_wasm_rethrow_in_catch, "v", "r", "exception-handling") // Atomic wait and notify. diff --git a/test/CodeGen/builtins-wasm.c b/test/CodeGen/builtins-wasm.c index 3c5db7268d..4784d6ff86 100644 --- a/test/CodeGen/builtins-wasm.c +++ b/test/CodeGen/builtins-wasm.c @@ -38,10 +38,10 @@ void data_drop() { // WEBASSEMBLY64: call void @llvm.wasm.data.drop(i32 3) } -void throw(unsigned int tag, void *obj) { - return __builtin_wasm_throw(tag, obj); - // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}}) - // WEBASSEMBLY64: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}}) +void throw(void *obj) { + return __builtin_wasm_throw(0, obj); + // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 0, i8* %{{.*}}) + // WEBASSEMBLY64: call void @llvm.wasm.throw(i32 0, i8* %{{.*}}) } void rethrow_in_catch(void) { -- 2.40.0