[llvm-commits] CVS: llvm/include/llvm/User.h iMemory.h iPHINode.h

vadve at cs.uiuc.edu vadve at cs.uiuc.edu
Mon Sep 16 11:07:01 PDT 2002


Changes in directory llvm/include/llvm:

User.h updated: 1.14 -> 1.15
iMemory.h updated: 1.36 -> 1.37
iPHINode.h updated: 1.4 -> 1.5

---
Log message:

Add routines to update or erase operands (and to do so without external
assumptions about which operand number stores what operand).


---
Diffs of the changes:

Index: llvm/include/llvm/User.h
diff -u llvm/include/llvm/User.h:1.14 llvm/include/llvm/User.h:1.15
--- llvm/include/llvm/User.h:1.14	Sun Aug 25 17:54:55 2002
+++ llvm/include/llvm/User.h	Mon Sep 16 11:06:12 2002
@@ -34,6 +34,10 @@
     assert(i < Operands.size() && "setOperand() out of range!");
     Operands[i] = Val;
   }
+  inline void eraseOperand(unsigned i) {
+    assert(i < Operands.size() && "setOperand() out of range!");
+    Operands.erase(Operands.begin() + i);
+  }
   inline unsigned getNumOperands() const { return Operands.size(); }
 
   // ---------------------------------------------------------------------------


Index: llvm/include/llvm/iMemory.h
diff -u llvm/include/llvm/iMemory.h:1.36 llvm/include/llvm/iMemory.h:1.37
--- llvm/include/llvm/iMemory.h:1.36	Fri Sep 13 17:28:50 2002
+++ llvm/include/llvm/iMemory.h	Mon Sep 16 11:06:12 2002
@@ -150,6 +150,7 @@
 
   Value *getPointerOperand() { return getOperand(0); }
   const Value *getPointerOperand() const { return getOperand(0); }
+  static unsigned getPointerOperandIndex() { return 0U; }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const LoadInst *) { return true; }
@@ -180,6 +181,7 @@
 
   Value *getPointerOperand() { return getOperand(1); }
   const Value *getPointerOperand() const { return getOperand(1); }
+  static unsigned getPointerOperandIndex() { return 1U; }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const StoreInst *) { return true; }
@@ -238,7 +240,10 @@
   const Value *getPointerOperand() const {
     return getOperand(0);
   }
-  
+  static unsigned getPointerOperandIndex() {
+    return 0U;                      // get index for modifying correct operand
+  }
+
   inline unsigned getNumIndices() const {  // Note: always non-negative
     return getNumOperands() - 1;
   }


Index: llvm/include/llvm/iPHINode.h
diff -u llvm/include/llvm/iPHINode.h:1.4 llvm/include/llvm/iPHINode.h:1.5
--- llvm/include/llvm/iPHINode.h:1.4	Tue Sep 10 10:36:11 2002
+++ llvm/include/llvm/iPHINode.h	Mon Sep 16 11:06:12 2002
@@ -42,6 +42,9 @@
   void setIncomingValue(unsigned i, Value *V) {
     Operands[i*2] = V;
   }
+  inline unsigned getOperandNumForIncomingValue(unsigned i) {
+    return i*2;
+  }
 
   /// getIncomingBlock - Return incoming basic block #x
   const BasicBlock *getIncomingBlock(unsigned i) const { 
@@ -52,6 +55,9 @@
   }
   inline void setIncomingBlock(unsigned i, BasicBlock *BB) {
     Operands[i*2+1] = (Value*)BB;
+  }
+  inline unsigned getOperandNumForIncomingBlock(unsigned i) {
+    return i*2+1;
   }
 
   /// addIncoming - Add an incoming value to the end of the PHI list





More information about the llvm-commits mailing list