Remove the DefBlock element of VarInfo. DefBlock is always DefInst->getParent()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14996 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-07-19 06:26:50 +00:00
parent e312e156c3
commit 73d4adfb1e
2 changed files with 6 additions and 7 deletions

View File

@ -39,8 +39,7 @@ class MRegisterInfo;
class LiveVariables : public MachineFunctionPass { class LiveVariables : public MachineFunctionPass {
public: public:
struct VarInfo { struct VarInfo {
/// DefBlock - The basic block which defines this value... /// DefInst - The machine instruction that defines this register.
MachineBasicBlock *DefBlock;
MachineInstr *DefInst; MachineInstr *DefInst;
/// AliveBlocks - Set of blocks of which this value is alive completely /// AliveBlocks - Set of blocks of which this value is alive completely
@ -55,7 +54,7 @@ public:
/// ///
std::vector<std::pair<MachineBasicBlock*, MachineInstr*> > Kills; std::vector<std::pair<MachineBasicBlock*, MachineInstr*> > Kills;
VarInfo() : DefBlock(0), DefInst(0) {} VarInfo() : DefInst(0) {}
/// removeKill - Delete a kill corresponding to the specified /// removeKill - Delete a kill corresponding to the specified
/// machine instruction. Returns true if there was a kill /// machine instruction. Returns true if there was a kill

View File

@ -64,7 +64,7 @@ void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
break; break;
} }
if (MBB == VRInfo.DefBlock) return; // Terminate recursion if (MBB == VRInfo.DefInst->getParent()) return; // Terminate recursion
if (VRInfo.AliveBlocks.size() <= BBNum) if (VRInfo.AliveBlocks.size() <= BBNum)
VRInfo.AliveBlocks.resize(BBNum+1); // Make space... VRInfo.AliveBlocks.resize(BBNum+1); // Make space...
@ -95,7 +95,8 @@ void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
assert(VRInfo.Kills[i].first != MBB && "entry should be at end!"); assert(VRInfo.Kills[i].first != MBB && "entry should be at end!");
#endif #endif
assert(MBB != VRInfo.DefBlock && "Should have kill for defblock!"); assert(MBB != VRInfo.DefInst->getParent() &&
"Should have kill for defblock!");
// Add a new kill entry for this basic block. // Add a new kill entry for this basic block.
VRInfo.Kills.push_back(std::make_pair(MBB, MI)); VRInfo.Kills.push_back(std::make_pair(MBB, MI));
@ -230,8 +231,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
if (MRegisterInfo::isVirtualRegister(MO.getReg())) { if (MRegisterInfo::isVirtualRegister(MO.getReg())) {
VarInfo &VRInfo = getVarInfo(MO.getReg()); VarInfo &VRInfo = getVarInfo(MO.getReg());
assert(VRInfo.DefBlock == 0 && "Variable multiply defined!"); assert(VRInfo.DefInst == 0 && "Variable multiply defined!");
VRInfo.DefBlock = MBB; // Created here...
VRInfo.DefInst = MI; VRInfo.DefInst = MI;
VRInfo.Kills.push_back(std::make_pair(MBB, MI)); // Defaults to dead VRInfo.Kills.push_back(std::make_pair(MBB, MI)); // Defaults to dead
} else if (MRegisterInfo::isPhysicalRegister(MO.getReg()) && } else if (MRegisterInfo::isPhysicalRegister(MO.getReg()) &&