Thanks. But please factor out the code that looks for the register class into a function so it can be shared between CopyToReg and CopyFromReg.
Evan On Mar 20, 2007, at 9:47 AM, Lauro Ramos Venancio wrote: > > > Changes in directory llvm/lib/CodeGen/SelectionDAG: > > ScheduleDAG.cpp updated: 1.122 -> 1.123 > --- > Log message: > > CopyToReg source operand can be a physical register. > > > --- > Diffs of the changes: (+19 -3) > > ScheduleDAG.cpp | 22 +++++++++++++++++++--- > 1 files changed, 19 insertions(+), 3 deletions(-) > > > Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp > diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.122 llvm/ > lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.123 > --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.122 Sat Feb 17 > 00:38:37 2007 > +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Tue Mar 20 > 11:46:44 2007 > @@ -475,9 +475,25 @@ > else > InReg = getVR(Node->getOperand(2), VRBaseMap); > unsigned DestReg = cast<RegisterSDNode>(Node->getOperand(1))- > >getReg(); > - if (InReg != DestReg) // Coalesced away the copy? > - MRI->copyRegToReg(*BB, BB->end(), DestReg, InReg, > - RegMap->getRegClass(InReg)); > + if (InReg != DestReg) {// Coalesced away the copy? > + const TargetRegisterClass *TRC = 0; > + // Get the target register class > + if (MRegisterInfo::isVirtualRegister(InReg)) { > + TRC = RegMap->getRegClass(InReg); > + } else { > + // Pick the register class of the right type that > contains this > + // physreg. > + for (MRegisterInfo::regclass_iterator I = MRI- > >regclass_begin(), > + E = MRI->regclass_end(); I != E; ++I) > + if ((*I)->hasType(Node->getOperand(2).getValueType()) && > + (*I)->contains(InReg)) { > + TRC = *I; > + break; > + } > + assert(TRC && "Couldn't find register class for reg > copy!"); > + } > + MRI->copyRegToReg(*BB, BB->end(), DestReg, InReg, TRC); > + } > break; > } > case ISD::CopyFromReg: { > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits