- MachineInstr *MI = *I;
-
- RegsUsed.resize(MRegisterInfo::FirstVirtualRegister);
-
- // a preliminary pass that will invalidate any registers that
- // are used by the instruction (including implicit uses)
- unsigned Opcode = MI->getOpcode();
- const TargetInstrDescriptor &Desc = TM->getInstrInfo().get(Opcode);
- if (const unsigned *Regs = Desc.ImplicitUses)
- while (*Regs)
- RegsUsed[*Regs++] = true;
-
- if (const unsigned *Regs = Desc.ImplicitDefs)
- while (*Regs)
- RegsUsed[*Regs++] = true;
-
- // Loop over uses, move from memory into registers
+ RegsUsed.resize(TRI->getNumRegs());
+
+ // This is a preliminary pass that will invalidate any registers that are
+ // used by the instruction (including implicit uses).
+ const TargetInstrDesc &Desc = MI->getDesc();
+ const unsigned *Regs;
+ if (Desc.ImplicitUses) {
+ for (Regs = Desc.ImplicitUses; *Regs; ++Regs)
+ RegsUsed[*Regs] = true;
+ }
+
+ if (Desc.ImplicitDefs) {
+ for (Regs = Desc.ImplicitDefs; *Regs; ++Regs) {
+ RegsUsed[*Regs] = true;
+ MF->getRegInfo().setPhysRegUsed(*Regs);
+ }
+ }
+
+ // Loop over uses, move from memory into registers.