// Exception handling builtins.
TARGET_BUILTIN(__builtin_wasm_throw, "vIUiv*", "r", "exception-handling")
-TARGET_BUILTIN(__builtin_wasm_rethrow_in_catch, "v", "r", "exception-handling")
+TARGET_BUILTIN(__builtin_wasm_rethrow, "v", "r", "exception-handling")
// Atomic wait and notify.
TARGET_BUILTIN(__builtin_wasm_memory_atomic_wait32, "ii*iLLi", "n", "atomics")
Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_throw);
return Builder.CreateCall(Callee, {Tag, Obj});
}
- case WebAssembly::BI__builtin_wasm_rethrow_in_catch: {
- Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_rethrow_in_catch);
+ case WebAssembly::BI__builtin_wasm_rethrow: {
+ Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_rethrow);
return Builder.CreateCall(Callee);
}
case WebAssembly::BI__builtin_wasm_memory_atomic_wait32: {
assert(RethrowBlock != WasmCatchStartBlock && RethrowBlock->empty());
Builder.SetInsertPoint(RethrowBlock);
llvm::Function *RethrowInCatchFn =
- CGM.getIntrinsic(llvm::Intrinsic::wasm_rethrow_in_catch);
+ CGM.getIntrinsic(llvm::Intrinsic::wasm_rethrow);
EmitNoreturnRuntimeCallOrInvoke(RethrowInCatchFn, {});
}
// WEBASSEMBLY64: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
}
-void rethrow_in_catch(void) {
- return __builtin_wasm_rethrow_in_catch();
- // WEBASSEMBLY32: call void @llvm.wasm.rethrow.in.catch()
- // WEBASSEMBLY64: call void @llvm.wasm.rethrow.in.catch()
+void rethrow(void) {
+ return __builtin_wasm_rethrow();
+ // WEBASSEMBLY32: call void @llvm.wasm.rethrow()
+ // WEBASSEMBLY64: call void @llvm.wasm.rethrow()
}
int memory_atomic_wait32(int *addr, int expected, long long timeout) {
// CHECK-NEXT: br label %[[TRY_CONT_BB]]
// CHECK: [[RETHROW_BB]]:
-// CHECK-NEXT: call void @llvm.wasm.rethrow.in.catch() {{.*}} [ "funclet"(token %[[CATCHPAD]]) ]
+// CHECK-NEXT: call void @llvm.wasm.rethrow() {{.*}} [ "funclet"(token %[[CATCHPAD]]) ]
// CHECK-NEXT: unreachable
// Single catch-all
// CHECK: catchret from %[[CATCHPAD]] to label %{{.*}}
// CHECK: [[RETHROW_BB]]:
-// CHECK-NEXT: invoke void @llvm.wasm.rethrow.in.catch() {{.*}} [ "funclet"(token %[[CATCHPAD]]) ]
+// CHECK-NEXT: invoke void @llvm.wasm.rethrow() {{.*}} [ "funclet"(token %[[CATCHPAD]]) ]
// CHECK-NEXT: to label %[[UNREACHABLE_BB:.*]] unwind label %[[EHCLEANUP_BB1:.*]]
// CHECK: [[EHCLEANUP_BB2]]:
// CHECK: catchret from %[[CATCHPAD0]] to label
-// CHECK: invoke void @llvm.wasm.rethrow.in.catch() {{.*}} [ "funclet"(token %[[CATCHPAD0]]) ]
+// CHECK: invoke void @llvm.wasm.rethrow() {{.*}} [ "funclet"(token %[[CATCHPAD0]]) ]
// CHECK: %[[CLEANUPPAD1:.*]] = cleanuppad within %[[CATCHPAD0]] []
// CHECK: cleanupret from %[[CLEANUPPAD1]] unwind label
// CHECK: catchret from %[[CATCHPAD1]] to label
-// CHECK: invoke void @llvm.wasm.rethrow.in.catch() {{.*}} [ "funclet"(token %[[CATCHPAD1]]) ]
+// CHECK: invoke void @llvm.wasm.rethrow() {{.*}} [ "funclet"(token %[[CATCHPAD1]]) ]
// CHECK: catchret from %[[CATCHPAD0]] to label
-// CHECK: call void @llvm.wasm.rethrow.in.catch() {{.*}} [ "funclet"(token %[[CATCHPAD0]]) ]
+// CHECK: call void @llvm.wasm.rethrow() {{.*}} [ "funclet"(token %[[CATCHPAD0]]) ]
// CHECK: unreachable
// CHECK: %[[CLEANUPPAD0:.*]] = cleanuppad within %[[CATCHPAD1]] []
//===----------------------------------------------------------------------===//
// throw / rethrow
+// The immediate argument is an index to a tag, which is 0 for C++.
def int_wasm_throw : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty],
[Throws, IntrNoReturn, ImmArg<ArgIndex<0>>]>;
-def int_wasm_rethrow_in_catch : Intrinsic<[], [], [Throws, IntrNoReturn]>;
+def int_wasm_rethrow : Intrinsic<[], [], [Throws, IntrNoReturn]>;
// Since wasm does not use landingpad instructions, these instructions return
// exception pointer and selector values until we lower them in WasmEHPrepare.
}
}
-// For wasm, there's alwyas a single catch pad attached to a catchswitch, and
+// For wasm, there's always a single catch pad attached to a catchswitch, and
// the control flow always stops at the single catch pad, as it does for a
// cleanup pad. In case the exception caught is not of the types the catch pad
// catches, it will be rethrown by a rethrow.
case Intrinsic::experimental_gc_statepoint:
LowerStatepoint(cast<GCStatepointInst>(I), EHPadBB);
break;
- case Intrinsic::wasm_rethrow_in_catch: {
+ case Intrinsic::wasm_rethrow: {
// This is usually done in visitTargetIntrinsic, but this intrinsic is
// special because it can be invoked, so we manually lower it to a DAG
// node here.
Ops.push_back(getRoot()); // inchain
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
Ops.push_back(
- DAG.getTargetConstant(Intrinsic::wasm_rethrow_in_catch, getCurSDLoc(),
+ DAG.getTargetConstant(Intrinsic::wasm_rethrow, getCurSDLoc(),
TLI.getPointerTy(DAG.getDataLayout())));
SDVTList VTs = DAG.getVTList(ArrayRef<EVT>({MVT::Other})); // outchain
DAG.setRoot(DAG.getNode(ISD::INTRINSIC_VOID, getCurSDLoc(), VTs, Ops));
F->getIntrinsicID() == Intrinsic::experimental_patchpoint_void ||
F->getIntrinsicID() == Intrinsic::experimental_patchpoint_i64 ||
F->getIntrinsicID() == Intrinsic::experimental_gc_statepoint ||
- F->getIntrinsicID() == Intrinsic::wasm_rethrow_in_catch,
+ F->getIntrinsicID() == Intrinsic::wasm_rethrow,
"Cannot invoke an intrinsic other than donothing, patchpoint, "
"statepoint, coro_resume or coro_destroy",
&I);
"throw \t$tag", "throw \t$tag", 0x08>;
defm RETHROW : I<(outs), (ins EXNREF:$exn), (outs), (ins), [],
"rethrow \t$exn", "rethrow", 0x09>;
-// Pseudo instruction to be the lowering target of int_wasm_rethrow_in_catch
-// intrinsic. Will be converted to the real rethrow instruction later.
+// Pseudo instruction to be the lowering target of int_wasm_rethrow intrinsic.
+// Will be converted to the real rethrow instruction later.
let isPseudo = 1 in
-defm RETHROW_IN_CATCH : NRI<(outs), (ins), [(int_wasm_rethrow_in_catch)],
+defm RETHROW_IN_CATCH : NRI<(outs), (ins), [(int_wasm_rethrow)],
"rethrow_in_catch", 0>;
} // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1
catchret from %1 to label %try.cont
rethrow: ; preds = %catch.fallthrough
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont: ; preds = %catch, %catch2, %entry
catchret from %9 to label %try.cont
rethrow5: ; preds = %catch.start3
- invoke void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %9) ]
+ invoke void @llvm.wasm.rethrow() [ "funclet"(token %9) ]
to label %unreachable unwind label %ehcleanup9
try.cont: ; preds = %invoke.cont8, %catch
catchret from %1 to label %try.cont11
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont11: ; preds = %try.cont, %entry
catchret from %1 to label %for.inc
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() #6 [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() #6 [ "funclet"(token %1) ]
unreachable
for.inc: ; preds = %invoke.cont2, %for.body
declare i32 @__gxx_wasm_personality_v0(...)
declare i8* @llvm.wasm.get.exception(token)
declare i32 @llvm.wasm.get.ehselector(token)
-declare void @llvm.wasm.rethrow.in.catch()
+declare void @llvm.wasm.rethrow()
declare i32 @llvm.eh.typeid.for(i8*)
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()
catchret from %1 to label %try.cont
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont: ; preds = %catch, %entry
catchret from %1 to label %try.cont
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont: ; preds = %invoke.cont1, %entry
declare void @llvm.wasm.throw(i32, i8*)
declare i8* @llvm.wasm.get.exception(token)
declare i32 @llvm.wasm.get.ehselector(token)
-declare void @llvm.wasm.rethrow.in.catch()
+declare void @llvm.wasm.rethrow()
declare i32 @llvm.eh.typeid.for(i8*)
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()
; CHECK-NEXT: call i8* @__cxa_begin_catch(i8* %[[EXN]])
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont: ; preds = %entry, %catch
catchret from %6 to label %try.cont7
rethrow: ; preds = %catch.start3
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %6) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %6) ]
unreachable
try.cont7: ; preds = %try.cont, %catch4
catchret from %7 to label %try.cont
rethrow5: ; preds = %catch.start3
- invoke void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %7) ]
+ invoke void @llvm.wasm.rethrow() [ "funclet"(token %7) ]
to label %unreachable unwind label %ehcleanup
try.cont: ; preds = %catch, %catch6
catchret from %1 to label %try.cont9
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont9: ; preds = %entry, %try.cont
catchret from %6 to label %try.cont
rethrow: ; preds = %catch.start3
- invoke void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %6) ]
+ invoke void @llvm.wasm.rethrow() [ "funclet"(token %6) ]
to label %unreachable unwind label %ehcleanup
try.cont: ; preds = %catch.start, %catch4
catchret from %14 to label %try.cont
rethrow10: ; preds = %catch.start8
- invoke void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %14) ]
+ invoke void @llvm.wasm.rethrow() [ "funclet"(token %14) ]
to label %unreachable unwind label %ehcleanup
try.cont: ; preds = %catch.start3, %catch11
catchret from %1 to label %try.cont19
rethrow: ; preds = %catch.start
- call void @llvm.wasm.rethrow.in.catch() [ "funclet"(token %1) ]
+ call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
try.cont19: ; preds = %entry, %try.cont16
declare i32 @llvm.wasm.get.ehselector(token)
declare i32 @llvm.eh.typeid.for(i8*)
declare void @llvm.wasm.throw(i32, i8*)
-declare void @llvm.wasm.rethrow.in.catch()
+declare void @llvm.wasm.rethrow()
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()
declare void @__clang_call_terminate(i8*)