summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm-c/Core.h10
-rw-r--r--llvm/include/llvm/Bitcode/LLVMBitCodes.h1
-rw-r--r--llvm/include/llvm/IR/IRBuilder.h5
-rw-r--r--llvm/include/llvm/IR/InstVisitor.h3
-rw-r--r--llvm/include/llvm/IR/InstrTypes.h1
-rw-r--r--llvm/include/llvm/IR/Instruction.def131
-rw-r--r--llvm/include/llvm/IR/Instruction.h1
-rw-r--r--llvm/include/llvm/IR/Instructions.h87
8 files changed, 169 insertions, 70 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 3bb8828fe84..14675854266 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -251,10 +251,11 @@ typedef enum {
LLVMLandingPad = 59,
LLVMCleanupRet = 61,
LLVMCatchRet = 62,
- LLVMCatchPad = 63,
- LLVMTerminatePad = 64,
- LLVMCleanupPad = 65,
- LLVMCatchEndPad = 66
+ LLVMCatchPad = 63,
+ LLVMTerminatePad = 64,
+ LLVMCleanupPad = 65,
+ LLVMCatchEndPad = 66,
+ LLVMCleanupEndPad = 67
} LLVMOpcode;
@@ -1228,6 +1229,7 @@ LLVMTypeRef LLVMX86MMXType(void);
macro(CatchPadInst) \
macro(TerminatePadInst) \
macro(CatchEndPadInst) \
+ macro(CleanupEndPadInst) \
macro(UnaryInstruction) \
macro(AllocaInst) \
macro(CastInst) \
diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
index 66bc5d21f37..1d42ec08145 100644
--- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -362,6 +362,7 @@ namespace bitc {
FUNC_CODE_INST_TERMINATEPAD = 51, // TERMINATEPAD: [bb#,num,args...]
FUNC_CODE_INST_CLEANUPPAD = 52, // CLEANUPPAD: [num,args...]
FUNC_CODE_INST_CATCHENDPAD = 53, // CATCHENDPAD: [] or [bb#]
+ FUNC_CODE_INST_CLEANUPENDPAD = 54, // CLEANUPENDPAD: [val] or [val,bb#]
};
enum UseListCodes {
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 044b5c59f7c..b7299dd3a45 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -681,6 +681,11 @@ public:
return Insert(CleanupReturnInst::Create(CleanupPad, UnwindBB));
}
+ CatchEndPadInst *CreateCleanupEndPad(CleanupPadInst *CleanupPad,
+ BasicBlock *UnwindBB = nullptr) {
+ return Insert(CleanupEndPadInst::Create(CleanupPad, UnwindBB));
+ }
+
CatchPadInst *CreateCatchPad(BasicBlock *NormalDest, BasicBlock *UnwindDest,
ArrayRef<Value *> Args, const Twine &Name = "") {
return Insert(CatchPadInst::Create(NormalDest, UnwindDest, Args), Name);
diff --git a/llvm/include/llvm/IR/InstVisitor.h b/llvm/include/llvm/IR/InstVisitor.h
index b6322044624..0fe88980b41 100644
--- a/llvm/include/llvm/IR/InstVisitor.h
+++ b/llvm/include/llvm/IR/InstVisitor.h
@@ -170,7 +170,8 @@ public:
RetTy visitResumeInst(ResumeInst &I) { DELEGATE(TerminatorInst);}
RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);}
RetTy visitCleanupReturnInst(CleanupReturnInst &I) { DELEGATE(TerminatorInst);}
- RetTy visitCatchReturnInst(CatchReturnInst &I) { DELEGATE(TerminatorInst);}
+ RetTy visitCleanupEndPadInst(CleanupEndPadInst &I) { DELEGATE(TerminatorInst); }
+ RetTy visitCatchReturnInst(CatchReturnInst &I) { DELEGATE(TerminatorInst); }
RetTy visitCatchPadInst(CatchPadInst &I) { DELEGATE(TerminatorInst);}
RetTy visitCatchEndPadInst(CatchEndPadInst &I) { DELEGATE(TerminatorInst); }
RetTy visitTerminatePadInst(TerminatePadInst &I) { DELEGATE(TerminatorInst);}
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 189c5bc6327..d84e66c50a3 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -82,6 +82,7 @@ public:
case Instruction::CatchPad:
case Instruction::CatchEndPad:
case Instruction::CatchRet:
+ case Instruction::CleanupEndPad:
case Instruction::CleanupRet:
case Instruction::Invoke:
case Instruction::Resume:
diff --git a/llvm/include/llvm/IR/Instruction.def b/llvm/include/llvm/IR/Instruction.def
index 9af666204da..72263f06ef4 100644
--- a/llvm/include/llvm/IR/Instruction.def
+++ b/llvm/include/llvm/IR/Instruction.def
@@ -103,83 +103,84 @@ HANDLE_TERM_INST ( 6, Resume , ResumeInst)
HANDLE_TERM_INST ( 7, Unreachable , UnreachableInst)
HANDLE_TERM_INST ( 8, CleanupRet , CleanupReturnInst)
HANDLE_TERM_INST ( 9, CatchRet , CatchReturnInst)
-HANDLE_TERM_INST (10, CatchPad , CatchPadInst)
-HANDLE_TERM_INST (11, TerminatePad, TerminatePadInst)
-HANDLE_TERM_INST (12, CatchEndPad , CatchEndPadInst)
- LAST_TERM_INST (12)
+HANDLE_TERM_INST (10, CatchPad , CatchPadInst)
+HANDLE_TERM_INST (11, TerminatePad , TerminatePadInst)
+HANDLE_TERM_INST (12, CatchEndPad , CatchEndPadInst)
+HANDLE_TERM_INST (13, CleanupEndPad , CleanupEndPadInst)
+ LAST_TERM_INST (13)
// Standard binary operators...
- FIRST_BINARY_INST(13)
-HANDLE_BINARY_INST(13, Add , BinaryOperator)
-HANDLE_BINARY_INST(14, FAdd , BinaryOperator)
-HANDLE_BINARY_INST(15, Sub , BinaryOperator)
-HANDLE_BINARY_INST(16, FSub , BinaryOperator)
-HANDLE_BINARY_INST(17, Mul , BinaryOperator)
-HANDLE_BINARY_INST(18, FMul , BinaryOperator)
-HANDLE_BINARY_INST(19, UDiv , BinaryOperator)
-HANDLE_BINARY_INST(20, SDiv , BinaryOperator)
-HANDLE_BINARY_INST(21, FDiv , BinaryOperator)
-HANDLE_BINARY_INST(22, URem , BinaryOperator)
-HANDLE_BINARY_INST(23, SRem , BinaryOperator)
-HANDLE_BINARY_INST(24, FRem , BinaryOperator)
+ FIRST_BINARY_INST(14)
+HANDLE_BINARY_INST(14, Add , BinaryOperator)
+HANDLE_BINARY_INST(15, FAdd , BinaryOperator)
+HANDLE_BINARY_INST(16, Sub , BinaryOperator)
+HANDLE_BINARY_INST(17, FSub , BinaryOperator)
+HANDLE_BINARY_INST(18, Mul , BinaryOperator)
+HANDLE_BINARY_INST(19, FMul , BinaryOperator)
+HANDLE_BINARY_INST(20, UDiv , BinaryOperator)
+HANDLE_BINARY_INST(21, SDiv , BinaryOperator)
+HANDLE_BINARY_INST(22, FDiv , BinaryOperator)
+HANDLE_BINARY_INST(23, URem , BinaryOperator)
+HANDLE_BINARY_INST(24, SRem , BinaryOperator)
+HANDLE_BINARY_INST(25, FRem , BinaryOperator)
// Logical operators (integer operands)
-HANDLE_BINARY_INST(25, Shl , BinaryOperator) // Shift left (logical)
-HANDLE_BINARY_INST(26, LShr , BinaryOperator) // Shift right (logical)
-HANDLE_BINARY_INST(27, AShr , BinaryOperator) // Shift right (arithmetic)
-HANDLE_BINARY_INST(28, And , BinaryOperator)
-HANDLE_BINARY_INST(29, Or , BinaryOperator)
-HANDLE_BINARY_INST(30, Xor , BinaryOperator)
- LAST_BINARY_INST(30)
+HANDLE_BINARY_INST(26, Shl , BinaryOperator) // Shift left (logical)
+HANDLE_BINARY_INST(27, LShr , BinaryOperator) // Shift right (logical)
+HANDLE_BINARY_INST(28, AShr , BinaryOperator) // Shift right (arithmetic)
+HANDLE_BINARY_INST(29, And , BinaryOperator)
+HANDLE_BINARY_INST(30, Or , BinaryOperator)
+HANDLE_BINARY_INST(31, Xor , BinaryOperator)
+ LAST_BINARY_INST(31)
// Memory operators...
- FIRST_MEMORY_INST(31)
-HANDLE_MEMORY_INST(31, Alloca, AllocaInst) // Stack management
-HANDLE_MEMORY_INST(32, Load , LoadInst ) // Memory manipulation instrs
-HANDLE_MEMORY_INST(33, Store , StoreInst )
-HANDLE_MEMORY_INST(34, GetElementPtr, GetElementPtrInst)
-HANDLE_MEMORY_INST(35, Fence , FenceInst )
-HANDLE_MEMORY_INST(36, AtomicCmpXchg , AtomicCmpXchgInst )
-HANDLE_MEMORY_INST(37, AtomicRMW , AtomicRMWInst )
- LAST_MEMORY_INST(37)
+ FIRST_MEMORY_INST(32)
+HANDLE_MEMORY_INST(32, Alloca, AllocaInst) // Stack management
+HANDLE_MEMORY_INST(33, Load , LoadInst ) // Memory manipulation instrs
+HANDLE_MEMORY_INST(34, Store , StoreInst )
+HANDLE_MEMORY_INST(35, GetElementPtr, GetElementPtrInst)
+HANDLE_MEMORY_INST(36, Fence , FenceInst )
+HANDLE_MEMORY_INST(37, AtomicCmpXchg , AtomicCmpXchgInst )
+HANDLE_MEMORY_INST(38, AtomicRMW , AtomicRMWInst )
+ LAST_MEMORY_INST(38)
// Cast operators ...
// NOTE: The order matters here because CastInst::isEliminableCastPair
// NOTE: (see Instructions.cpp) encodes a table based on this ordering.
- FIRST_CAST_INST(38)
-HANDLE_CAST_INST(38, Trunc , TruncInst ) // Truncate integers
-HANDLE_CAST_INST(39, ZExt , ZExtInst ) // Zero extend integers
-HANDLE_CAST_INST(40, SExt , SExtInst ) // Sign extend integers
-HANDLE_CAST_INST(41, FPToUI , FPToUIInst ) // floating point -> UInt
-HANDLE_CAST_INST(42, FPToSI , FPToSIInst ) // floating point -> SInt
-HANDLE_CAST_INST(43, UIToFP , UIToFPInst ) // UInt -> floating point
-HANDLE_CAST_INST(44, SIToFP , SIToFPInst ) // SInt -> floating point
-HANDLE_CAST_INST(45, FPTrunc , FPTruncInst ) // Truncate floating point
-HANDLE_CAST_INST(46, FPExt , FPExtInst ) // Extend floating point
-HANDLE_CAST_INST(47, PtrToInt, PtrToIntInst) // Pointer -> Integer
-HANDLE_CAST_INST(48, IntToPtr, IntToPtrInst) // Integer -> Pointer
-HANDLE_CAST_INST(49, BitCast , BitCastInst ) // Type cast
-HANDLE_CAST_INST(50, AddrSpaceCast, AddrSpaceCastInst) // addrspace cast
- LAST_CAST_INST(50)
+ FIRST_CAST_INST(39)
+HANDLE_CAST_INST(39, Trunc , TruncInst ) // Truncate integers
+HANDLE_CAST_INST(40, ZExt , ZExtInst ) // Zero extend integers
+HANDLE_CAST_INST(41, SExt , SExtInst ) // Sign extend integers
+HANDLE_CAST_INST(42, FPToUI , FPToUIInst ) // floating point -> UInt
+HANDLE_CAST_INST(43, FPToSI , FPToSIInst ) // floating point -> SInt
+HANDLE_CAST_INST(44, UIToFP , UIToFPInst ) // UInt -> floating point
+HANDLE_CAST_INST(45, SIToFP , SIToFPInst ) // SInt -> floating point
+HANDLE_CAST_INST(46, FPTrunc , FPTruncInst ) // Truncate floating point
+HANDLE_CAST_INST(47, FPExt , FPExtInst ) // Extend floating point
+HANDLE_CAST_INST(48, PtrToInt, PtrToIntInst) // Pointer -> Integer
+HANDLE_CAST_INST(49, IntToPtr, IntToPtrInst) // Integer -> Pointer
+HANDLE_CAST_INST(50, BitCast , BitCastInst ) // Type cast
+HANDLE_CAST_INST(51, AddrSpaceCast, AddrSpaceCastInst) // addrspace cast
+ LAST_CAST_INST(51)
// Other operators...
- FIRST_OTHER_INST(51)
-HANDLE_OTHER_INST(51, ICmp , ICmpInst ) // Integer comparison instruction
-HANDLE_OTHER_INST(52, FCmp , FCmpInst ) // Floating point comparison instr.
-HANDLE_OTHER_INST(53, PHI , PHINode ) // PHI node instruction
-HANDLE_OTHER_INST(54, Call , CallInst ) // Call a function
-HANDLE_OTHER_INST(55, Select , SelectInst ) // select instruction
-HANDLE_OTHER_INST(56, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(57, UserOp2, Instruction) // Internal to passes only
-HANDLE_OTHER_INST(58, VAArg , VAArgInst ) // vaarg instruction
-HANDLE_OTHER_INST(59, ExtractElement, ExtractElementInst)// extract from vector
-HANDLE_OTHER_INST(60, InsertElement, InsertElementInst) // insert into vector
-HANDLE_OTHER_INST(61, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
-HANDLE_OTHER_INST(62, ExtractValue, ExtractValueInst)// extract from aggregate
-HANDLE_OTHER_INST(63, InsertValue, InsertValueInst) // insert into aggregate
-HANDLE_OTHER_INST(64, LandingPad, LandingPadInst) // Landing pad instruction.
-HANDLE_OTHER_INST(65, CleanupPad, CleanupPadInst)
- LAST_OTHER_INST(65)
+ FIRST_OTHER_INST(52)
+HANDLE_OTHER_INST(52, ICmp , ICmpInst ) // Integer comparison instruction
+HANDLE_OTHER_INST(53, FCmp , FCmpInst ) // Floating point comparison instr.
+HANDLE_OTHER_INST(54, PHI , PHINode ) // PHI node instruction
+HANDLE_OTHER_INST(55, Call , CallInst ) // Call a function
+HANDLE_OTHER_INST(56, Select , SelectInst ) // select instruction
+HANDLE_OTHER_INST(57, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(58, UserOp2, Instruction) // Internal to passes only
+HANDLE_OTHER_INST(59, VAArg , VAArgInst ) // vaarg instruction
+HANDLE_OTHER_INST(60, ExtractElement, ExtractElementInst)// extract from vector
+HANDLE_OTHER_INST(61, InsertElement, InsertElementInst) // insert into vector
+HANDLE_OTHER_INST(62, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
+HANDLE_OTHER_INST(63, ExtractValue, ExtractValueInst)// extract from aggregate
+HANDLE_OTHER_INST(64, InsertValue, InsertValueInst) // insert into aggregate
+HANDLE_OTHER_INST(65, LandingPad, LandingPadInst) // Landing pad instruction.
+HANDLE_OTHER_INST(66, CleanupPad, CleanupPadInst)
+ LAST_OTHER_INST(66)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 1ddccd3caaa..000e8545836 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -396,6 +396,7 @@ public:
case Instruction::CatchPad:
case Instruction::CatchEndPad:
case Instruction::CleanupPad:
+ case Instruction::CleanupEndPad:
case Instruction::LandingPad:
case Instruction::TerminatePad:
return true;
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index f9dce102787..d979b393066 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -4020,6 +4020,93 @@ struct OperandTraits<CatchReturnInst>
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CatchReturnInst, Value)
//===----------------------------------------------------------------------===//
+// CleanupEndPadInst Class
+//===----------------------------------------------------------------------===//
+
+class CleanupEndPadInst : public TerminatorInst {
+private:
+ CleanupEndPadInst(const CleanupEndPadInst &CEPI);
+
+ void init(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB);
+ CleanupEndPadInst(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB,
+ unsigned Values, Instruction *InsertBefore = nullptr);
+ CleanupEndPadInst(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB,
+ unsigned Values, BasicBlock *InsertAtEnd);
+
+protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ CleanupEndPadInst *cloneImpl() const;
+
+public:
+ static CleanupEndPadInst *Create(CleanupPadInst *CleanupPad,
+ BasicBlock *UnwindBB = nullptr,
+ Instruction *InsertBefore = nullptr) {
+ unsigned Values = UnwindBB ? 2 : 1;
+ return new (Values)
+ CleanupEndPadInst(CleanupPad, UnwindBB, Values, InsertBefore);
+ }
+ static CleanupEndPadInst *Create(CleanupPadInst *CleanupPad,
+ BasicBlock *UnwindBB,
+ BasicBlock *InsertAtEnd) {
+ unsigned Values = UnwindBB ? 2 : 1;
+ return new (Values)
+ CleanupEndPadInst(CleanupPad, UnwindBB, Values, InsertAtEnd);
+ }
+
+ /// Provide fast operand accessors
+ DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
+
+ bool hasUnwindDest() const { return getSubclassDataFromInstruction() & 1; }
+ bool unwindsToCaller() const { return !hasUnwindDest(); }
+
+ unsigned getNumSuccessors() const { return hasUnwindDest() ? 1 : 0; }
+
+ /// Convenience accessors
+ CleanupPadInst *getCleanupPad() const {
+ return cast<CleanupPadInst>(Op<-1>());
+ }
+ void setCleanupPad(CleanupPadInst *CleanupPad) {
+ assert(CleanupPad);
+ Op<-1>() = CleanupPad;
+ }
+
+ BasicBlock *getUnwindDest() const {
+ return hasUnwindDest() ? cast<BasicBlock>(Op<-2>()) : nullptr;
+ }
+ void setUnwindDest(BasicBlock *NewDest) {
+ assert(hasUnwindDest());
+ assert(NewDest);
+ Op<-2>() = NewDest;
+ }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::CleanupEndPad);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+
+private:
+ BasicBlock *getSuccessorV(unsigned Idx) const override;
+ unsigned getNumSuccessorsV() const override;
+ void setSuccessorV(unsigned Idx, BasicBlock *B) override;
+
+ // Shadow Instruction::setInstructionSubclassData with a private forwarding
+ // method so that subclasses cannot accidentally use it.
+ void setInstructionSubclassData(unsigned short D) {
+ Instruction::setInstructionSubclassData(D);
+ }
+};
+
+template <>
+struct OperandTraits<CleanupEndPadInst>
+ : public VariadicOperandTraits<CleanupEndPadInst, /*MINARITY=*/1> {};
+
+DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CleanupEndPadInst, Value)
+
+//===----------------------------------------------------------------------===//
// CleanupReturnInst Class
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud