CodeGen/LiveVariables: switch to std::vector
No functionality change. llvm-svn: 216367
This commit is contained in:
parent
b899464f5b
commit
46a922c191
|
@ -134,14 +134,14 @@ private: // Intermediate data structures
|
||||||
// PhysRegInfo - Keep track of which instruction was the last def of a
|
// PhysRegInfo - Keep track of which instruction was the last def of a
|
||||||
// physical register. This is a purely local property, because all physical
|
// physical register. This is a purely local property, because all physical
|
||||||
// register references are presumed dead across basic blocks.
|
// register references are presumed dead across basic blocks.
|
||||||
MachineInstr **PhysRegDef;
|
std::vector<MachineInstr *> PhysRegDef;
|
||||||
|
|
||||||
// PhysRegInfo - Keep track of which instruction was the last use of a
|
// PhysRegInfo - Keep track of which instruction was the last use of a
|
||||||
// physical register. This is a purely local property, because all physical
|
// physical register. This is a purely local property, because all physical
|
||||||
// register references are presumed dead across basic blocks.
|
// register references are presumed dead across basic blocks.
|
||||||
MachineInstr **PhysRegUse;
|
std::vector<MachineInstr *> PhysRegUse;
|
||||||
|
|
||||||
SmallVector<unsigned, 4> *PHIVarInfo;
|
std::vector<SmallVector<unsigned, 4>> PHIVarInfo;
|
||||||
|
|
||||||
// DistanceMap - Keep track the distance of a MI from the start of the
|
// DistanceMap - Keep track the distance of a MI from the start of the
|
||||||
// current basic block.
|
// current basic block.
|
||||||
|
|
|
@ -502,12 +502,12 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
|
||||||
MRI = &mf.getRegInfo();
|
MRI = &mf.getRegInfo();
|
||||||
TRI = MF->getSubtarget().getRegisterInfo();
|
TRI = MF->getSubtarget().getRegisterInfo();
|
||||||
|
|
||||||
unsigned NumRegs = TRI->getNumRegs();
|
const unsigned NumRegs = TRI->getNumRegs();
|
||||||
PhysRegDef = new MachineInstr*[NumRegs];
|
PhysRegDef.clear();
|
||||||
PhysRegUse = new MachineInstr*[NumRegs];
|
PhysRegUse.clear();
|
||||||
PHIVarInfo = new SmallVector<unsigned, 4>[MF->getNumBlockIDs()];
|
PhysRegDef.resize(NumRegs, nullptr);
|
||||||
std::fill(PhysRegDef, PhysRegDef + NumRegs, nullptr);
|
PhysRegUse.resize(NumRegs, nullptr);
|
||||||
std::fill(PhysRegUse, PhysRegUse + NumRegs, nullptr);
|
PHIVarInfo.resize(MF->getNumBlockIDs());
|
||||||
PHIJoins.clear();
|
PHIJoins.clear();
|
||||||
|
|
||||||
// FIXME: LiveIntervals will be updated to remove its dependence on
|
// FIXME: LiveIntervals will be updated to remove its dependence on
|
||||||
|
@ -637,8 +637,10 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
|
||||||
if ((PhysRegDef[i] || PhysRegUse[i]) && !LiveOuts.count(i))
|
if ((PhysRegDef[i] || PhysRegUse[i]) && !LiveOuts.count(i))
|
||||||
HandlePhysRegDef(i, nullptr, Defs);
|
HandlePhysRegDef(i, nullptr, Defs);
|
||||||
|
|
||||||
std::fill(PhysRegDef, PhysRegDef + NumRegs, nullptr);
|
PhysRegDef.clear();
|
||||||
std::fill(PhysRegUse, PhysRegUse + NumRegs, nullptr);
|
PhysRegUse.clear();
|
||||||
|
PhysRegDef.resize(NumRegs, nullptr);
|
||||||
|
PhysRegUse.resize(NumRegs, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert and transfer the dead / killed information we have gathered into
|
// Convert and transfer the dead / killed information we have gathered into
|
||||||
|
@ -660,9 +662,9 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
|
||||||
assert(Visited.count(&*i) != 0 && "unreachable basic block found");
|
assert(Visited.count(&*i) != 0 && "unreachable basic block found");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete[] PhysRegDef;
|
PhysRegDef.clear();
|
||||||
delete[] PhysRegUse;
|
PhysRegUse.clear();
|
||||||
delete[] PHIVarInfo;
|
PHIVarInfo.clear();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue