diff options
| author | Dan Gohman <gohman@apple.com> | 2009-03-23 15:48:29 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-03-23 15:48:29 +0000 |
| commit | 87cd443ae95724f9bf7ba562ff1d82b88c4a35d1 (patch) | |
| tree | fa2fbe8cde64f8dc1099135cd205b2df6610a9df /llvm | |
| parent | c7fef2ad530f6220b29d6d3133d6b6ec50adebb5 (diff) | |
| download | bcm5719-llvm-87cd443ae95724f9bf7ba562ff1d82b88c4a35d1.tar.gz bcm5719-llvm-87cd443ae95724f9bf7ba562ff1d82b88c4a35d1.zip | |
Make getOperandNumForIncomingValue and getOperandNumForIncomingBlock
static member functions, and add getIncomingValueNumForOperand
and getIncomingBlockNumForOperand, which are the respective
inverses.
llvm-svn: 67522
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Instructions.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h index 7b8231ea8c2..c5016515e3f 100644 --- a/llvm/include/llvm/Instructions.h +++ b/llvm/include/llvm/Instructions.h @@ -1942,9 +1942,13 @@ public: 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 @@ public: 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 /// |

