[LLVMdev] Inserting move instruction

Chris Lattner sabre at nondot.org
Sun Jul 2 15:49:41 PDT 2006


On Sun, 2 Jul 2006, Fernando Magno Quintao Pereira wrote:

>    MachineBasicBlock::iterator iter = mbb.getFirstTerminator();
>    const TargetRegisterClass *rc = mf.getSSARegMap()->getRegClass(dst);
>    const MRegisterInfo * reg_info = mf.getTarget().getRegisterInfo();
>    reg_info->copyRegToReg(mbb, iter, dst, src, rc);
> }
>
> But the getRegClass method seems to expect a virtual register. Could
> someone fix this code for me? I could not find an example in the source of
> LLVM.

You can't do it with this information.  In some higher context you should 
have information about what register class the physreg is to be 
interpreted as.  Physregs can be in multiple register classes.

All of the register allocators call this method, so there are plenty of 
examples.

-Chris

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



More information about the llvm-dev mailing list