projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove duplication of relocation names in lib/Object/ELFYAML.cpp
[oota-llvm.git]
/
lib
/
Analysis
/
RegionPrinter.cpp
diff --git
a/lib/Analysis/RegionPrinter.cpp
b/lib/Analysis/RegionPrinter.cpp
index 8b23cc70424212661c54ddbe28dc749d49a85c24..ad83113ec930193564e254a98b8597b0d6c2c921 100644
(file)
--- a/
lib/Analysis/RegionPrinter.cpp
+++ b/
lib/Analysis/RegionPrinter.cpp
@@
-9,16
+9,16
@@
// Print out the region tree of a function using dotty/graphviz.
//===----------------------------------------------------------------------===//
// Print out the region tree of a function using dotty/graphviz.
//===----------------------------------------------------------------------===//
+#include "llvm/Analysis/Passes.h"
+#include "llvm/ADT/DepthFirstIterator.h"
+#include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/DOTGraphTraitsPass.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/RegionIterator.h"
#include "llvm/Analysis/RegionPrinter.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/RegionIterator.h"
#include "llvm/Analysis/RegionPrinter.h"
-#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/DOTGraphTraitsPass.h"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/ADT/PostOrderIterator.h"
-#include "llvm/ADT/DepthFirstIterator.h"
-#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@
-56,23
+56,24
@@
struct DOTGraphTraits<RegionNode*> : public DefaultDOTGraphTraits {
};
template<>
};
template<>
-struct DOTGraphTraits<RegionInfo*> : public DOTGraphTraits<RegionNode*> {
+struct DOTGraphTraits<RegionInfo
Pass
*> : public DOTGraphTraits<RegionNode*> {
- DOTGraphTraits (bool isSimple
=
false)
+ DOTGraphTraits (bool isSimple
=
false)
: DOTGraphTraits<RegionNode*>(isSimple) {}
: DOTGraphTraits<RegionNode*>(isSimple) {}
- static std::string getGraphName(RegionInfo *DT) {
+ static std::string getGraphName(RegionInfo
Pass
*DT) {
return "Region Graph";
}
return "Region Graph";
}
- std::string getNodeLabel(RegionNode *Node, RegionInfo *G) {
+ std::string getNodeLabel(RegionNode *Node, RegionInfoPass *G) {
+ RegionInfo &RI = G->getRegionInfo();
return DOTGraphTraits<RegionNode*>::getNodeLabel(Node,
return DOTGraphTraits<RegionNode*>::getNodeLabel(Node,
-
G->getTopLevelRegion(
));
+
reinterpret_cast<RegionNode*>(RI.getTopLevelRegion()
));
}
std::string getEdgeAttributes(RegionNode *srcNode,
}
std::string getEdgeAttributes(RegionNode *srcNode,
- GraphTraits<RegionInfo*>::ChildIteratorType CI, RegionInfo
*RI
) {
-
+ GraphTraits<RegionInfo*>::ChildIteratorType CI, RegionInfo
Pass *G
) {
+ RegionInfo &RI = G->getRegionInfo();
RegionNode *destNode = *CI;
if (srcNode->isSubRegion() || destNode->isSubRegion())
RegionNode *destNode = *CI;
if (srcNode->isSubRegion() || destNode->isSubRegion())
@@
-82,7
+83,7
@@
struct DOTGraphTraits<RegionInfo*> : public DOTGraphTraits<RegionNode*> {
BasicBlock *srcBB = srcNode->getNodeAs<BasicBlock>();
BasicBlock *destBB = destNode->getNodeAs<BasicBlock>();
BasicBlock *srcBB = srcNode->getNodeAs<BasicBlock>();
BasicBlock *destBB = destNode->getNodeAs<BasicBlock>();
- Region *R = RI
->
getRegionFor(destBB);
+ Region *R = RI
.
getRegionFor(destBB);
while (R && R->getParent())
if (R->getParent()->getEntry() == destBB)
while (R && R->getParent())
if (R->getParent()->getEntry() == destBB)
@@
-98,44
+99,45
@@
struct DOTGraphTraits<RegionInfo*> : public DOTGraphTraits<RegionNode*> {
// Print the cluster of the subregions. This groups the single basic blocks
// and adds a different background color for each group.
// Print the cluster of the subregions. This groups the single basic blocks
// and adds a different background color for each group.
- static void printRegionCluster(const Region *R, GraphWriter<RegionInfo*> &GW,
+ static void printRegionCluster(const Region &R,
+ GraphWriter<RegionInfoPass*> &GW,
unsigned depth = 0) {
raw_ostream &O = GW.getOStream();
unsigned depth = 0) {
raw_ostream &O = GW.getOStream();
- O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void*>(R)
+ O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void*>(
&
R)
<< " {\n";
O.indent(2 * (depth + 1)) << "label = \"\";\n";
<< " {\n";
O.indent(2 * (depth + 1)) << "label = \"\";\n";
- if (!onlySimpleRegions || R
->
isSimple()) {
+ if (!onlySimpleRegions || R
.
isSimple()) {
O.indent(2 * (depth + 1)) << "style = filled;\n";
O.indent(2 * (depth + 1)) << "color = "
O.indent(2 * (depth + 1)) << "style = filled;\n";
O.indent(2 * (depth + 1)) << "color = "
- << ((R
->
getDepth() * 2 % 12) + 1) << "\n";
+ << ((R
.
getDepth() * 2 % 12) + 1) << "\n";
} else {
O.indent(2 * (depth + 1)) << "style = solid;\n";
O.indent(2 * (depth + 1)) << "color = "
} else {
O.indent(2 * (depth + 1)) << "style = solid;\n";
O.indent(2 * (depth + 1)) << "color = "
- << ((R
->
getDepth() * 2 % 12) + 2) << "\n";
+ << ((R
.
getDepth() * 2 % 12) + 2) << "\n";
}
}
- for (Region::const_iterator RI = R
->begin(), RE = R->
end(); RI != RE; ++RI)
- printRegionCluster(*RI, GW, depth + 1);
+ for (Region::const_iterator RI = R
.begin(), RE = R.
end(); RI != RE; ++RI)
+ printRegionCluster(*
*
RI, GW, depth + 1);
-
RegionInfo *RI = R->getRegionInfo(
);
+
const RegionInfo &RI = *static_cast<const RegionInfo*>(R.getRegionInfo()
);
- for (Region::const_block_iterator BI = R->block_begin(),
- BE = R->block_end(); BI != BE; ++BI)
- if (RI->getRegionFor(*BI) == R)
+ for (const auto &BB : R.blocks())
+ if (RI.getRegionFor(BB) == &R)
O.indent(2 * (depth + 1)) << "Node"
O.indent(2 * (depth + 1)) << "Node"
- << static_cast<const void*>(RI
->getTopLevelRegion()->getBBNode(*BI
))
+ << static_cast<const void*>(RI
.getTopLevelRegion()->getBBNode(BB
))
<< ";\n";
O.indent(2 * depth) << "}\n";
}
<< ";\n";
O.indent(2 * depth) << "}\n";
}
- static void addCustomGraphFeatures(const RegionInfo* RI,
- GraphWriter<RegionInfo*> &GW) {
+ static void addCustomGraphFeatures(const RegionInfoPass* RIP,
+ GraphWriter<RegionInfoPass*> &GW) {
+ const RegionInfo &RI = RIP->getRegionInfo();
raw_ostream &O = GW.getOStream();
O << "\tcolorscheme = \"paired12\"\n";
raw_ostream &O = GW.getOStream();
O << "\tcolorscheme = \"paired12\"\n";
- printRegionCluster(
RI->
getTopLevelRegion(), GW, 4);
+ printRegionCluster(
*RI.
getTopLevelRegion(), GW, 4);
}
};
} //end namespace llvm
}
};
} //end namespace llvm
@@
-143,28
+145,28
@@
struct DOTGraphTraits<RegionInfo*> : public DOTGraphTraits<RegionNode*> {
namespace {
struct RegionViewer
namespace {
struct RegionViewer
- : public DOTGraphTraitsViewer<RegionInfo, false> {
+ : public DOTGraphTraitsViewer<RegionInfo
Pass
, false> {
static char ID;
static char ID;
- RegionViewer() : DOTGraphTraitsViewer<RegionInfo, false>("reg", ID){
+ RegionViewer() : DOTGraphTraitsViewer<RegionInfo
Pass
, false>("reg", ID){
initializeRegionViewerPass(*PassRegistry::getPassRegistry());
}
};
char RegionViewer::ID = 0;
struct RegionOnlyViewer
initializeRegionViewerPass(*PassRegistry::getPassRegistry());
}
};
char RegionViewer::ID = 0;
struct RegionOnlyViewer
- : public DOTGraphTraitsViewer<RegionInfo, true> {
+ : public DOTGraphTraitsViewer<RegionInfo
Pass
, true> {
static char ID;
static char ID;
- RegionOnlyViewer() : DOTGraphTraitsViewer<RegionInfo, true>("regonly", ID) {
+ RegionOnlyViewer() : DOTGraphTraitsViewer<RegionInfo
Pass
, true>("regonly", ID) {
initializeRegionOnlyViewerPass(*PassRegistry::getPassRegistry());
}
};
char RegionOnlyViewer::ID = 0;
struct RegionPrinter
initializeRegionOnlyViewerPass(*PassRegistry::getPassRegistry());
}
};
char RegionOnlyViewer::ID = 0;
struct RegionPrinter
- : public DOTGraphTraitsPrinter<RegionInfo, false> {
+ : public DOTGraphTraitsPrinter<RegionInfo
Pass
, false> {
static char ID;
RegionPrinter() :
static char ID;
RegionPrinter() :
- DOTGraphTraitsPrinter<RegionInfo, false>("reg", ID) {
+ DOTGraphTraitsPrinter<RegionInfo
Pass
, false>("reg", ID) {
initializeRegionPrinterPass(*PassRegistry::getPassRegistry());
}
};
initializeRegionPrinterPass(*PassRegistry::getPassRegistry());
}
};
@@
-176,7
+178,7
@@
INITIALIZE_PASS(RegionPrinter, "dot-regions",
INITIALIZE_PASS(RegionViewer, "view-regions", "View regions of function",
true, true)
INITIALIZE_PASS(RegionViewer, "view-regions", "View regions of function",
true, true)
-
+
INITIALIZE_PASS(RegionOnlyViewer, "view-regions-only",
"View regions of function (with no function bodies)",
true, true)
INITIALIZE_PASS(RegionOnlyViewer, "view-regions-only",
"View regions of function (with no function bodies)",
true, true)
@@
-184,10
+186,10
@@
INITIALIZE_PASS(RegionOnlyViewer, "view-regions-only",
namespace {
struct RegionOnlyPrinter
namespace {
struct RegionOnlyPrinter
- : public DOTGraphTraitsPrinter<RegionInfo, true> {
+ : public DOTGraphTraitsPrinter<RegionInfo
Pass
, true> {
static char ID;
RegionOnlyPrinter() :
static char ID;
RegionOnlyPrinter() :
- DOTGraphTraitsPrinter<RegionInfo, true>("reg", ID) {
+ DOTGraphTraitsPrinter<RegionInfo
Pass
, true>("reg", ID) {
initializeRegionOnlyPrinterPass(*PassRegistry::getPassRegistry());
}
};
initializeRegionOnlyPrinterPass(*PassRegistry::getPassRegistry());
}
};