}
/// Return which operand this is in the operand list of the User.
- // TODO: unsigned getOperandNumber() const;
+ unsigned getOperandNumber() const;
/// We support a move constructor so IROperand's can be in vectors, but this
/// shouldn't be used by general clients.
return this - &getOwner()->getInstResults()[0];
}
+/// Return which operand this is in the operand list.
+template <> unsigned InstOperand::getOperandNumber() const {
+ return this - &getOwner()->getInstOperands()[0];
+}
+
+/// Return which operand this is in the operand list.
+template <> unsigned BasicBlockOperand::getOperandNumber() const {
+ return this - &getOwner()->getBasicBlockOperands()[0];
+}
+
//===----------------------------------------------------------------------===//
// Instruction
//===----------------------------------------------------------------------===//
return this - &getOwner()->getStmtResults()[0];
}
+//===----------------------------------------------------------------------===//
+// StmtOperand
+//===------------------------------------------------------------------===//
+
+/// Return which operand this is in the operand list.
+template <> unsigned StmtOperand::getOperandNumber() const {
+ return this - &getOwner()->getStmtOperands()[0];
+}
+
//===----------------------------------------------------------------------===//
// Statement
//===------------------------------------------------------------------===//