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
This commit is contained in:
Chris Lattner 2005-08-19 20:50:53 +00:00
parent cc3035e989
commit 78b200eb74
1 changed files with 6 additions and 2 deletions

View File

@ -36,14 +36,16 @@ namespace {
MachineBasicBlock *BB;
const TargetMachine &TM;
const TargetInstrInfo &TII;
const MRegisterInfo &MRI;
SSARegMap *RegMap;
std::map<SDNode *, unsigned> 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<RegisterSDNode>(Op.getOperand(1))->getReg(), Val,
RegMap->getRegClass(Val));
break;
}
}