diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-09-13 19:30:54 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-09-13 19:30:54 +0000 |
| commit | d4382f0afa9ed221e3055fb08b7a1c4ac90d7a33 (patch) | |
| tree | 379f6be7c51eb4a71b6b85e847be7eb7896b2b16 /llvm/lib/CodeGen | |
| parent | 64685b4ca29e1a57e2ab3deb9a0d7a45d7074e9b (diff) | |
| download | bcm5719-llvm-d4382f0afa9ed221e3055fb08b7a1c4ac90d7a33.tar.gz bcm5719-llvm-d4382f0afa9ed221e3055fb08b7a1c4ac90d7a33.zip | |
If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.
llvm-svn: 23331
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 26421c148f8..ea2696786b5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -24,6 +24,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SSARegMap.h" +#include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" @@ -1115,6 +1116,20 @@ LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL, } } + // Next, if the function has live ins that need to be copied into vregs, + // emit the copies now, into the top of the block. + MachineFunction &MF = SDL.DAG.getMachineFunction(); + if (MF.livein_begin() != MF.livein_end()) { + SSARegMap *RegMap = MF.getSSARegMap(); + const MRegisterInfo &MRI = *MF.getTarget().getRegisterInfo(); + 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, if the target has anything special to do, allow it to do so. EmitFunctionEntryCode(F, SDL.DAG.getMachineFunction()); } |

