diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-08-03 20:51:06 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-08-03 20:51:06 +0000 |
commit | f492391de03dc1f1fe539d97271bdb05f59dbdbc (patch) | |
tree | 2c3e8d8c9e08a9b227e3f94f38be20fef8d3ebb9 /lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp | |
parent | 93d537c1d60db3ac24fcfcf099ab602aee98bd59 (diff) |
Copy the liveins for the first block. PR859
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29511 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp index b4c4c3245d..ecdd51588c 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp @@ -14,9 +14,11 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "sched" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/ScheduleDAG.h" #include "llvm/CodeGen/SchedulerRegistry.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetInstrInfo.h" @@ -669,6 +671,18 @@ void ScheduleDAGSimple::dump() const { /// EmitAll - Emit all nodes in schedule sorted order. /// void ScheduleDAGSimple::EmitAll() { + // 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)); + } + std::map<SDNode*, unsigned> VRBaseMap; // For each node in the ordering |