|
@@ -52,10 +52,11 @@ bool RegAllocBase::VerifyEnabled = false;
|
|
|
void RegAllocBase::verify() {
|
|
|
LiveVirtRegBitSet VisitedVRegs;
|
|
|
OwningArrayPtr<LiveVirtRegBitSet>
|
|
|
- unionVRegs(new LiveVirtRegBitSet[PhysReg2LiveUnion.numRegs()]);
|
|
|
+ unionVRegs(new LiveVirtRegBitSet[TRI->getNumRegs()]);
|
|
|
|
|
|
// Verify disjoint unions.
|
|
|
- for (unsigned PhysReg = 0; PhysReg < PhysReg2LiveUnion.numRegs(); ++PhysReg) {
|
|
|
+ for (unsigned PhysReg = 0, NumRegs = TRI->getNumRegs(); PhysReg != NumRegs;
|
|
|
+ ++PhysReg) {
|
|
|
DEBUG(PhysReg2LiveUnion[PhysReg].print(dbgs(), TRI));
|
|
|
LiveVirtRegBitSet &VRegs = unionVRegs[PhysReg];
|
|
|
PhysReg2LiveUnion[PhysReg].verify(VRegs);
|
|
@@ -89,16 +90,6 @@ void RegAllocBase::verify() {
|
|
|
// RegAllocBase Implementation
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-// Instantiate a LiveIntervalUnion for each physical register.
|
|
|
-void RegAllocBase::LiveUnionArray::init(LiveIntervalUnion::Allocator &allocator,
|
|
|
- unsigned NRegs) {
|
|
|
- NumRegs = NRegs;
|
|
|
- Array =
|
|
|
- static_cast<LiveIntervalUnion*>(malloc(sizeof(LiveIntervalUnion)*NRegs));
|
|
|
- for (unsigned r = 0; r != NRegs; ++r)
|
|
|
- new(Array + r) LiveIntervalUnion(allocator);
|
|
|
-}
|
|
|
-
|
|
|
void RegAllocBase::init(VirtRegMap &vrm, LiveIntervals &lis) {
|
|
|
NamedRegionTimer T("Initialize", TimerGroupName, TimePassesIsEnabled);
|
|
|
TRI = &vrm.getTargetRegInfo();
|
|
@@ -109,25 +100,15 @@ void RegAllocBase::init(VirtRegMap &vrm, LiveIntervals &lis) {
|
|
|
RegClassInfo.runOnMachineFunction(vrm.getMachineFunction());
|
|
|
|
|
|
const unsigned NumRegs = TRI->getNumRegs();
|
|
|
- if (NumRegs != PhysReg2LiveUnion.numRegs()) {
|
|
|
+ if (NumRegs != PhysReg2LiveUnion.size()) {
|
|
|
PhysReg2LiveUnion.init(UnionAllocator, NumRegs);
|
|
|
// Cache an interferece query for each physical reg
|
|
|
- Queries.reset(new LiveIntervalUnion::Query[PhysReg2LiveUnion.numRegs()]);
|
|
|
+ Queries.reset(new LiveIntervalUnion::Query[NumRegs]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void RegAllocBase::LiveUnionArray::clear() {
|
|
|
- if (!Array)
|
|
|
- return;
|
|
|
- for (unsigned r = 0; r != NumRegs; ++r)
|
|
|
- Array[r].~LiveIntervalUnion();
|
|
|
- free(Array);
|
|
|
- NumRegs = 0;
|
|
|
- Array = 0;
|
|
|
-}
|
|
|
-
|
|
|
void RegAllocBase::releaseMemory() {
|
|
|
- for (unsigned r = 0, e = PhysReg2LiveUnion.numRegs(); r != e; ++r)
|
|
|
+ for (unsigned r = 0, e = PhysReg2LiveUnion.size(); r != e; ++r)
|
|
|
PhysReg2LiveUnion[r].clear();
|
|
|
}
|
|
|
|
|
@@ -253,7 +234,8 @@ void RegAllocBase::addMBBLiveIns(MachineFunction *MF) {
|
|
|
return;
|
|
|
|
|
|
LiveIntervalUnion::SegmentIter SI;
|
|
|
- for (unsigned PhysReg = 0; PhysReg < PhysReg2LiveUnion.numRegs(); ++PhysReg) {
|
|
|
+ for (unsigned PhysReg = 0, NumRegs = TRI->getNumRegs(); PhysReg != NumRegs;
|
|
|
+ ++PhysReg) {
|
|
|
LiveIntervalUnion &LiveUnion = PhysReg2LiveUnion[PhysReg];
|
|
|
if (LiveUnion.empty())
|
|
|
continue;
|