mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
Verify bundle flags for consistency in MachineVerifier.
The new bidirectional bundle flags are redundant, so inadvertent bundle tearing can be detected in the machine code verifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b519351b87
commit
9466bdebb7
@ -307,6 +307,9 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
visitMachineBasicBlockBefore(MFI);
|
visitMachineBasicBlockBefore(MFI);
|
||||||
// Keep track of the current bundle header.
|
// Keep track of the current bundle header.
|
||||||
const MachineInstr *CurBundle = 0;
|
const MachineInstr *CurBundle = 0;
|
||||||
|
// Do we expect the next instruction to be part of the same bundle?
|
||||||
|
bool InBundle = false;
|
||||||
|
|
||||||
for (MachineBasicBlock::const_instr_iterator MBBI = MFI->instr_begin(),
|
for (MachineBasicBlock::const_instr_iterator MBBI = MFI->instr_begin(),
|
||||||
MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI) {
|
MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI) {
|
||||||
if (MBBI->getParent() != MFI) {
|
if (MBBI->getParent() != MFI) {
|
||||||
@ -314,6 +317,15 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
*OS << "Instruction: " << *MBBI;
|
*OS << "Instruction: " << *MBBI;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for consistent bundle flags.
|
||||||
|
if (InBundle && !MBBI->isBundledWithPred())
|
||||||
|
report("Missing BundledPred flag, "
|
||||||
|
"BundledSucc was set on predecessor", MBBI);
|
||||||
|
if (!InBundle && MBBI->isBundledWithPred())
|
||||||
|
report("BundledPred flag is set, "
|
||||||
|
"but BundledSucc not set on predecessor", MBBI);
|
||||||
|
|
||||||
// Is this a bundle header?
|
// Is this a bundle header?
|
||||||
if (!MBBI->isInsideBundle()) {
|
if (!MBBI->isInsideBundle()) {
|
||||||
if (CurBundle)
|
if (CurBundle)
|
||||||
@ -326,9 +338,14 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I)
|
for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I)
|
||||||
visitMachineOperand(&MBBI->getOperand(I), I);
|
visitMachineOperand(&MBBI->getOperand(I), I);
|
||||||
visitMachineInstrAfter(MBBI);
|
visitMachineInstrAfter(MBBI);
|
||||||
|
|
||||||
|
// Was this the last bundled instruction?
|
||||||
|
InBundle = MBBI->isBundledWithSucc();
|
||||||
}
|
}
|
||||||
if (CurBundle)
|
if (CurBundle)
|
||||||
visitMachineBundleAfter(CurBundle);
|
visitMachineBundleAfter(CurBundle);
|
||||||
|
if (InBundle)
|
||||||
|
report("BundledSucc flag set on last instruction in block", &MFI->back());
|
||||||
visitMachineBasicBlockAfter(MFI);
|
visitMachineBasicBlockAfter(MFI);
|
||||||
}
|
}
|
||||||
visitMachineFunctionAfter();
|
visitMachineFunctionAfter();
|
||||||
|
Loading…
Reference in New Issue
Block a user