-
- // Access to set the operands when building the machine instruction
- //
- void SetMachineOperandVal (unsigned i,
- MachineOperand::MachineOperandType operandType,
- Value* V);
-
- void SetMachineOperandConst (unsigned i,
- MachineOperand::MachineOperandType operandType,
- int64_t intValue);
-
- void SetMachineOperandReg(unsigned i, int regNum);
-
-
- unsigned substituteValue(const Value* oldVal, Value* newVal,
- bool defsOnly, bool notDefsAndUses,
- bool& someArgsWereIgnored);
-
- void setOperandHi32(unsigned i) { operands[i].markHi32(); }
- void setOperandLo32(unsigned i) { operands[i].markLo32(); }
- void setOperandHi64(unsigned i) { operands[i].markHi64(); }
- void setOperandLo64(unsigned i) { operands[i].markLo64(); }
-
-
- // SetRegForOperand -
- // SetRegForImplicitRef -
- // Mark an explicit or implicit operand with its allocated physical register.
- //
- void SetRegForOperand(unsigned i, int regNum);
- void SetRegForImplicitRef(unsigned i, int regNum);
-
- //
- // Iterator to enumerate machine operands.
- //
- template<class MITy, class VTy>
- class ValOpIterator : public forward_iterator<VTy, ptrdiff_t> {
- unsigned i;
- MITy MI;
-
- void skipToNextVal() {
- while (i < MI->getNumOperands() &&
- !( (MI->getOperand(i).getType() == MachineOperand::MO_VirtualRegister ||
- MI->getOperand(i).getType() == MachineOperand::MO_CCRegister)
- && MI->getOperand(i).getVRegValue() != 0))
- ++i;
- }
-
- inline ValOpIterator(MITy mi, unsigned I) : i(I), MI(mi) {
- skipToNextVal();
- }
-
- public:
- typedef ValOpIterator<MITy, VTy> _Self;
-
- inline VTy operator*() const {
- return MI->getOperand(i).getVRegValue();
- }
-
- const MachineOperand &getMachineOperand() const { return MI->getOperand(i);}
- MachineOperand &getMachineOperand() { return MI->getOperand(i);}
-
- inline VTy operator->() const { return operator*(); }
-
- inline bool isUse() const { return MI->getOperand(i).isUse(); }
- inline bool isDef() const { return MI->getOperand(i).isDef(); }
-
- inline _Self& operator++() { i++; skipToNextVal(); return *this; }
- inline _Self operator++(int) { _Self tmp = *this; ++*this; return tmp; }
-
- inline bool operator==(const _Self &y) const {
- return i == y.i;
- }
- inline bool operator!=(const _Self &y) const {
- return !operator==(y);
- }
-
- static _Self begin(MITy MI) {
- return _Self(MI, 0);
- }
- static _Self end(MITy MI) {
- return _Self(MI, MI->getNumOperands());
- }
- };
-
- // define begin() and end()
- val_op_iterator begin() { return val_op_iterator::begin(this); }
- val_op_iterator end() { return val_op_iterator::end(this); }
-
- const_val_op_iterator begin() const {
- return const_val_op_iterator::begin(this);
- }
- const_val_op_iterator end() const {
- return const_val_op_iterator::end(this);