[llvm-commits] CVS: llvm/lib/VMCore/InstrTypes.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Mar 5 15:16:03 PST 2003
Changes in directory llvm/lib/VMCore:
InstrTypes.cpp updated: 1.19 -> 1.20
---
Log message:
Simplify some of the PHI node interfaces
---
Diffs of the changes:
Index: llvm/lib/VMCore/InstrTypes.cpp
diff -u llvm/lib/VMCore/InstrTypes.cpp:1.19 llvm/lib/VMCore/InstrTypes.cpp:1.20
--- llvm/lib/VMCore/InstrTypes.cpp:1.19 Tue Oct 8 16:34:58 2002
+++ llvm/lib/VMCore/InstrTypes.cpp Wed Mar 5 15:15:12 2003
@@ -33,22 +33,13 @@
}
}
-void PHINode::addIncoming(Value *D, BasicBlock *BB) {
- assert(getType() == D->getType() &&
- "All operands to PHI node must be the same type as the PHI node!");
- Operands.push_back(Use(D, this));
- Operands.push_back(Use(BB, this));
-}
-
// removeIncomingValue - Remove an incoming value. This is useful if a
// predecessor basic block is deleted.
-Value *PHINode::removeIncomingValue(const BasicBlock *BB,
- bool DeletePHIIfEmpty) {
- op_iterator Idx = find(Operands.begin(), Operands.end(), (const Value*)BB);
- assert(Idx != Operands.end() && "BB not in PHI node!");
- --Idx; // Back up to value prior to Basic block
- Value *Removed = *Idx;
- Operands.erase(Idx, Idx+2); // Erase Value and BasicBlock
+Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
+ assert(Idx*2 < Operands.size() && "BB not in PHI node!");
+ Value *Removed = Operands[Idx*2];
+ Operands.erase(Operands.begin()+Idx*2, // Erase Value and BasicBlock
+ Operands.begin()+Idx*2+2);
// If the PHI node is dead, because it has zero entries, nuke it now.
if (getNumOperands() == 0 && DeletePHIIfEmpty) {
More information about the llvm-commits
mailing list