From 78b200eb74a3e4ac907ad846febf1a793b57fbce Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 19 Aug 2005 20:50:53 +0000 Subject: [PATCH] Before implementing copyfromreg, we'll implement copytoreg correctly. This gets us this for the previous testcase: _test: lis r2, 0 ori r3, r2, 65535 blr Note that we actually write to r3 (the return reg) correctly now :) llvm-svn: 22933 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 87943f9253d6..d77578e28666 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -36,14 +36,16 @@ namespace { MachineBasicBlock *BB; const TargetMachine &TM; const TargetInstrInfo &TII; + const MRegisterInfo &MRI; SSARegMap *RegMap; std::map EmittedOps; public: SimpleSched(SelectionDAG &D, MachineBasicBlock *bb) : DAG(D), BB(bb), TM(D.getTarget()), TII(*TM.getInstrInfo()), - RegMap(BB->getParent()->getSSARegMap()) { + MRI(*TM.getRegisterInfo()), RegMap(BB->getParent()->getSSARegMap()) { assert(&TII && "Target doesn't provide instr info?"); + assert(&MRI && "Target doesn't provide register info?"); } void Run() { @@ -131,7 +133,9 @@ unsigned SimpleSched::Emit(SDOperand Op) { case ISD::EntryToken: break; case ISD::CopyToReg: { unsigned Val = Emit(Op.getOperand(2)); - // FIXME: DO THE COPY NOW. + MRI.copyRegToReg(*BB, BB->end(), + cast(Op.getOperand(1))->getReg(), Val, + RegMap->getRegClass(Val)); break; } }