[LLVMdev] Inserting move instruction
Fernando Magno Quintao Pereira
fernando at CS.UCLA.EDU
Sun Jul 2 15:27:48 PDT 2006
Dear llvmers,
I am trying to insert a move instruction where both source and
destination registers are physical registers. How is the code for this?
I tried this one here:
void PhiDeconstruction_Fer::add_move (
MachineFunction & mf,
MachineBasicBlock & mbb,
unsigned src,
unsigned dst
)
{
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.
Thank you very much,
Fernando
More information about the llvm-dev
mailing list