[LLVMdev] Iterator to enumerate machine operands

Tzu-Chien Chiu tzuchien.chiu at gmail.com
Fri Jul 29 21:50:26 PDT 2005


I want to enumerate all the operands of a machine instruction, but the
iterator seems to skip everything except virtual registers. Is this by
design?

MachineInstr.h

<code>
 template<class MITy, class VTy>
  class ValOpIterator : public forward_iterator<VTy, ptrdiff_t> {
    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;
    }
</code>

-- 
Tzu-Chien Chiu,
3D Graphics Hardware Architect
<URL:http://www.csie.nctu.edu.tw/~jwchiu>




More information about the llvm-dev mailing list