mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-02 10:33:53 +00:00
Use DominatorTree instead of ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37538 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a9bf49c7e3
commit
2099ff065d
@ -76,7 +76,7 @@ namespace { // Anonymous namespace for class
|
||||
VerifierFailureAction action;
|
||||
// What to do if verification fails.
|
||||
Module *Mod; // Module we are verifying right now
|
||||
ETForest *EF; // ET-Forest, caution can be null!
|
||||
DominatorTree *DT; // Dominator Tree, caution can be null!
|
||||
std::stringstream msgs; // A stringstream to collect messages
|
||||
|
||||
/// InstInThisBlock - when verifying a basic block, keep track of all of the
|
||||
@ -88,20 +88,20 @@ namespace { // Anonymous namespace for class
|
||||
Verifier()
|
||||
: FunctionPass((intptr_t)&ID),
|
||||
Broken(false), RealPass(true), action(AbortProcessAction),
|
||||
EF(0), msgs( std::ios::app | std::ios::out ) {}
|
||||
DT(0), msgs( std::ios::app | std::ios::out ) {}
|
||||
Verifier( VerifierFailureAction ctn )
|
||||
: FunctionPass((intptr_t)&ID),
|
||||
Broken(false), RealPass(true), action(ctn), EF(0),
|
||||
Broken(false), RealPass(true), action(ctn), DT(0),
|
||||
msgs( std::ios::app | std::ios::out ) {}
|
||||
Verifier(bool AB )
|
||||
: FunctionPass((intptr_t)&ID),
|
||||
Broken(false), RealPass(true),
|
||||
action( AB ? AbortProcessAction : PrintMessageAction), EF(0),
|
||||
action( AB ? AbortProcessAction : PrintMessageAction), DT(0),
|
||||
msgs( std::ios::app | std::ios::out ) {}
|
||||
Verifier(ETForest &ef)
|
||||
Verifier(DominatorTree &dt)
|
||||
: FunctionPass((intptr_t)&ID),
|
||||
Broken(false), RealPass(false), action(PrintMessageAction),
|
||||
EF(&ef), msgs( std::ios::app | std::ios::out ) {}
|
||||
DT(&dt), msgs( std::ios::app | std::ios::out ) {}
|
||||
|
||||
|
||||
bool doInitialization(Module &M) {
|
||||
@ -118,7 +118,7 @@ namespace { // Anonymous namespace for class
|
||||
|
||||
bool runOnFunction(Function &F) {
|
||||
// Get dominator information if we are being run by PassManager
|
||||
if (RealPass) EF = &getAnalysis<ETForest>();
|
||||
if (RealPass) DT = &getAnalysis<DominatorTree>();
|
||||
|
||||
Mod = F.getParent();
|
||||
|
||||
@ -158,7 +158,7 @@ namespace { // Anonymous namespace for class
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
if (RealPass)
|
||||
AU.addRequired<ETForest>();
|
||||
AU.addRequired<DominatorTree>();
|
||||
}
|
||||
|
||||
/// abortIfBroken - If the module is broken and we are supposed to abort on
|
||||
@ -879,7 +879,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
for (Value::use_iterator UI = I.use_begin(), UE = I.use_end();
|
||||
UI != UE; ++UI)
|
||||
Assert1(*UI != (User*)&I ||
|
||||
!EF->dominates(&BB->getParent()->getEntryBlock(), BB),
|
||||
!DT->dominates(&BB->getParent()->getEntryBlock(), BB),
|
||||
"Only PHI nodes may reference their own value!", &I);
|
||||
}
|
||||
|
||||
@ -948,7 +948,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
// dominates all of it's predecessors (other than the invoke) or if
|
||||
// the invoke value is only used by a phi in the successor.
|
||||
if (!OpBlock->getSinglePredecessor() &&
|
||||
EF->dominates(&BB->getParent()->getEntryBlock(), BB)) {
|
||||
DT->dominates(&BB->getParent()->getEntryBlock(), BB)) {
|
||||
// The first case we allow is if the use is a PHI operand in the
|
||||
// normal block, and if that PHI operand corresponds to the invoke's
|
||||
// block.
|
||||
@ -965,7 +965,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
Bad = false;
|
||||
for (pred_iterator PI = pred_begin(OpBlock),
|
||||
E = pred_end(OpBlock); PI != E; ++PI) {
|
||||
if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) {
|
||||
if (*PI != II->getParent() && !DT->dominates(OpBlock, *PI)) {
|
||||
Bad = true;
|
||||
break;
|
||||
}
|
||||
@ -979,20 +979,20 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
// If they are in the same basic block, make sure that the definition
|
||||
// comes before the use.
|
||||
Assert2(InstsInThisBlock.count(Op) ||
|
||||
!EF->dominates(&BB->getParent()->getEntryBlock(), BB),
|
||||
!DT->dominates(&BB->getParent()->getEntryBlock(), BB),
|
||||
"Instruction does not dominate all uses!", Op, &I);
|
||||
}
|
||||
|
||||
// Definition must dominate use unless use is unreachable!
|
||||
Assert2(EF->dominates(OpBlock, BB) ||
|
||||
!EF->dominates(&BB->getParent()->getEntryBlock(), BB),
|
||||
Assert2(DT->dominates(OpBlock, BB) ||
|
||||
!DT->dominates(&BB->getParent()->getEntryBlock(), BB),
|
||||
"Instruction does not dominate all uses!", Op, &I);
|
||||
} else {
|
||||
// PHI nodes are more difficult than other nodes because they actually
|
||||
// "use" the value in the predecessor basic blocks they correspond to.
|
||||
BasicBlock *PredBB = cast<BasicBlock>(I.getOperand(i+1));
|
||||
Assert2(EF->dominates(OpBlock, PredBB) ||
|
||||
!EF->dominates(&BB->getParent()->getEntryBlock(), PredBB),
|
||||
Assert2(DT->dominates(OpBlock, PredBB) ||
|
||||
!DT->dominates(&BB->getParent()->getEntryBlock(), PredBB),
|
||||
"Instruction does not dominate all uses!", Op, &I);
|
||||
}
|
||||
} else if (isa<InlineAsm>(I.getOperand(i))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user