mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
More tweaks to improve compile time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41669 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e9c473c4d
commit
343013538f
@ -288,26 +288,24 @@ LiveInterval::FindLiveRangeContaining(unsigned Idx) {
|
|||||||
void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments,
|
void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments,
|
||||||
int *RHSValNoAssignments,
|
int *RHSValNoAssignments,
|
||||||
SmallVector<VNInfo*, 16> &NewVNInfo) {
|
SmallVector<VNInfo*, 16> &NewVNInfo) {
|
||||||
|
|
||||||
// There might be some dead val#, create VNInfo for them.
|
|
||||||
for (unsigned i = 0, e = NewVNInfo.size(); i != e; ++i) {
|
|
||||||
VNInfo *VNI = NewVNInfo[i];
|
|
||||||
if (!VNI) {
|
|
||||||
VNI = new VNInfo(this, i, ~1U, 0);
|
|
||||||
NewVNInfo[i] = VNI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine if any of our live range values are mapped. This is uncommon, so
|
// Determine if any of our live range values are mapped. This is uncommon, so
|
||||||
// we want to avoid the interval scan if not.
|
// we want to avoid the interval scan if not.
|
||||||
bool MustMapCurValNos = false;
|
bool MustMapCurValNos = false;
|
||||||
for (vni_iterator i = vni_begin(), e = vni_end(); i != e; ++i) {
|
unsigned NumVals = getNumValNums();
|
||||||
VNInfo *VNI = *i;
|
unsigned NumNewVals = NewVNInfo.size();
|
||||||
unsigned VN = VNI->id;
|
for (unsigned i = 0; i != NumVals; ++i) {
|
||||||
if (VNI->def == ~1U) continue; // tombstone value #
|
unsigned LHSValID = LHSValNoAssignments[i];
|
||||||
if (VNI != NewVNInfo[LHSValNoAssignments[VN]]) {
|
if (i != LHSValID ||
|
||||||
|
(NewVNInfo[LHSValID] && NewVNInfo[LHSValID]->parent != this))
|
||||||
MustMapCurValNos = true;
|
MustMapCurValNos = true;
|
||||||
break;
|
|
||||||
|
// There might be some dead val#, create VNInfo for them.
|
||||||
|
if (i < NumNewVals) {
|
||||||
|
VNInfo *VNI = NewVNInfo[i];
|
||||||
|
if (!VNI) {
|
||||||
|
VNI = new VNInfo(this, i, ~1U, 0);
|
||||||
|
NewVNInfo[i] = VNI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,19 +340,34 @@ void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remember assignements because val# ids are changing.
|
// Remember assignements because val# ids are changing.
|
||||||
std::vector<unsigned> OtherAssignments;
|
SmallVector<unsigned, 16> OtherAssignments;
|
||||||
for (iterator I = Other.begin(), E = Other.end(); I != E; ++I)
|
for (iterator I = Other.begin(), E = Other.end(); I != E; ++I)
|
||||||
OtherAssignments.push_back(RHSValNoAssignments[I->valno->id]);
|
OtherAssignments.push_back(RHSValNoAssignments[I->valno->id]);
|
||||||
|
|
||||||
// Update val# info. Renumber them and make sure they all belong to this
|
// Update val# info. Renumber them and make sure they all belong to this
|
||||||
// LiveInterval now.
|
// LiveInterval now.
|
||||||
valnos.clear();
|
for (unsigned i = 0; i != NumVals; ++i) {
|
||||||
for (unsigned i = 0, e = NewVNInfo.size(); i != e; ++i) {
|
if (i == NumNewVals)
|
||||||
|
break;
|
||||||
VNInfo *VNI = NewVNInfo[i];
|
VNInfo *VNI = NewVNInfo[i];
|
||||||
VNI->parent = this;
|
if (VNI->parent != this || VNI->id != i) {
|
||||||
VNI->id = i; // Renumber val#.
|
VNI->parent = this;
|
||||||
|
VNI->id = i; // Renumber val#.
|
||||||
|
valnos[i] = VNI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (unsigned i = NumVals; i < NumNewVals; ++i) {
|
||||||
|
VNInfo *VNI = NewVNInfo[i];
|
||||||
|
if (!VNI)
|
||||||
|
VNI = new VNInfo(this, i, ~1U, 0);
|
||||||
|
else {
|
||||||
|
VNI->parent = this;
|
||||||
|
VNI->id = i; // Renumber val#.
|
||||||
|
}
|
||||||
valnos.push_back(VNI);
|
valnos.push_back(VNI);
|
||||||
}
|
}
|
||||||
|
if (NumNewVals < NumVals)
|
||||||
|
valnos.resize(NumNewVals); // shrinkify
|
||||||
|
|
||||||
// Okay, now insert the RHS live ranges into the LHS.
|
// Okay, now insert the RHS live ranges into the LHS.
|
||||||
iterator InsertPos = begin();
|
iterator InsertPos = begin();
|
||||||
|
@ -682,8 +682,9 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS,
|
|||||||
assert(RHSValID != -1 && "Didn't find value #?");
|
assert(RHSValID != -1 && "Didn't find value #?");
|
||||||
RHSValNoAssignments[0] = RHSValID;
|
RHSValNoAssignments[0] = RHSValID;
|
||||||
if (RHSVal0DefinedFromLHS != -1) {
|
if (RHSVal0DefinedFromLHS != -1) {
|
||||||
RHSValsDefinedFromLHS[RHSValNoInfo0] =
|
// This path doesn't go through ComputeUltimateVN so just set
|
||||||
LHS.getLiveRangeContaining(RHSValNoInfo0->def-1)->valno;
|
// it to anything.
|
||||||
|
RHSValsDefinedFromLHS[RHSValNoInfo0] = (VNInfo*)1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Loop over the value numbers of the LHS, seeing if any are defined from
|
// Loop over the value numbers of the LHS, seeing if any are defined from
|
||||||
@ -798,31 +799,32 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update kill info. Some live ranges are extended due to copy coalescing.
|
|
||||||
for (DenseMap<VNInfo*, VNInfo*>::iterator I = RHSValsDefinedFromLHS.begin(),
|
|
||||||
E = RHSValsDefinedFromLHS.end(); I != E; ++I) {
|
|
||||||
VNInfo *VNI = I->first;
|
|
||||||
unsigned RHSValID = RHSValNoAssignments[VNI->id];
|
|
||||||
LiveInterval::removeKill(*NewVNInfo[RHSValID], VNI->def);
|
|
||||||
LHS.addKills(*NewVNInfo[RHSValID], VNI->kills);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (DenseMap<VNInfo*, VNInfo*>::iterator I = LHSValsDefinedFromRHS.begin(),
|
|
||||||
E = LHSValsDefinedFromRHS.end(); I != E; ++I) {
|
|
||||||
VNInfo *VNI = I->first;
|
|
||||||
unsigned LHSValID = LHSValNoAssignments[VNI->id];
|
|
||||||
LiveInterval::removeKill(*NewVNInfo[LHSValID], VNI->def);
|
|
||||||
RHS.addKills(*NewVNInfo[LHSValID], VNI->kills);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we get here, we know that we can coalesce the live ranges. Ask the
|
// If we get here, we know that we can coalesce the live ranges. Ask the
|
||||||
// intervals to coalesce themselves now.
|
// intervals to coalesce themselves now.
|
||||||
if ((RHS.ranges.size() > LHS.ranges.size() &&
|
if ((RHS.ranges.size() > LHS.ranges.size() &&
|
||||||
MRegisterInfo::isVirtualRegister(LHS.reg)) ||
|
MRegisterInfo::isVirtualRegister(LHS.reg)) ||
|
||||||
MRegisterInfo::isPhysicalRegister(RHS.reg)) {
|
MRegisterInfo::isPhysicalRegister(RHS.reg)) {
|
||||||
|
// Update kill info. Some live ranges are extended due to copy coalescing.
|
||||||
|
for (DenseMap<VNInfo*, VNInfo*>::iterator I = LHSValsDefinedFromRHS.begin(),
|
||||||
|
E = LHSValsDefinedFromRHS.end(); I != E; ++I) {
|
||||||
|
VNInfo *VNI = I->first;
|
||||||
|
unsigned LHSValID = LHSValNoAssignments[VNI->id];
|
||||||
|
LiveInterval::removeKill(*NewVNInfo[LHSValID], VNI->def);
|
||||||
|
RHS.addKills(*NewVNInfo[LHSValID], VNI->kills);
|
||||||
|
}
|
||||||
|
|
||||||
RHS.join(LHS, &RHSValNoAssignments[0], &LHSValNoAssignments[0], NewVNInfo);
|
RHS.join(LHS, &RHSValNoAssignments[0], &LHSValNoAssignments[0], NewVNInfo);
|
||||||
Swapped = true;
|
Swapped = true;
|
||||||
} else {
|
} else {
|
||||||
|
// Update kill info. Some live ranges are extended due to copy coalescing.
|
||||||
|
for (DenseMap<VNInfo*, VNInfo*>::iterator I = RHSValsDefinedFromLHS.begin(),
|
||||||
|
E = RHSValsDefinedFromLHS.end(); I != E; ++I) {
|
||||||
|
VNInfo *VNI = I->first;
|
||||||
|
unsigned RHSValID = RHSValNoAssignments[VNI->id];
|
||||||
|
LiveInterval::removeKill(*NewVNInfo[RHSValID], VNI->def);
|
||||||
|
LHS.addKills(*NewVNInfo[RHSValID], VNI->kills);
|
||||||
|
}
|
||||||
|
|
||||||
LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], NewVNInfo);
|
LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], NewVNInfo);
|
||||||
Swapped = false;
|
Swapped = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user