diff options
author | Owen Anderson <resistor@mac.com> | 2007-11-08 01:20:48 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-11-08 01:20:48 +0000 |
commit | a018540807775703d630e9c92f9d8013d545599e (patch) | |
tree | 9f30b3ba2b3985dd0d498b40311128422cb9471f | |
parent | 43b665db50292420ff310f9050da9c28e48d252c (diff) |
Bring UsedBlocks back. StrongPHIElimination needs this information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43866 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/LiveVariables.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/PHIElimination.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 4 |
3 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 7e8965ea84..2af8bf316e 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -50,6 +50,9 @@ void LiveVariables::VarInfo::dump() const { 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 @@ LiveVariables::VarInfo &LiveVariables::getVarInfo(unsigned RegIdx) { } VarInfo &VI = VirtRegInfo[RegIdx]; VI.AliveBlocks.resize(MF->getNumBlockIDs()); + VI.UsedBlocks.resize(MF->getNumBlockIDs()); return VI; } @@ -154,6 +158,9 @@ void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB, 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 @@ void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB, // 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. diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index ffec6ca6d7..371fb072b5 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -167,6 +167,8 @@ void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, // 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 @@ void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, // 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 diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 277257bd61..b8d38dc229 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -202,6 +202,10 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { 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); |