* InvokeInst: Get the landingpad instruction associated with this invoke.
* LandingPadInst: A method to reserve extra space for clauses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136325
91177308-0d34-0410-b5e6-
96231b3b80d8
/// getNumClauses - Get the number of clauses for this landing pad.
unsigned getNumClauses() const { return getNumOperands() - 1; }
/// getNumClauses - Get the number of clauses for this landing pad.
unsigned getNumClauses() const { return getNumOperands() - 1; }
+ /// reserveClauses - Grow the size of the operand list to accomodate the new
+ /// number of clauses.
+ void reserveClauses(unsigned Size);
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const LandingPadInst *) { return true; }
static inline bool classof(const Instruction *I) {
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const LandingPadInst *) { return true; }
static inline bool classof(const Instruction *I) {
Op<-1>() = reinterpret_cast<Value*>(B);
}
Op<-1>() = reinterpret_cast<Value*>(B);
}
+ // getLandingPad - Get the landingpad instruction from the landing pad block
+ // (the unwind destination).
+ LandingPadInst *getLandingPad() const;
+
BasicBlock *getSuccessor(unsigned i) const {
assert(i < 2 && "Successor # out of range for invoke!");
return i == 0 ? getNormalDest() : getUnwindDest();
BasicBlock *getSuccessor(unsigned i) const {
assert(i < 2 && "Successor # out of range for invoke!");
return i == 0 ? getNormalDest() : getUnwindDest();
Use::zap(OldOps, OldOps + e, true);
}
Use::zap(OldOps, OldOps + e, true);
}
+void LandingPadInst::reserveClauses(unsigned Size) {
+ unsigned e = getNumOperands() + Size;
+ if (ReservedSpace >= e) return;
+ ReservedSpace = e;
+
+ Use *NewOps = allocHungoffUses(ReservedSpace);
+ Use *OldOps = OperandList;
+ for (unsigned i = 0; i != e; ++i)
+ NewOps[i] = OldOps[i];
+
+ OperandList = NewOps;
+ Use::zap(OldOps, OldOps + e, true);
+}
+
void LandingPadInst::addClause(ClauseType CT, Value *ClauseVal) {
unsigned OpNo = getNumOperands();
if (OpNo + 1 > ReservedSpace)
void LandingPadInst::addClause(ClauseType CT, Value *ClauseVal) {
unsigned OpNo = getNumOperands();
if (OpNo + 1 > ReservedSpace)
+LandingPadInst *InvokeInst::getLandingPad() const {
+ return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
+}
//===----------------------------------------------------------------------===//
// ReturnInst Implementation
//===----------------------------------------------------------------------===//
// ReturnInst Implementation