[llvm] [WebAssembly] Make llvm.wasm.throw invokable (PR #128104)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 17:46:46 PST 2025
================
@@ -3360,10 +3360,23 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) {
case Intrinsic::experimental_gc_statepoint:
LowerStatepoint(cast<GCStatepointInst>(I), EHPadBB);
break;
+ // wasm_throw, 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.
+ case Intrinsic::wasm_throw: {
+ SmallVector<SDValue, 8> Ops;
+ Ops.push_back(getControlRoot()); // inchain for the terminator node
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+ Ops.push_back(
+ DAG.getTargetConstant(Intrinsic::wasm_throw, getCurSDLoc(),
+ TLI.getPointerTy(DAG.getDataLayout())));
+ Ops.push_back(getValue(I.getArgOperand(0))); // tag
+ Ops.push_back(getValue(I.getArgOperand(1))); // thrown value
----------------
aheejin wrote:
Done: https://github.com/llvm/llvm-project/pull/128104/commits/aa5fafda86059dded2dc5573ec160bbe0a786ba5
https://github.com/llvm/llvm-project/pull/128104
More information about the llvm-commits
mailing list