[llvm] [SandboxIR] Implement InvokeInst (PR #100796)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 13:00:07 PDT 2024
================
@@ -1029,6 +1033,66 @@ class CallInst final : public CallBase {
#endif
};
+class InvokeInst final : public CallBase {
+ /// Use Context::createInvokeInst(). Don't call the
+ /// constructor directly.
+ InvokeInst(llvm::Instruction *I, Context &Ctx)
+ : CallBase(ClassID::Invoke, Opcode::Invoke, I, Ctx) {}
+ friend class Context; // For accessing the constructor in
+ // create*()
+ Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final {
+ return getOperandUseDefault(OpIdx, Verify);
+ }
+ SmallVector<llvm::Instruction *, 1> getLLVMInstrs() const final {
+ return {cast<llvm::Instruction>(Val)};
+ }
+
+public:
+ static InvokeInst *create(FunctionType *FTy, Value *Func,
+ BasicBlock *IfNormal, BasicBlock *IfException,
+ ArrayRef<Value *> Args, BBIterator WhereIt,
+ BasicBlock *WhereBB, Context &Ctx,
+ const Twine &NameStr = "");
+ static InvokeInst *create(FunctionType *FTy, Value *Func,
+ BasicBlock *IfNormal, BasicBlock *IfException,
+ ArrayRef<Value *> Args, Instruction *InsertBefore,
+ Context &Ctx, const Twine &NameStr = "");
+
----------------
vporpo wrote:
Yes, we should introduce a similar class in SandboxIR.
https://github.com/llvm/llvm-project/pull/100796
More information about the llvm-commits
mailing list