def int_wasm_get_ehselector : Intrinsic<[llvm_i32_ty], [llvm_token_ty],
[IntrHasSideEffects]>;
-// wasm.catch.exn returns the pointer to the exception object caught by wasm
-// 'catch' instruction. This returns a single pointer, which is the case for C++
+// wasm.catch returns the pointer to the exception object caught by wasm 'catch'
+// instruction. This returns a single pointer, which is the case for C++
// exceptions. The immediate argument is an index to for a tag, which is 0 for
// C++ exceptions.
-def int_wasm_catch_exn : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty],
- [IntrHasSideEffects, ImmArg<ArgIndex<0>>]>;
+def int_wasm_catch : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty],
+ [IntrHasSideEffects, ImmArg<ArgIndex<0>>]>;
// WebAssembly EH must maintain the landingpads in the order assigned to them
// by WasmEHPrepare pass to generate landingpad table in EHStreamer. This is
//
// - After:
// catchpad ...
-// exn = wasm.catch.exn(WebAssembly::CPP_EXCEPTION);
+// exn = wasm.catch(WebAssembly::CPP_EXCEPTION);
// // Only add below in case it's not a single catch (...)
// wasm.landingpad.index(index);
// __wasm_lpad_context.lpad_index = index;
Function *LPadIndexF = nullptr; // wasm.landingpad.index() intrinsic
Function *LSDAF = nullptr; // wasm.lsda() intrinsic
Function *GetExnF = nullptr; // wasm.get.exception() intrinsic
- Function *CatchF = nullptr; // wasm.catch.exn() intrinsic
+ Function *CatchF = nullptr; // wasm.catch() intrinsic
Function *GetSelectorF = nullptr; // wasm.get.ehselector() intrinsic
FunctionCallee CallPersonalityF =
nullptr; // _Unwind_CallPersonality() wrapper
GetExnF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_get_exception);
GetSelectorF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_get_ehselector);
- // wasm.catch.exn() will be lowered down to wasm 'catch' instruction in
+ // wasm.catch() will be lowered down to wasm 'catch' instruction in
// instruction selection.
- CatchF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_catch_exn);
+ CatchF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_catch);
// _Unwind_CallPersonality() wrapper function, which calls the personality
CallPersonalityF = M.getOrInsertFunction(
return;
}
- // Replace wasm.get.exception intrinsic with wasm.catch.exn intrinsic, which
- // will be lowered to wasm 'catch' instruction. We do this mainly because
+ // Replace wasm.get.exception intrinsic with wasm.catch intrinsic, which will
+ // be lowered to wasm 'catch' instruction. We do this mainly because
// instruction selection cannot handle wasm.get.exception intrinsic's token
// argument.
Instruction *CatchCI =
return;
}
- case Intrinsic::wasm_catch_exn: {
+ case Intrinsic::wasm_catch: {
int Tag = Node->getConstantOperandVal(2);
SDValue SymNode = getTagSymNode(Tag, CurDAG);
MachineSDNode *Catch =
%struct.Temp = type { i8 }
; A single 'catch (int)' clause.
-; A wasm.catch.exn() call, wasm.lsda() call, and personality call to generate a
+; A wasm.catch() call, wasm.lsda() call, and personality call to generate a
; selector should all be genereated after the catchpad.
;
; void foo();
br i1 %matches, label %catch, label %rethrow
; CHECK: catch.start:
; CHECK-NEXT: %[[CATCHPAD:.*]] = catchpad
-; CHECK-NEXT: %[[EXN:.*]] = call i8* @llvm.wasm.catch.exn(i32 0)
+; CHECK-NEXT: %[[EXN:.*]] = call i8* @llvm.wasm.catch(i32 0)
; CHECK-NEXT: call void @llvm.wasm.landingpad.index(token %[[CATCHPAD]], i32 0)
; CHECK-NEXT: store i32 0, i32* getelementptr inbounds ({ i32, i8*, i32 }, { i32, i8*, i32 }* @__wasm_lpad_context, i32 0, i32 0)
; CHECK-NEXT: %[[LSDA:.*]] = call i8* @llvm.wasm.lsda()
}
; Two try-catches.
-; For the catchpad with a single 'catch (...)', only a wasm.catch.exn() call
-; should be generated after the catchpad; wasm.landingpad.index() and
-; personality call should NOT be generated. For the other catchpad, the argument
-; of wasm.landingpad.index() should be not 1 but 0.
+; For the catchpad with a single 'catch (...)', only a wasm.catch() call should
+; be generated after the catchpad; wasm.landingpad.index() and personality call
+; should NOT be generated. For the other catchpad, the argument of
+; wasm.landingpad.index() should be not 1 but 0.
;
; void foo();
; void test1() {