[llvm-commits] [llvm] r67522 - /llvm/trunk/include/llvm/Instructions.h

Dan Gohman gohman at apple.com
Mon Mar 23 08:48:29 PDT 2009


Author: djg
Date: Mon Mar 23 10:48:29 2009
New Revision: 67522

URL: http://llvm.org/viewvc/llvm-project?rev=67522&view=rev
Log:
Make getOperandNumForIncomingValue and getOperandNumForIncomingBlock
static member functions, and add getIncomingValueNumForOperand
and getIncomingBlockNumForOperand, which are the respective
inverses.

Modified:
    llvm/trunk/include/llvm/Instructions.h

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=67522&r1=67521&r2=67522&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Mar 23 10:48:29 2009
@@ -1942,9 +1942,13 @@
     assert(i*2 < getNumOperands() && "Invalid value number!");
     setOperand(i*2, V);
   }
-  unsigned getOperandNumForIncomingValue(unsigned i) {
+  static unsigned getOperandNumForIncomingValue(unsigned i) {
     return i*2;
   }
+  static unsigned getIncomingValueNumForOperand(unsigned i) {
+    assert(i % 2 == 0 && "Invalid incoming-value operand index!");
+    return i/2;
+  }
 
   /// getIncomingBlock - Return incoming basic block corresponding
   /// to value use iterator
@@ -1962,9 +1966,13 @@
   void setIncomingBlock(unsigned i, BasicBlock *BB) {
     setOperand(i*2+1, BB);
   }
-  unsigned getOperandNumForIncomingBlock(unsigned i) {
+  static unsigned getOperandNumForIncomingBlock(unsigned i) {
     return i*2+1;
   }
+  static unsigned getIncomingBlockNumForOperand(unsigned i) {
+    assert(i % 2 == 1 && "Invalid incoming-block operand index!");
+    return i/2;
+  }
 
   /// addIncoming - Add an incoming value to the end of the PHI list
   ///





More information about the llvm-commits mailing list