[LLVMdev] LiveIntervals, replace register with representative register?

Chris Lattner sabre at nondot.org
Wed Sep 7 13:04:15 PDT 2005


On Thu, 8 Sep 2005, Tzu-Chien Chiu wrote:
> On 08/09/05, Chris Lattner <sabre at nondot.org> wrote:
>> This code isn't actually replacing the virtual register with a physreg.
>
> Then why changing its optype?
>
> It makes the assertion fails:
>
> MachineOperand& MO = inst.getOperand(n);
> if (MRegisterInfo::isVirtualRegister(MO.getReg())) {
>  assert(MachineOperand::MO_VirtualRegister == MO.getType());
>  ...
> }
>
> Is that alright?

No, that's not right.  There is no distinction between MO_VirtualRegister 
and MO_PhysicalRegister in the target independent backend.  This is due to 
difference between how the SparcV9 backend (which uses this distinction) 
and the target-indep backend work.  If you use: MO.isRegister(), it 
accepts both MO_MachineRegister and MO_VirtualRegister.  In the 
target-indep backend, there is no distinction: the distinction is based on 
the value of the register itself.

> Some of my code using MachineOperand::getType() instead of
> MRegisterInfo::is{Physical,Virtual}Register() to check the register
> type.

If you use MO.isRegister() things should work.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list