mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-30 04:56:49 +00:00
Eliminate the VNInfo::hasPHIKill() flag.
The only real user of the flag was removeCopyByCommutingDef(), and it has been switched to LiveIntervals::hasPHIKill(). All the code changed by this patch was only concerned with computing and propagating the flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0ab7103e06
commit
bf60aa9db5
@ -42,8 +42,7 @@ namespace llvm {
|
|||||||
class VNInfo {
|
class VNInfo {
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
HAS_PHI_KILL = 1,
|
IS_UNUSED = 1
|
||||||
IS_UNUSED = 1 << 1
|
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
@ -82,17 +81,6 @@ namespace llvm {
|
|||||||
flags = (flags | VNI->flags) & ~IS_UNUSED;
|
flags = (flags | VNI->flags) & ~IS_UNUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if one or more kills are PHI nodes.
|
|
||||||
/// Obsolete, do not use!
|
|
||||||
bool hasPHIKill() const { return flags & HAS_PHI_KILL; }
|
|
||||||
/// Set the PHI kill flag on this value.
|
|
||||||
void setHasPHIKill(bool hasKill) {
|
|
||||||
if (hasKill)
|
|
||||||
flags |= HAS_PHI_KILL;
|
|
||||||
else
|
|
||||||
flags &= ~HAS_PHI_KILL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if this value is defined by a PHI instruction (or was,
|
/// Returns true if this value is defined by a PHI instruction (or was,
|
||||||
/// PHI instrucions may have been eliminated).
|
/// PHI instrucions may have been eliminated).
|
||||||
/// PHI-defs begin at a block boundary, all other defs begin at register or
|
/// PHI-defs begin at a block boundary, all other defs begin at register or
|
||||||
|
@ -737,9 +737,7 @@ void LiveInterval::print(raw_ostream &OS) const {
|
|||||||
} else {
|
} else {
|
||||||
OS << vni->def;
|
OS << vni->def;
|
||||||
if (vni->isPHIDef())
|
if (vni->isPHIDef())
|
||||||
OS << "-phidef";
|
OS << "-phi";
|
||||||
if (vni->hasPHIKill())
|
|
||||||
OS << "-phikill";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,6 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
|
|||||||
// new valno in the killing blocks.
|
// new valno in the killing blocks.
|
||||||
assert(vi.AliveBlocks.empty() && "Phi join can't pass through blocks");
|
assert(vi.AliveBlocks.empty() && "Phi join can't pass through blocks");
|
||||||
DEBUG(dbgs() << " phi-join");
|
DEBUG(dbgs() << " phi-join");
|
||||||
ValNo->setHasPHIKill(true);
|
|
||||||
} else {
|
} else {
|
||||||
// Iterate over all of the blocks that the variable is completely
|
// Iterate over all of the blocks that the variable is completely
|
||||||
// live in, adding [insrtIndex(begin), instrIndex(end)+4) to the
|
// live in, adding [insrtIndex(begin), instrIndex(end)+4) to the
|
||||||
@ -357,7 +356,6 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
|
|||||||
SlotIndex killIndex = getMBBEndIdx(mbb);
|
SlotIndex killIndex = getMBBEndIdx(mbb);
|
||||||
LiveRange LR(defIndex, killIndex, ValNo);
|
LiveRange LR(defIndex, killIndex, ValNo);
|
||||||
interval.addRange(LR);
|
interval.addRange(LR);
|
||||||
ValNo->setHasPHIKill(true);
|
|
||||||
DEBUG(dbgs() << " phi-join +" << LR);
|
DEBUG(dbgs() << " phi-join +" << LR);
|
||||||
} else {
|
} else {
|
||||||
llvm_unreachable("Multiply defined register");
|
llvm_unreachable("Multiply defined register");
|
||||||
@ -823,7 +821,6 @@ LiveRange LiveIntervals::addLiveRangeToEndOfBlock(unsigned reg,
|
|||||||
VNInfo* VN = Interval.getNextValue(
|
VNInfo* VN = Interval.getNextValue(
|
||||||
SlotIndex(getInstructionIndex(startInst).getRegSlot()),
|
SlotIndex(getInstructionIndex(startInst).getRegSlot()),
|
||||||
getVNInfoAllocator());
|
getVNInfoAllocator());
|
||||||
VN->setHasPHIKill(true);
|
|
||||||
LiveRange LR(
|
LiveRange LR(
|
||||||
SlotIndex(getInstructionIndex(startInst).getRegSlot()),
|
SlotIndex(getInstructionIndex(startInst).getRegSlot()),
|
||||||
getMBBEndIdx(startInst->getParent()), VN);
|
getMBBEndIdx(startInst->getParent()), VN);
|
||||||
|
@ -460,14 +460,8 @@ bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP,
|
|||||||
IntB.addRange(LiveRange(FillerStart, FillerEnd, BValNo));
|
IntB.addRange(LiveRange(FillerStart, FillerEnd, BValNo));
|
||||||
|
|
||||||
// Okay, merge "B1" into the same value number as "B0".
|
// Okay, merge "B1" into the same value number as "B0".
|
||||||
if (BValNo != ValLR->valno) {
|
if (BValNo != ValLR->valno)
|
||||||
// If B1 is killed by a PHI, then the merged live range must also be killed
|
|
||||||
// by the same PHI, as B0 and B1 can not overlap.
|
|
||||||
bool HasPHIKill = BValNo->hasPHIKill();
|
|
||||||
IntB.MergeValueNumberInto(BValNo, ValLR->valno);
|
IntB.MergeValueNumberInto(BValNo, ValLR->valno);
|
||||||
if (HasPHIKill)
|
|
||||||
ValLR->valno->setHasPHIKill(true);
|
|
||||||
}
|
|
||||||
DEBUG(dbgs() << " result = " << IntB << '\n');
|
DEBUG(dbgs() << " result = " << IntB << '\n');
|
||||||
|
|
||||||
// If the source instruction was killing the source register before the
|
// If the source instruction was killing the source register before the
|
||||||
@ -1386,24 +1380,6 @@ bool RegisterCoalescer::joinIntervals(CoalescerPair &CP) {
|
|||||||
++J;
|
++J;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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];
|
|
||||||
if (VNI->hasPHIKill())
|
|
||||||
NewVNInfo[LHSValID]->setHasPHIKill(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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];
|
|
||||||
if (VNI->hasPHIKill())
|
|
||||||
NewVNInfo[RHSValID]->setHasPHIKill(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear kill flags where live ranges are extended.
|
// Clear kill flags where live ranges are extended.
|
||||||
while (!LHSOldKills.empty())
|
while (!LHSOldKills.empty())
|
||||||
LHSOldKills.pop_back_val()->clearRegisterKills(LHS.reg, TRI);
|
LHSOldKills.pop_back_val()->clearRegisterKills(LHS.reg, TRI);
|
||||||
|
@ -673,7 +673,6 @@ void StrongPHIElimination::InsertCopiesForPHI(MachineInstr *PHI,
|
|||||||
SlotIndex PredIndex = LI->getMBBEndIdx(PredBB);
|
SlotIndex PredIndex = LI->getMBBEndIdx(PredBB);
|
||||||
VNInfo *SrcVNI = SrcInterval.getVNInfoBefore(PredIndex);
|
VNInfo *SrcVNI = SrcInterval.getVNInfoBefore(PredIndex);
|
||||||
assert(SrcVNI);
|
assert(SrcVNI);
|
||||||
SrcVNI->setHasPHIKill(true);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user