//===----------------------------------------------------------------------===//
#include "llvm/Analysis/RegionPass.h"
#include "llvm/Analysis/RegionIterator.h"
-#include "llvm/Support/Timer.h"
-
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Timer.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#define DEBUG_TYPE "regionpassmgr"
/// Pass Manager itself does not invalidate any analysis info.
void RGPassManager::getAnalysisUsage(AnalysisUsage &Info) const {
- Info.addRequired<RegionInfo>();
+ Info.addRequired<RegionInfoPass>();
Info.setPreservesAll();
}
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the function, and if so, return true.
bool RGPassManager::runOnFunction(Function &F) {
- RI = &getAnalysis<RegionInfo>();
+ RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
bool Changed = false;
// Collect inherited analysis from Module level pass manager.
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
RegionPass *P = (RegionPass*)getContainedPass(Index);
- dumpPassInfo(P, EXECUTION_MSG, ON_REGION_MSG,
- CurrentRegion->getNameStr());
- dumpRequiredSet(P);
+ if (isPassDebuggingExecutionsOrMore()) {
+ dumpPassInfo(P, EXECUTION_MSG, ON_REGION_MSG,
+ CurrentRegion->getNameStr());
+ dumpRequiredSet(P);
+ }
initializeAnalysisImpl(P);
Changed |= P->runOnRegion(CurrentRegion, *this);
}
- if (Changed)
- dumpPassInfo(P, MODIFICATION_MSG, ON_REGION_MSG,
- skipThisRegion ? "<deleted>" :
- CurrentRegion->getNameStr());
- dumpPreservedSet(P);
+ if (isPassDebuggingExecutionsOrMore()) {
+ if (Changed)
+ dumpPassInfo(P, MODIFICATION_MSG, ON_REGION_MSG,
+ skipThisRegion ? "<deleted>" :
+ CurrentRegion->getNameStr());
+ dumpPreservedSet(P);
+ }
if (!skipThisRegion) {
// Manually check that this region is still healthy. This is done
removeNotPreservedAnalysis(P);
recordAvailableAnalysis(P);
removeDeadPasses(P,
- skipThisRegion ? "<deleted>" :
- CurrentRegion->getNameStr(),
+ (!isPassDebuggingExecutionsOrMore() || skipThisRegion) ?
+ "<deleted>" : CurrentRegion->getNameStr(),
ON_REGION_MSG);
if (skipThisRegion)
bool runOnRegion(Region *R, RGPassManager &RGM) override {
Out << Banner;
- for (const auto &BB : R->blocks()) {
- assert(BB != nullptr && "Expecting non-null Block");
- BB->print(Out);
+ for (const auto *BB : R->blocks()) {
+ if (BB)
+ BB->print(Out);
+ else
+ Out << "Printing <null> Block";
}
return false;