[llvm-commits] [llvm] r43866 - in /llvm/trunk/lib/CodeGen: LiveVariables.cpp PHIElimination.cpp TwoAddressInstructionPass.cpp
Owen Anderson
resistor at mac.com
Wed Nov 7 17:20:48 PST 2007
Author: resistor
Date: Wed Nov 7 19:20:48 2007
New Revision: 43866
URL: http://llvm.org/viewvc/llvm-project?rev=43866&view=rev
Log:
Bring UsedBlocks back. StrongPHIElimination needs this information.
Modified:
llvm/trunk/lib/CodeGen/LiveVariables.cpp
llvm/trunk/lib/CodeGen/PHIElimination.cpp
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=43866&r1=43865&r2=43866&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Nov 7 19:20:48 2007
@@ -50,6 +50,9 @@
cerr << " Alive in blocks: ";
for (unsigned i = 0, e = AliveBlocks.size(); i != e; ++i)
if (AliveBlocks[i]) cerr << i << ", ";
+ cerr << " Used in blocks: ";
+ for (unsigned i = 0, e = UsedBlocks.size(); i != e; ++i)
+ if (UsedBlocks[i]) cerr << i << ", ";
cerr << "\n Killed by:";
if (Kills.empty())
cerr << " No instructions.\n";
@@ -72,6 +75,7 @@
}
VarInfo &VI = VirtRegInfo[RegIdx];
VI.AliveBlocks.resize(MF->getNumBlockIDs());
+ VI.UsedBlocks.resize(MF->getNumBlockIDs());
return VI;
}
@@ -154,6 +158,9 @@
MachineInstr *MI) {
assert(VRInfo.DefInst && "Register use before def!");
+ unsigned BBNum = MBB->getNumber();
+
+ VRInfo.UsedBlocks[BBNum] = true;
VRInfo.NumUses++;
// Check to see if this basic block is already a kill block...
@@ -176,7 +183,7 @@
// If this virtual register is already marked as alive in this basic block,
// that means it is alive in at least one of the successor block, it's not
// a kill.
- if (!VRInfo.AliveBlocks[MBB->getNumber()])
+ if (!VRInfo.AliveBlocks[BBNum])
VRInfo.Kills.push_back(MI);
// Update all dominating blocks to mark them known live.
Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=43866&r1=43865&r2=43866&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Wed Nov 7 19:20:48 2007
@@ -167,6 +167,8 @@
// Realize that the destination register is defined by the PHI copy now, not
// the PHI itself.
LV->getVarInfo(DestReg).DefInst = PHICopy;
+
+ LV->getVarInfo(IncomingReg).UsedBlocks[MBB.getNumber()] = true;
}
// Adjust the VRegPHIUseCount map to account for the removal of this PHI
@@ -217,6 +219,7 @@
// instruction kills the incoming value.
//
LiveVariables::VarInfo &InRegVI = LV->getVarInfo(SrcReg);
+ InRegVI.UsedBlocks[opBlock.getNumber()] = true;
// Loop over all of the successors of the basic block, checking to see
// if the value is either live in the block, or if it is killed in the
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=43866&r1=43865&r2=43866&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Nov 7 19:20:48 2007
@@ -202,6 +202,10 @@
LiveVariables::VarInfo& varInfo = LV.getVarInfo(regA);
varInfo.DefInst = prevMi;
+ // update live variables for regB
+ LiveVariables::VarInfo& varInfoB = LV.getVarInfo(regB);
+ // regB is used in this BB.
+ varInfoB.UsedBlocks[mbbi->getNumber()] = true;
if (LV.removeVirtualRegisterKilled(regB, mbbi, mi))
LV.addVirtualRegisterKilled(regB, prevMi);
More information about the llvm-commits
mailing list