[llvm] [SandboxIR] Implement UnreachableInst (PR #101856)
Julius Alexandre via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 3 22:38:21 PDT 2024
================
@@ -952,6 +957,36 @@ class StoreInst final : public Instruction {
#endif
};
+class UnreachableInst final : public Instruction {
+ /// Use UnreachableInst::create() instead of calling the constructor.
+ UnreachableInst(llvm::UnreachableInst *I, Context &Ctx)
+ : Instruction(ClassID::Unreachable, Opcode::Unreachable, I, Ctx) {}
+ friend Context;
+ 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 UnreachableInst *create(Instruction *InsertBefore, Context &Ctx);
+ static UnreachableInst *create(BasicBlock *InsertAtEnd, Context &Ctx);
+ static bool classof(const Value *From);
+ unsigned getNumSuccessors() const { return 0; }
+ unsigned getUseOperandNo(const Use &Use) const final {
+ return getUseOperandNoDefault(Use);
----------------
medievalghoul wrote:
Done.
https://github.com/llvm/llvm-project/pull/101856
More information about the llvm-commits
mailing list