forked from OSchip/llvm-project
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:
parent
cc3035e989
commit
78b200eb74
|
@ -36,14 +36,16 @@ namespace {
|
||||||
MachineBasicBlock *BB;
|
MachineBasicBlock *BB;
|
||||||
const TargetMachine &TM;
|
const TargetMachine &TM;
|
||||||
const TargetInstrInfo &TII;
|
const TargetInstrInfo &TII;
|
||||||
|
const MRegisterInfo &MRI;
|
||||||
SSARegMap *RegMap;
|
SSARegMap *RegMap;
|
||||||
|
|
||||||
std::map<SDNode *, unsigned> EmittedOps;
|
std::map<SDNode *, unsigned> EmittedOps;
|
||||||
public:
|
public:
|
||||||
SimpleSched(SelectionDAG &D, MachineBasicBlock *bb)
|
SimpleSched(SelectionDAG &D, MachineBasicBlock *bb)
|
||||||
: DAG(D), BB(bb), TM(D.getTarget()), TII(*TM.getInstrInfo()),
|
: 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(&TII && "Target doesn't provide instr info?");
|
||||||
|
assert(&MRI && "Target doesn't provide register info?");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Run() {
|
void Run() {
|
||||||
|
@ -131,7 +133,9 @@ unsigned SimpleSched::Emit(SDOperand Op) {
|
||||||
case ISD::EntryToken: break;
|
case ISD::EntryToken: break;
|
||||||
case ISD::CopyToReg: {
|
case ISD::CopyToReg: {
|
||||||
unsigned Val = Emit(Op.getOperand(2));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue