[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Sep 13 12:31:06 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.82 -> 1.83
---
Log message:

If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.


---
Diffs of the changes:  (+15 -0)

 SelectionDAGISel.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.82 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.83
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.82	Tue Sep  6 19:15:36 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Tue Sep 13 14:30:54 2005
@@ -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 @@
         }
     }
 
+    // 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());
   }
 






More information about the llvm-commits mailing list