[llvm-branch-commits] [llvm-branch] r135999 - in /llvm/branches/exception-handling-rewrite: include/llvm/Instructions.h lib/VMCore/Instructions.cpp
Bill Wendling
isanbard at gmail.com
Mon Jul 25 16:01:24 PDT 2011
Author: void
Date: Mon Jul 25 18:01:24 2011
New Revision: 135999
URL: http://llvm.org/viewvc/llvm-project?rev=135999&view=rev
Log:
* Change the 'add*' methods so that it adds the clause type and clause value at
the same time.
* Dis-ambiguate the Create methods.
Modified:
llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h
llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp
Modified: llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h?rev=135999&r1=135998&r2=135999&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h (original)
+++ llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h Mon Jul 25 18:01:24 2011
@@ -1825,7 +1825,7 @@
void *operator new(size_t s) {
return User::operator new(s, 0);
}
- void growOperands(unsigned Size);
+ void growOperands();
void init(Value *PersFn, unsigned NumReservedValues, const Twine &NameStr);
explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
@@ -1852,8 +1852,7 @@
}
static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
unsigned NumReservedValues,
- const Twine &NameStr = "",
- BasicBlock *InsertAtEnd = 0) {
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
InsertAtEnd);
}
@@ -1866,11 +1865,8 @@
/// landing pad.
const Value *getPersonalityFn() const { return getOperand(0); }
- /// addCatchTypes - Add catch types to the landing pad.
- void addCatchClauses(ArrayRef<Value*> Catches);
-
- /// addCatchTypes - Add filter types to the landing pad.
- void addFilterClauses(ArrayRef<Value*> Filters);
+ /// addClause - Add a clause to the landing pad.
+ void addClause(ClauseType CT, Value *ClauseVal);
/// getClauseType - Return the type of the clause at this index. The two
/// supported clauses are Catch and Filter.
Modified: llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp?rev=135999&r1=135998&r2=135999&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp Mon Jul 25 18:01:24 2011
@@ -198,9 +198,9 @@
/// growOperands - grow operands - This grows the operand list in response to a
/// push_back style of operation. This grows the number of ops by 2 times.
-void LandingPadInst::growOperands(unsigned Size) {
+void LandingPadInst::growOperands() {
unsigned e = getNumOperands();
- ReservedSpace = (e + Size) * 2;
+ ReservedSpace = e * 2;
Use *NewOps = allocHungoffUses(ReservedSpace);
Use *OldOps = OperandList;
@@ -211,34 +211,13 @@
Use::zap(OldOps, OldOps + e, true);
}
-void LandingPadInst::addCatchClauses(ArrayRef<Value*> Catches) {
- unsigned Size = Catches.size();
+void LandingPadInst::addClause(ClauseType CT, Value *ClauseVal) {
unsigned OpNo = getNumOperands();
- if (OpNo + Size > ReservedSpace)
- growOperands(Size);
-
- assert(OpNo + Size - 1 < ReservedSpace && "Growing didn't work!");
-
- unsigned Idx = OpNo;
- for (unsigned I = 0; I < Size; ++I) {
- ClauseIdxs.push_back(Catch);
- OperandList[Idx++] = Catches[I];
- }
-}
-
-void LandingPadInst::addFilterClauses(ArrayRef<Value*> Filters) {
- unsigned Size = Filters.size();
- unsigned OpNo = getNumOperands();
- if (OpNo + Size > ReservedSpace)
- growOperands(Size);
-
- assert(OpNo + Size - 1 < ReservedSpace && "Growing didn't work!");
-
- unsigned Idx = OpNo;
- for (unsigned I = 0; I < Size; ++I) {
- ClauseIdxs.push_back(Filter);
- OperandList[Idx++] = Filters[I];
- }
+ if (OpNo + 1 > ReservedSpace)
+ growOperands();
+ assert(OpNo + 1 < ReservedSpace && "Growing didn't work!");
+ ClauseIdxs.push_back(CT);
+ OperandList[OpNo] = ClauseVal;
}
//===----------------------------------------------------------------------===//
More information about the llvm-branch-commits
mailing list