[llvm-commits] CVS: llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Sun May 30 02:10:02 PDT 2004
Changes in directory llvm/lib/Target/SparcV9/RegAlloc:
PhyRegAlloc.cpp updated: 1.148 -> 1.149
---
Log message:
Reduce the amount of LLVM Values for which we save reg. allocator
state. Also, save the state for the incoming register of each phi
node.
---
Diffs of the changes: (+14 -9)
Index: llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
diff -u llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.148 llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.149
--- llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.148 Sat May 29 23:22:24 2004
+++ llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp Sun May 30 02:08:43 2004
@@ -28,6 +28,7 @@
#include "../LiveVar/FunctionLiveVarInfo.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/iPHINode.h"
#include "llvm/iOther.h"
#include "llvm/Module.h"
#include "llvm/Type.h"
@@ -1164,18 +1165,22 @@
saveStateForValue (state, Arg, -1, ArgNum);
++ArgNum;
}
- unsigned Insn = 0;
+ unsigned InstCount = 0;
// Instructions themselves encoded as operand # -1
for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II){
- saveStateForValue (state, (&*II), Insn, -1);
- for (unsigned i = 0; i < (*II).getNumOperands (); ++i) {
- const Value *V = (*II).getOperand (i);
- // Don't worry about it unless it's something whose reg. we'll need.
- if (!isa<Argument> (V) && !isa<Instruction> (V))
- continue;
- saveStateForValue (state, V, Insn, i);
+ const Instruction *Inst = &*II;
+ saveStateForValue (state, Inst, InstCount, -1);
+ if (isa<PHINode> (Inst)) {
+ MachineCodeForInstruction &MCforPN = MachineCodeForInstruction::get(Inst);
+ // Last instr should be the copy...figure out what reg it is reading from
+ if (Value *PhiCpRes = MCforPN.back()->getOperand(0).getVRegValueOrNull()){
+ if (DEBUG_RA)
+ std::cerr << "Found Phi copy result: " << PhiCpRes->getName()
+ << " in: " << *MCforPN.back() << "\n";
+ saveStateForValue (state, PhiCpRes, InstCount, -2);
+ }
}
- ++Insn;
+ ++InstCount;
}
}
More information about the llvm-commits
mailing list