diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-16 06:10:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-16 06:10:58 +0000 |
commit | 957cb6733aeb35d6d8dff6555f7cde27ecda82eb (patch) | |
tree | 50b852b12d6e20174a54b2587df27e6d362cf9f9 /llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | |
parent | 52d0c78de80da17596ac9b81fa7c95c4669aed33 (diff) | |
download | bcm5719-llvm-957cb6733aeb35d6d8dff6555f7cde27ecda82eb.tar.gz bcm5719-llvm-957cb6733aeb35d6d8dff6555f7cde27ecda82eb.zip |
Move function-live-in-handling code from the sdisel code to the scheduler.
This code should be emitted after legalize, so it can't be in sdisel.
Note that the EmitFunctionEntryCode hook should be updated to operate on the
DAG. The X86 backend is the only one currently using this hook.
llvm-svn: 28315
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 3fab99e3727..523062053d8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -539,6 +539,20 @@ void ScheduleDAG::EmitNoop() { /// EmitSchedule - Emit the machine code in scheduled order. void ScheduleDAG::EmitSchedule() { + // If this is the first basic block in the function, and if it has live ins + // that need to be copied into vregs, emit the copies into the top of the + // block before emitting the code for the block. + MachineFunction &MF = DAG.getMachineFunction(); + if (&MF.front() == BB && MF.livein_begin() != MF.livein_end()) { + for (MachineFunction::livein_iterator LI = MF.livein_begin(), + E = MF.livein_end(); LI != E; ++LI) + if (LI->second) + MRI->copyRegToReg(*MF.begin(), MF.begin()->end(), LI->second, + LI->first, RegMap->getRegClass(LI->second)); + } + + + // Finally, emit the code for all of the scheduled instructions. std::map<SDNode*, unsigned> VRBaseMap; for (unsigned i = 0, e = Sequence.size(); i != e; i++) { if (SUnit *SU = Sequence[i]) { |