[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 15 15:22:05 PDT 2006
Changes in directory llvm/lib/CodeGen:
RegAllocLocal.cpp updated: 1.78 -> 1.79
---
Log message:
Teach the local allocator to know that live-in values (e.g. arguments) are
live at function entry. This prevents it from using arg registers for other
purposes before the arguments are used.
---
Diffs of the changes: (+20 -0)
RegAllocLocal.cpp | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.78 llvm/lib/CodeGen/RegAllocLocal.cpp:1.79
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.78 Thu May 4 12:52:23 2006
+++ llvm/lib/CodeGen/RegAllocLocal.cpp Thu Jun 15 17:21:53 2006
@@ -491,6 +491,26 @@
// loop over each instruction
MachineBasicBlock::iterator MII = MBB.begin();
const TargetInstrInfo &TII = *TM->getInstrInfo();
+
+ // If this is the first basic block in the machine function, add live-in
+ // registers as active.
+ if (&MBB == &*MF->begin()) {
+ for (MachineFunction::livein_iterator I = MF->livein_begin(),
+ E = MF->livein_end(); I != E; ++I) {
+ unsigned Reg = I->first;
+ PhysRegsEverUsed[Reg] = true;
+ PhysRegsUsed[Reg] = 0; // It is free and reserved now
+ PhysRegsUseOrder.push_back(Reg);
+ for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
+ *AliasSet; ++AliasSet) {
+ PhysRegsUseOrder.push_back(*AliasSet);
+ PhysRegsUsed[*AliasSet] = 0; // It is free and reserved now
+ PhysRegsEverUsed[*AliasSet] = true;
+ }
+ }
+ }
+
+ // Otherwise, sequentially allocate each instruction in the MBB.
while (MII != MBB.end()) {
MachineInstr *MI = MII++;
const TargetInstrDescriptor &TID = TII.get(MI->getOpcode());
More information about the llvm-commits
mailing list