summaryrefslogtreecommitdiffstats
path: root/polly
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-10-08 00:30:55 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-10-08 00:30:55 +0000
commit4f129a6b4323eeadb2136920460b02c54a9d7788 (patch)
treec34bcc896c958e5dbaee05276fb70eda09e4fadb /polly
parentc4a0bd13ada188cb7343064e7bff4f278392848b (diff)
downloadbcm5719-llvm-4f129a6b4323eeadb2136920460b02c54a9d7788.tar.gz
bcm5719-llvm-4f129a6b4323eeadb2136920460b02c54a9d7788.zip
Show the reason a region is not a SCoP in the DOT graphs.
llvm-svn: 141458
Diffstat (limited to 'polly')
-rwxr-xr-xpolly/include/polly/ScopDetection.h8
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp16
-rw-r--r--polly/lib/Analysis/ScopGraphPrinter.cpp3
3 files changed, 26 insertions, 1 deletions
diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h
index 20d58b5783c..d21daf02054 100755
--- a/polly/include/polly/ScopDetection.h
+++ b/polly/include/polly/ScopDetection.h
@@ -109,6 +109,7 @@ class ScopDetection : public FunctionPass {
// Remember the invalid functions producted by backends;
typedef std::set<const Function*> FunctionSet;
FunctionSet InvalidFunctions;
+ mutable std::string LastFailure;
// Try to expand the region R. If R can be expanded return the expanded
// region, NULL otherwise.
@@ -233,6 +234,13 @@ public:
/// @return Return true if R is the maximum Region in a Scop, false otherwise.
bool isMaxRegionInScop(const Region &R) const;
+ /// @brief Get a message why a region is invalid
+ ///
+ /// @param R The region for which we get the error message
+ ///
+ /// @return The error or "" if no error appeared.
+ std::string regionIsInvalidBecause(const Region *R) const;
+
/// @name Maximum Region In Scops Iterators
///
/// These iterators iterator over all maximum region in Scops of this
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 8fc6335c2a2..ff77b3bf7bc 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -77,6 +77,11 @@ STATISTIC(ValidRegion, "Number of regions that a valid part of Scop");
#define INVALID(NAME, MESSAGE) \
do { \
+ std::string Buf; \
+ raw_string_ostream fmt(Buf); \
+ fmt << MESSAGE; \
+ fmt.flush(); \
+ LastFailure = Buf; \
DEBUG(dbgs() << MESSAGE); \
DEBUG(dbgs() << "\n"); \
STATSCOP(NAME); \
@@ -102,6 +107,14 @@ bool ScopDetection::isMaxRegionInScop(const Region &R) const {
return ValidRegions.count(&R);
}
+std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
+ if (!InvalidRegions.count(R))
+ return "";
+
+ return InvalidRegions.find(R)->second;
+}
+
+
bool ScopDetection::isValidAffineFunction(const SCEV *S, Region &RefRegion,
Value **BasePtr) const {
assert(S && "S must not be null!");
@@ -438,6 +451,8 @@ void ScopDetection::findScops(Region &R) {
return;
}
+ InvalidRegions[&R] = LastFailure;
+
for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
findScops(**I);
@@ -583,6 +598,7 @@ void ScopDetection::print(raw_ostream &OS, const Module *) const {
void ScopDetection::releaseMemory() {
ValidRegions.clear();
+ InvalidRegions.clear();
// Do not clear the invalid function set.
}
diff --git a/polly/lib/Analysis/ScopGraphPrinter.cpp b/polly/lib/Analysis/ScopGraphPrinter.cpp
index d6de7b9f353..8137c0b039f 100644
--- a/polly/lib/Analysis/ScopGraphPrinter.cpp
+++ b/polly/lib/Analysis/ScopGraphPrinter.cpp
@@ -107,7 +107,8 @@ struct DOTGraphTraits<ScopDetection*> : public DOTGraphTraits<RegionNode*> {
raw_ostream &O, unsigned depth = 0) {
O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void*>(R)
<< " {\n";
- O.indent(2 * (depth + 1)) << "label = \"\";\n";
+ std::string ErrorMessage = SD->regionIsInvalidBecause(R);
+ O.indent(2 * (depth + 1)) << "label = \"" << ErrorMessage << "\";\n";
if (SD->isMaxRegionInScop(*R)) {
O.indent(2 * (depth + 1)) << "style = filled;\n";
OpenPOWER on IntegriCloud