mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Extract some methods from verifyLiveIntervals.
No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a62e1e8bc6
commit
e5c79a5c25
@ -212,6 +212,10 @@ namespace {
|
|||||||
void calcRegsRequired();
|
void calcRegsRequired();
|
||||||
void verifyLiveVariables();
|
void verifyLiveVariables();
|
||||||
void verifyLiveIntervals();
|
void verifyLiveIntervals();
|
||||||
|
void verifyLiveInterval(const LiveInterval&);
|
||||||
|
void verifyLiveIntervalValue(const LiveInterval&, VNInfo*);
|
||||||
|
void verifyLiveIntervalSegment(const LiveInterval&,
|
||||||
|
LiveInterval::const_iterator);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MachineVerifierPass : public MachineFunctionPass {
|
struct MachineVerifierPass : public MachineFunctionPass {
|
||||||
@ -1138,28 +1142,28 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
|
|
||||||
const LiveInterval &LI = LiveInts->getInterval(Reg);
|
const LiveInterval &LI = LiveInts->getInterval(Reg);
|
||||||
assert(Reg == LI.reg && "Invalid reg to interval mapping");
|
assert(Reg == LI.reg && "Invalid reg to interval mapping");
|
||||||
|
verifyLiveInterval(LI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MachineVerifier::verifyLiveIntervalValue(const LiveInterval &LI,
|
||||||
|
VNInfo *VNI) {
|
||||||
|
if (VNI->isUnused())
|
||||||
|
return;
|
||||||
|
|
||||||
for (LiveInterval::const_vni_iterator I = LI.vni_begin(), E = LI.vni_end();
|
|
||||||
I!=E; ++I) {
|
|
||||||
VNInfo *VNI = *I;
|
|
||||||
const VNInfo *DefVNI = LI.getVNInfoAt(VNI->def);
|
const VNInfo *DefVNI = LI.getVNInfoAt(VNI->def);
|
||||||
|
|
||||||
if (!DefVNI) {
|
if (!DefVNI) {
|
||||||
if (!VNI->isUnused()) {
|
|
||||||
report("Valno not live at def and not marked unused", MF);
|
report("Valno not live at def and not marked unused", MF);
|
||||||
*OS << "Valno #" << VNI->id << " in " << LI << '\n';
|
*OS << "Valno #" << VNI->id << " in " << LI << '\n';
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VNI->isUnused())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (DefVNI != VNI) {
|
if (DefVNI != VNI) {
|
||||||
report("Live range at def has different valno", MF);
|
report("Live range at def has different valno", MF);
|
||||||
*OS << "Valno #" << VNI->id << " is defined at " << VNI->def
|
*OS << "Valno #" << VNI->id << " is defined at " << VNI->def
|
||||||
<< " where valno #" << DefVNI->id << " is live in " << LI << '\n';
|
<< " where valno #" << DefVNI->id << " is live in " << LI << '\n';
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(VNI->def);
|
const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(VNI->def);
|
||||||
@ -1167,7 +1171,7 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
report("Invalid definition index", MF);
|
report("Invalid definition index", MF);
|
||||||
*OS << "Valno #" << VNI->id << " is defined at " << VNI->def
|
*OS << "Valno #" << VNI->id << " is defined at " << VNI->def
|
||||||
<< " in " << LI << '\n';
|
<< " in " << LI << '\n';
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VNI->isPHIDef()) {
|
if (VNI->isPHIDef()) {
|
||||||
@ -1177,14 +1181,16 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
<< ", not at the beginning of BB#" << MBB->getNumber()
|
<< ", not at the beginning of BB#" << MBB->getNumber()
|
||||||
<< " in " << LI << '\n';
|
<< " in " << LI << '\n';
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Non-PHI def.
|
// Non-PHI def.
|
||||||
const MachineInstr *MI = LiveInts->getInstructionFromIndex(VNI->def);
|
const MachineInstr *MI = LiveInts->getInstructionFromIndex(VNI->def);
|
||||||
if (!MI) {
|
if (!MI) {
|
||||||
report("No instruction at def index", MF);
|
report("No instruction at def index", MF);
|
||||||
*OS << "Valno #" << VNI->id << " is defined at " << VNI->def
|
*OS << "Valno #" << VNI->id << " is defined at " << VNI->def
|
||||||
<< " in " << LI << '\n';
|
<< " in " << LI << '\n';
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasDef = false;
|
bool hasDef = false;
|
||||||
@ -1225,9 +1231,10 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
<< " in " << LI << '\n';
|
<< " in " << LI << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I!=E; ++I) {
|
void
|
||||||
|
MachineVerifier::verifyLiveIntervalSegment(const LiveInterval &LI,
|
||||||
|
LiveInterval::const_iterator I) {
|
||||||
const VNInfo *VNI = I->valno;
|
const VNInfo *VNI = I->valno;
|
||||||
assert(VNI && "Live range has no valno");
|
assert(VNI && "Live range has no valno");
|
||||||
|
|
||||||
@ -1248,14 +1255,14 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
report("Bad start of live segment, no basic block", MF);
|
report("Bad start of live segment, no basic block", MF);
|
||||||
I->print(*OS);
|
I->print(*OS);
|
||||||
*OS << " in " << LI << '\n';
|
*OS << " in " << LI << '\n';
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
SlotIndex MBBStartIdx = LiveInts->getMBBStartIdx(MBB);
|
SlotIndex MBBStartIdx = LiveInts->getMBBStartIdx(MBB);
|
||||||
if (I->start != MBBStartIdx && I->start != VNI->def) {
|
if (I->start != MBBStartIdx && I->start != VNI->def) {
|
||||||
report("Live segment must begin at MBB entry or valno def", MBB);
|
report("Live segment must begin at MBB entry or valno def", MBB);
|
||||||
I->print(*OS);
|
I->print(*OS);
|
||||||
*OS << " in " << LI << '\n' << "Basic block starts at "
|
*OS << " in " << LI << '\n'
|
||||||
<< MBBStartIdx << '\n';
|
<< "Basic block starts at " << MBBStartIdx << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
const MachineBasicBlock *EndMBB =
|
const MachineBasicBlock *EndMBB =
|
||||||
@ -1264,12 +1271,12 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
report("Bad end of live segment, no basic block", MF);
|
report("Bad end of live segment, no basic block", MF);
|
||||||
I->print(*OS);
|
I->print(*OS);
|
||||||
*OS << " in " << LI << '\n';
|
*OS << " in " << LI << '\n';
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No more checks for live-out segments.
|
// No more checks for live-out segments.
|
||||||
if (I->end == LiveInts->getMBBEndIdx(EndMBB))
|
if (I->end == LiveInts->getMBBEndIdx(EndMBB))
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
// The live segment is ending inside EndMBB
|
// The live segment is ending inside EndMBB
|
||||||
const MachineInstr *MI =
|
const MachineInstr *MI =
|
||||||
@ -1277,9 +1284,9 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
if (!MI) {
|
if (!MI) {
|
||||||
report("Live segment doesn't end at a valid instruction", EndMBB);
|
report("Live segment doesn't end at a valid instruction", EndMBB);
|
||||||
I->print(*OS);
|
I->print(*OS);
|
||||||
*OS << " in " << LI << '\n' << "Basic block starts at "
|
*OS << " in " << LI << '\n'
|
||||||
<< MBBStartIdx << '\n';
|
<< "Basic block starts at " << MBBStartIdx << '\n';
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The block slot must refer to a basic block boundary.
|
// The block slot must refer to a basic block boundary.
|
||||||
@ -1302,7 +1309,7 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
// A live segment can only end at an early-clobber slot if it is being
|
// A live segment can only end at an early-clobber slot if it is being
|
||||||
// redefined by an early-clobber def.
|
// redefined by an early-clobber def.
|
||||||
if (I->end.isEarlyClobber()) {
|
if (I->end.isEarlyClobber()) {
|
||||||
if (I+1 == E || (I+1)->start != I->end) {
|
if (I+1 == LI.end() || (I+1)->start != I->end) {
|
||||||
report("Live segment ending at early clobber slot must be "
|
report("Live segment ending at early clobber slot must be "
|
||||||
"redefined by an EC def in the same instruction", MI);
|
"redefined by an EC def in the same instruction", MI);
|
||||||
I->print(*OS);
|
I->print(*OS);
|
||||||
@ -1348,7 +1355,7 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
if (I->start == VNI->def && !VNI->isPHIDef()) {
|
if (I->start == VNI->def && !VNI->isPHIDef()) {
|
||||||
// Not live-in to any blocks.
|
// Not live-in to any blocks.
|
||||||
if (MBB == EndMBB)
|
if (MBB == EndMBB)
|
||||||
continue;
|
return;
|
||||||
// Skip this block.
|
// Skip this block.
|
||||||
++MFI;
|
++MFI;
|
||||||
}
|
}
|
||||||
@ -1389,7 +1396,7 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
<< (*PI)->getNumber() << '@' << PEnd
|
<< (*PI)->getNumber() << '@' << PEnd
|
||||||
<< "\nValno #" << VNI->id << " live into BB#" << MFI->getNumber()
|
<< "\nValno #" << VNI->id << " live into BB#" << MFI->getNumber()
|
||||||
<< '@' << LiveInts->getMBBStartIdx(MFI) << " in "
|
<< '@' << LiveInts->getMBBStartIdx(MFI) << " in "
|
||||||
<< PrintReg(Reg) << ": " << LI << '\n';
|
<< PrintReg(LI.reg) << ": " << LI << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (&*MFI == EndMBB)
|
if (&*MFI == EndMBB)
|
||||||
@ -1398,6 +1405,14 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MachineVerifier::verifyLiveInterval(const LiveInterval &LI) {
|
||||||
|
for (LiveInterval::const_vni_iterator I = LI.vni_begin(), E = LI.vni_end();
|
||||||
|
I!=E; ++I)
|
||||||
|
verifyLiveIntervalValue(LI, *I);
|
||||||
|
|
||||||
|
for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I!=E; ++I)
|
||||||
|
verifyLiveIntervalSegment(LI, I);
|
||||||
|
|
||||||
// Check the LI only has one connected component.
|
// Check the LI only has one connected component.
|
||||||
if (TargetRegisterInfo::isVirtualRegister(LI.reg)) {
|
if (TargetRegisterInfo::isVirtualRegister(LI.reg)) {
|
||||||
ConnectedVNInfoEqClasses ConEQ(*LiveInts);
|
ConnectedVNInfoEqClasses ConEQ(*LiveInts);
|
||||||
@ -1416,4 +1431,3 @@ void MachineVerifier::verifyLiveIntervals() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user