summaryrefslogtreecommitdiff
path: root/include/llvm/Instructions.h
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-03-30 11:28:46 +0000
committerJay Foad <jay.foad@gmail.com>2011-03-30 11:28:46 +0000
commit3ecfc861b4365f341c5c969b40e1afccde676e6f (patch)
tree3a0f81eeef71eb1342496c363726bf7059265deb /include/llvm/Instructions.h
parentd8b4fb4aab4d6fedb2b14bed1b846451b17bde7c (diff)
downloadllvm-3ecfc861b4365f341c5c969b40e1afccde676e6f.tar.gz
llvm-3ecfc861b4365f341c5c969b40e1afccde676e6f.tar.bz2
llvm-3ecfc861b4365f341c5c969b40e1afccde676e6f.tar.xz
Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r--include/llvm/Instructions.h32
1 files changed, 14 insertions, 18 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 17ff763c52..e7161cd1d4 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1811,39 +1811,35 @@ class PHINode : public Instruction {
void *operator new(size_t s) {
return User::operator new(s, 0);
}
- explicit PHINode(const Type *Ty, const Twine &NameStr = "",
- Instruction *InsertBefore = 0)
+ explicit PHINode(const Type *Ty, unsigned NumReservedValues,
+ const Twine &NameStr = "", Instruction *InsertBefore = 0)
: Instruction(Ty, Instruction::PHI, 0, 0, InsertBefore),
- ReservedSpace(0) {
+ ReservedSpace(NumReservedValues * 2) {
setName(NameStr);
+ OperandList = allocHungoffUses(ReservedSpace);
}
- PHINode(const Type *Ty, const Twine &NameStr, BasicBlock *InsertAtEnd)
+ PHINode(const Type *Ty, unsigned NumReservedValues, const Twine &NameStr,
+ BasicBlock *InsertAtEnd)
: Instruction(Ty, Instruction::PHI, 0, 0, InsertAtEnd),
- ReservedSpace(0) {
+ ReservedSpace(NumReservedValues * 2) {
setName(NameStr);
+ OperandList = allocHungoffUses(ReservedSpace);
}
protected:
virtual PHINode *clone_impl() const;
public:
- static PHINode *Create(const Type *Ty, const Twine &NameStr = "",
+ static PHINode *Create(const Type *Ty, unsigned NumReservedValues,
+ const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
- return new PHINode(Ty, NameStr, InsertBefore);
+ return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
}
- static PHINode *Create(const Type *Ty, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
- return new PHINode(Ty, NameStr, InsertAtEnd);
+ static PHINode *Create(const Type *Ty, unsigned NumReservedValues,
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
}
~PHINode();
- /// reserveOperandSpace - This method can be used to avoid repeated
- /// reallocation of PHI operand lists by reserving space for the correct
- /// number of operands before adding them. Unlike normal vector reserves,
- /// this method can also be used to trim the operand space.
- void reserveOperandSpace(unsigned NumValues) {
- resizeOperands(NumValues*2);
- }
-
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);