[llvm-commits] CVS: llvm/include/llvm/iPHINode.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Mar 5 15:16:01 PST 2003
Changes in directory llvm/include/llvm:
iPHINode.h updated: 1.6 -> 1.7
---
Log message:
Simplify some of the PHI node interfaces
---
Diffs of the changes:
Index: llvm/include/llvm/iPHINode.h
diff -u llvm/include/llvm/iPHINode.h:1.6 llvm/include/llvm/iPHINode.h:1.7
--- llvm/include/llvm/iPHINode.h:1.6 Tue Oct 8 16:31:56 2002
+++ llvm/include/llvm/iPHINode.h Wed Mar 5 15:15:11 2003
@@ -61,7 +61,12 @@
}
/// addIncoming - Add an incoming value to the end of the PHI list
- void addIncoming(Value *D, BasicBlock *BB);
+ void 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((Value*)BB, this));
+ }
/// removeIncomingValue - Remove an incoming value. This is useful if a
/// predecessor basic block is deleted. The value removed is returned.
@@ -71,8 +76,13 @@
/// dummy values. The only time there should be zero incoming values to a PHI
/// node is when the block is dead, so this strategy is sound.
///
- Value *removeIncomingValue(const BasicBlock *BB,
- bool DeletePHIIfEmpty = true);
+ Value *removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty = true);
+
+ Value *removeIncomingValue(const BasicBlock *BB, bool DeletePHIIfEmpty =true){
+ int Idx = getBasicBlockIndex(BB);
+ assert(Idx >= 0 && "Invalid basic block argument to remove!");
+ return removeIncomingValue(Idx, DeletePHIIfEmpty);
+ }
/// getBasicBlockIndex - Return the first index of the specified basic
/// block in the value list for this PHI. Returns -1 if no instance.
More information about the llvm-commits
mailing list