[IR] Reformulate LLVM's EH funclet IR
[oota-llvm.git] / include / llvm / IR / Instruction.h
index 77ba87c6b664b39512748d7207c1af17a905c575..d7456a2c2fc5418d5618560dc5d5288f69988574 100644 (file)
@@ -109,6 +109,7 @@ public:
   bool isBinaryOp() const { return isBinaryOp(getOpcode()); }
   bool isShift() { return isShift(getOpcode()); }
   bool isCast() const { return isCast(getOpcode()); }
+  bool isFuncletPad() const { return isFuncletPad(getOpcode()); }
 
   static const char* getOpcodeName(unsigned OpCode);
 
@@ -141,6 +142,11 @@ public:
     return OpCode >= CastOpsBegin && OpCode < CastOpsEnd;
   }
 
+  /// @brief Determine if the OpCode is one of the FuncletPadInst instructions.
+  static inline bool isFuncletPad(unsigned OpCode) {
+    return OpCode >= FuncletPadOpsBegin && OpCode < FuncletPadOpsEnd;
+  }
+
   //===--------------------------------------------------------------------===//
   // Metadata manipulation.
   //===--------------------------------------------------------------------===//
@@ -386,10 +392,9 @@ public:
   /// \brief Return true if the instruction is a variety of EH-block.
   bool isEHPad() const {
     switch (getOpcode()) {
+    case Instruction::CatchSwitch:
     case Instruction::CatchPad:
-    case Instruction::CatchEndPad:
     case Instruction::CleanupPad:
-    case Instruction::CleanupEndPad:
     case Instruction::LandingPad:
     case Instruction::TerminatePad:
       return true;
@@ -478,6 +483,13 @@ public:
 #include "llvm/IR/Instruction.def"
   };
 
+  enum FuncletPadOps {
+#define  FIRST_FUNCLETPAD_INST(N)             FuncletPadOpsBegin = N,
+#define HANDLE_FUNCLETPAD_INST(N, OPC, CLASS) OPC = N,
+#define   LAST_FUNCLETPAD_INST(N)             FuncletPadOpsEnd = N+1
+#include "llvm/IR/Instruction.def"
+  };
+
   enum OtherOps {
 #define  FIRST_OTHER_INST(N)             OtherOpsBegin = N,
 #define HANDLE_OTHER_INST(N, OPC, CLASS) OPC = N,