[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp LiveVariables.cpp RegAllocLocal.cpp RegAllocSimple.cpp VirtRegMap.cpp
Jim Laskey
jlaskey at apple.com
Fri Jul 21 14:15:33 PDT 2006
Changes in directory llvm/lib/CodeGen:
LiveIntervalAnalysis.cpp updated: 1.162 -> 1.163
LiveVariables.cpp updated: 1.55 -> 1.56
RegAllocLocal.cpp updated: 1.82 -> 1.83
RegAllocSimple.cpp updated: 1.69 -> 1.70
VirtRegMap.cpp updated: 1.68 -> 1.69
---
Log message:
Eliminate data relocations by using NULL instead of global empty list.
---
Diffs of the changes: (+49 -33)
LiveIntervalAnalysis.cpp | 6 ++++--
LiveVariables.cpp | 16 ++++++++++------
RegAllocLocal.cpp | 36 ++++++++++++++++++++----------------
RegAllocSimple.cpp | 14 +++++++++-----
VirtRegMap.cpp | 10 ++++++----
5 files changed, 49 insertions(+), 33 deletions(-)
Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.162 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.163
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.162 Thu Jul 20 12:28:38 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Jul 21 16:15:20 2006
@@ -639,8 +639,10 @@
DEBUG(std::cerr << getInstructionIndex(mi) << "\t" << *mi);
// handle implicit defs
- for (const unsigned* id = tid.ImplicitDefs; *id; ++id)
- handleRegisterDef(mbb, mi, *id);
+ if (tid.ImplicitDefs) {
+ for (const unsigned* id = tid.ImplicitDefs; *id; ++id)
+ handleRegisterDef(mbb, mi, *id);
+ }
// handle explicit defs
for (int i = mi->getNumOperands() - 1; i >= 0; --i) {
Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.55 llvm/lib/CodeGen/LiveVariables.cpp:1.56
--- llvm/lib/CodeGen/LiveVariables.cpp:1.55 Wed May 3 20:26:39 2006
+++ llvm/lib/CodeGen/LiveVariables.cpp Fri Jul 21 16:15:20 2006
@@ -239,9 +239,11 @@
NumOperandsToProcess = 1;
// Loop over implicit uses, using them.
- for (const unsigned *ImplicitUses = MID.ImplicitUses;
- *ImplicitUses; ++ImplicitUses)
- HandlePhysRegUse(*ImplicitUses, MI);
+ if (MID.ImplicitUses) {
+ for (const unsigned *ImplicitUses = MID.ImplicitUses;
+ *ImplicitUses; ++ImplicitUses)
+ HandlePhysRegUse(*ImplicitUses, MI);
+ }
// Process all explicit uses...
for (unsigned i = 0; i != NumOperandsToProcess; ++i) {
@@ -257,9 +259,11 @@
}
// Loop over implicit defs, defining them.
- for (const unsigned *ImplicitDefs = MID.ImplicitDefs;
- *ImplicitDefs; ++ImplicitDefs)
- HandlePhysRegDef(*ImplicitDefs, MI);
+ if (MID.ImplicitDefs) {
+ for (const unsigned *ImplicitDefs = MID.ImplicitDefs;
+ *ImplicitDefs; ++ImplicitDefs)
+ HandlePhysRegDef(*ImplicitDefs, MI);
+ }
// Process all explicit defs...
for (unsigned i = 0; i != NumOperandsToProcess; ++i) {
Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.82 llvm/lib/CodeGen/RegAllocLocal.cpp:1.83
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.82 Thu Jul 20 12:43:27 2006
+++ llvm/lib/CodeGen/RegAllocLocal.cpp Fri Jul 21 16:15:20 2006
@@ -525,9 +525,11 @@
// Loop over the implicit uses, making sure that they are at the head of the
// use order list, so they don't get reallocated.
- for (const unsigned *ImplicitUses = TID.ImplicitUses;
- *ImplicitUses; ++ImplicitUses)
- MarkPhysRegRecentlyUsed(*ImplicitUses);
+ if (TID.ImplicitUses) {
+ for (const unsigned *ImplicitUses = TID.ImplicitUses;
+ *ImplicitUses; ++ImplicitUses)
+ MarkPhysRegRecentlyUsed(*ImplicitUses);
+ }
// Get the used operands into registers. This has the potential to spill
// incoming values if we are out of registers. Note that we completely
@@ -587,19 +589,21 @@
}
// Loop over the implicit defs, spilling them as well.
- for (const unsigned *ImplicitDefs = TID.ImplicitDefs;
- *ImplicitDefs; ++ImplicitDefs) {
- unsigned Reg = *ImplicitDefs;
- spillPhysReg(MBB, MI, Reg, true);
- PhysRegsUseOrder.push_back(Reg);
- PhysRegsUsed[Reg] = 0; // It is free and reserved now
- PhysRegsEverUsed[Reg] = true;
-
- 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;
+ if (TID.ImplicitDefs) {
+ for (const unsigned *ImplicitDefs = TID.ImplicitDefs;
+ *ImplicitDefs; ++ImplicitDefs) {
+ unsigned Reg = *ImplicitDefs;
+ spillPhysReg(MBB, MI, Reg, true);
+ PhysRegsUseOrder.push_back(Reg);
+ PhysRegsUsed[Reg] = 0; // It is free and reserved now
+ PhysRegsEverUsed[Reg] = true;
+
+ 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;
+ }
}
}
Index: llvm/lib/CodeGen/RegAllocSimple.cpp
diff -u llvm/lib/CodeGen/RegAllocSimple.cpp:1.69 llvm/lib/CodeGen/RegAllocSimple.cpp:1.70
--- llvm/lib/CodeGen/RegAllocSimple.cpp:1.69 Thu Jul 20 12:28:38 2006
+++ llvm/lib/CodeGen/RegAllocSimple.cpp Fri Jul 21 16:15:20 2006
@@ -166,12 +166,16 @@
unsigned Opcode = MI->getOpcode();
const TargetInstrDescriptor &Desc = TM->getInstrInfo()->get(Opcode);
const unsigned *Regs;
- for (Regs = Desc.ImplicitUses; *Regs; ++Regs)
- RegsUsed[*Regs] = true;
+ if (Desc.ImplicitUses) {
+ for (Regs = Desc.ImplicitUses; *Regs; ++Regs)
+ RegsUsed[*Regs] = true;
+ }
- for (Regs = Desc.ImplicitDefs; *Regs; ++Regs) {
- RegsUsed[*Regs] = true;
- PhysRegsEverUsed[*Regs] = true;
+ if (Desc.ImplicitDefs) {
+ for (Regs = Desc.ImplicitDefs; *Regs; ++Regs) {
+ RegsUsed[*Regs] = true;
+ PhysRegsEverUsed[*Regs] = true;
+ }
}
// Loop over uses, move from memory into registers.
Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.68 llvm/lib/CodeGen/VirtRegMap.cpp:1.69
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.68 Thu Jul 20 12:28:38 2006
+++ llvm/lib/CodeGen/VirtRegMap.cpp Fri Jul 21 16:15:20 2006
@@ -671,10 +671,12 @@
// Loop over all of the implicit defs, clearing them from our available
// sets.
- for (const unsigned *ImpDef = TII->getImplicitDefs(MI.getOpcode());
- *ImpDef; ++ImpDef) {
- PhysRegsUsed[*ImpDef] = true;
- Spills.ClobberPhysReg(*ImpDef);
+ const unsigned *ImpDef = TII->getImplicitDefs(MI.getOpcode());
+ if (ImpDef) {
+ for ( ; *ImpDef; ++ImpDef) {
+ PhysRegsUsed[*ImpDef] = true;
+ Spills.ClobberPhysReg(*ImpDef);
+ }
}
DEBUG(std::cerr << '\t' << MI);
More information about the llvm-commits
mailing list