Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/IR/Dominators.cpp
Show All 12 Lines | |||||
// needed to support the Verifier pass. | // needed to support the Verifier pass. | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "llvm/IR/Dominators.h" | #include "llvm/IR/Dominators.h" | ||||
#include "llvm/ADT/DepthFirstIterator.h" | #include "llvm/ADT/DepthFirstIterator.h" | ||||
#include "llvm/ADT/SmallPtrSet.h" | #include "llvm/ADT/SmallPtrSet.h" | ||||
#include "llvm/IR/CFG.h" | #include "llvm/IR/CFG.h" | ||||
#include "llvm/IR/DeferredDominance.h" | |||||
#include "llvm/IR/Instructions.h" | #include "llvm/IR/Instructions.h" | ||||
#include "llvm/IR/PassManager.h" | #include "llvm/IR/PassManager.h" | ||||
#include "llvm/Support/CommandLine.h" | #include "llvm/Support/CommandLine.h" | ||||
#include "llvm/Support/Debug.h" | #include "llvm/Support/Debug.h" | ||||
#include "llvm/Support/GenericDomTreeConstruction.h" | #include "llvm/Support/GenericDomTreeConstruction.h" | ||||
#include "llvm/Support/raw_ostream.h" | #include "llvm/Support/raw_ostream.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
using namespace llvm; | using namespace llvm; | ||||
▲ Show 20 Lines • Show All 355 Lines • ▼ Show 20 Lines | void DominatorTreeWrapperPass::verifyAnalysis() const { | ||||
if (VerifyDomInfo) | if (VerifyDomInfo) | ||||
DT.verifyDomTree(); | DT.verifyDomTree(); | ||||
} | } | ||||
void DominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const { | void DominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const { | ||||
DT.print(OS); | DT.print(OS); | ||||
} | } | ||||
//===----------------------------------------------------------------------===// | |||||
// DeferredDominance Implementation | |||||
//===----------------------------------------------------------------------===// | |||||
// | |||||
// The implementation details of the DeferredDominance class which allows | |||||
// one to queue updates to a DominatorTree. | |||||
// | |||||
//===----------------------------------------------------------------------===// | |||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) | |||||
kuhar: This doesn't seem to modify any internal state, const should work here. | |||||
Agreed. brzycki: Agreed. | |||||
LLVM_DUMP_METHOD void DeferredDominance::dump() const { | |||||
I think this should be llvm::dbgs kuhar: I think this should be llvm::dbgs | |||||
raw_ostream &OS = llvm::dbgs(); | |||||
OS << "PendUpdates:\n"; | |||||
int I = 0; | |||||
for (auto U : PendUpdates) { | |||||
OS << " " << I << " : "; | |||||
++I; | |||||
if (U.getKind() == DominatorTree::Insert) | |||||
OS << "Insert, "; | |||||
else | |||||
OS << "Delete, "; | |||||
BasicBlock *From = U.getFrom(); | |||||
if (From) { | |||||
auto S = From->getName(); | |||||
if (!From->hasName()) | |||||
S = "(no name)"; | |||||
OS << S << "(" << From << "), "; | |||||
} else { | |||||
OS << "(badref), "; | |||||
} | |||||
BasicBlock *To = U.getTo(); | |||||
if (To) { | |||||
auto S = To->getName(); | |||||
if (!To->hasName()) | |||||
S = "(no_name)"; | |||||
OS << S << "(" << To << ")\n"; | |||||
} else { | |||||
OS << "(badref)\n"; | |||||
} | |||||
} | |||||
OS << "DeletedBBs:\n"; | |||||
I = 0; | |||||
for (auto BB : DeletedBBs) { | |||||
OS << " " << I << " : "; | |||||
++I; | |||||
if (BB->hasName()) | |||||
OS << BB->getName() << "("; | |||||
else | |||||
OS << "(no_name)("; | |||||
OS << BB << ")\n"; | |||||
} | |||||
} | |||||
#endif |
This doesn't seem to modify any internal state, const should work here.