aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-07-28 02:15:52 +0000
committerBill Wendling <isanbard@gmail.com>2011-07-28 02:15:52 +0000
commit7f66c45f35bdfc69c41f2e1b3b9891a4eca0c0b0 (patch)
treea2af1ad9657ca1d9a6b3ef5b512af19544fc8dce /lib/VMCore/Instructions.cpp
parent15d03fb7f496562d7256ecac69f63e08ee0bfd2e (diff)
downloadexternal_llvm-7f66c45f35bdfc69c41f2e1b3b9891a4eca0c0b0.tar.gz
external_llvm-7f66c45f35bdfc69c41f2e1b3b9891a4eca0c0b0.tar.bz2
external_llvm-7f66c45f35bdfc69c41f2e1b3b9891a4eca0c0b0.zip
Add a couple of convenience functions:
* 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
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index e7dd40d059..9398c7f872 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -214,6 +214,20 @@ void LandingPadInst::growOperands() {
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)
@@ -551,6 +565,9 @@ void InvokeInst::removeAttribute(unsigned i, Attributes attr) {
setAttributes(PAL);
}
+LandingPadInst *InvokeInst::getLandingPad() const {
+ return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
+}
//===----------------------------------------------------------------------===//
// ReturnInst Implementation