diff options
| author | Tobias Grosser <grosser@fim.uni-passau.de> | 2013-01-14 22:40:23 +0000 |
|---|---|---|
| committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2013-01-14 22:40:23 +0000 |
| commit | 74394f0dcf79f79409cd96dacc979f5a3e068a2d (patch) | |
| tree | cab897e50bfc3c5f0b69bf4e668c44c7a3a533c5 | |
| parent | 945f8d32fd40f4d42b62e4b9216a9cc2fe51b28d (diff) | |
| download | bcm5719-llvm-74394f0dcf79f79409cd96dacc979f5a3e068a2d.tar.gz bcm5719-llvm-74394f0dcf79f79409cd96dacc979f5a3e068a2d.zip | |
clang-format goodness
llvm-svn: 172486
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 84 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 72 |
2 files changed, 68 insertions, 88 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 309ca2d04fa..d7f75b04484 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -95,49 +95,48 @@ AllowNonAffine("polly-allow-nonaffine", STATISTIC(ValidRegion, "Number of regions that a valid part of Scop"); -#define BADSCOP_STAT(NAME, DESC) STATISTIC(Bad##NAME##ForScop, \ - "Number of bad regions for Scop: "\ - DESC) - -#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"); \ - assert(!Context.Verifying && #NAME); \ - if (!Context.Verifying) ++Bad##NAME##ForScop; \ - return false; \ +#define BADSCOP_STAT(NAME, DESC) \ + STATISTIC(Bad##NAME##ForScop, "Number of bad regions for Scop: " DESC) + +#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"); \ + assert(!Context.Verifying && #NAME); \ + if (!Context.Verifying) \ + ++Bad##NAME##ForScop; \ + return false; \ } while (0); - -#define INVALID_NOVERIFY(NAME, MESSAGE) \ - do { \ - std::string Buf; \ - raw_string_ostream fmt(Buf); \ - fmt << MESSAGE; \ - fmt.flush(); \ - LastFailure = Buf; \ - DEBUG(dbgs() << MESSAGE); \ - DEBUG(dbgs() << "\n"); \ - /* DISABLED: assert(!Context.Verifying && #NAME); */ \ - if (!Context.Verifying) ++Bad##NAME##ForScop; \ - return false; \ +#define INVALID_NOVERIFY(NAME, MESSAGE) \ + do { \ + std::string Buf; \ + raw_string_ostream fmt(Buf); \ + fmt << MESSAGE; \ + fmt.flush(); \ + LastFailure = Buf; \ + DEBUG(dbgs() << MESSAGE); \ + DEBUG(dbgs() << "\n"); \ + /* DISABLED: assert(!Context.Verifying && #NAME); */ \ + if (!Context.Verifying) \ + ++Bad##NAME##ForScop; \ + return false; \ } while (0); - -BADSCOP_STAT(CFG, "CFG too complex"); -BADSCOP_STAT(IndVar, "Non canonical induction variable in loop"); -BADSCOP_STAT(LoopBound, "Loop bounds can not be computed"); -BADSCOP_STAT(FuncCall, "Function call with side effects appeared"); -BADSCOP_STAT(AffFunc, "Expression not affine"); -BADSCOP_STAT(Scalar, "Found scalar dependency"); -BADSCOP_STAT(Alias, "Found base address alias"); -BADSCOP_STAT(SimpleRegion, "Region not simple"); -BADSCOP_STAT(Other, "Others"); +BADSCOP_STAT(CFG, "CFG too complex"); +BADSCOP_STAT(IndVar, "Non canonical induction variable in loop"); +BADSCOP_STAT(LoopBound, "Loop bounds can not be computed"); +BADSCOP_STAT(FuncCall, "Function call with side effects appeared"); +BADSCOP_STAT(AffFunc, "Expression not affine"); +BADSCOP_STAT(Scalar, "Found scalar dependency"); +BADSCOP_STAT(Alias, "Found base address alias"); +BADSCOP_STAT(SimpleRegion, "Region not simple"); +BADSCOP_STAT(Other, "Others"); //===----------------------------------------------------------------------===// // ScopDetection. @@ -167,7 +166,8 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, if (!Br) INVALID(CFG, "Non branch instruction terminates BB: " + BB.getName()); - if (Br->isUnconditional()) return true; + if (Br->isUnconditional()) + return true; Value *Condition = Br->getCondition(); @@ -193,8 +193,8 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, return false; // Are both operands of the ICmp affine? - if (isa<UndefValue>(ICmp->getOperand(0)) - || isa<UndefValue>(ICmp->getOperand(1))) + if (isa<UndefValue>(ICmp->getOperand(0)) || + isa<UndefValue>(ICmp->getOperand(1))) INVALID(AffFunc, "undef operand in branch at BB: " + BB.getName()); const SCEV *LHS = SE->getSCEV(ICmp->getOperand(0)); diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 8626ae27a6f..da5afacba71 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -52,8 +52,8 @@ using namespace llvm; using namespace polly; -STATISTIC(ScopFound, "Number of valid Scops"); -STATISTIC(RichScopFound, "Number of Scops containing a loop"); +STATISTIC(ScopFound, "Number of valid Scops"); +STATISTIC(RichScopFound, "Number of Scops containing a loop"); /// Translate a SCEVExpression into an isl_pw_aff object. struct SCEVAffinator : public SCEVVisitor<SCEVAffinator, isl_pw_aff*> { @@ -337,9 +337,7 @@ void MemoryAccess::print(raw_ostream &OS) const { OS.indent(16) << getAccessRelationStr() << ";\n"; } -void MemoryAccess::dump() const { - print(errs()); -} +void MemoryAccess::dump() const { print(errs()); } // Create a map in the size of the provided set domain, that maps from the // one element of the provided set domain to another element of the provided @@ -437,9 +435,7 @@ void MemoryAccess::setNewAccessRelation(isl_map *newAccess) { //===----------------------------------------------------------------------===// -isl_map *ScopStmt::getScattering() const { - return isl_map_copy(Scattering); -} +isl_map *ScopStmt::getScattering() const { return isl_map_copy(Scattering); } void ScopStmt::setScattering(isl_map *NewScattering) { isl_map_free(Scattering); @@ -458,8 +454,8 @@ void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) { // Loop dimensions. for (unsigned i = 0; i < NbIterators; ++i) - Scattering = isl_map_equate(Scattering, isl_dim_out, 2 * i + 1, - isl_dim_in, i); + Scattering = isl_map_equate(Scattering, isl_dim_out, 2 * i + 1, isl_dim_in, + i); // Constant dimensions for (unsigned i = 0; i < NbIterators + 1; ++i) @@ -587,11 +583,10 @@ __isl_give isl_set *ScopStmt::buildDomain(TempScop &tempScop, return Domain; } -ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, - const Region &CurRegion, BasicBlock &bb, - SmallVectorImpl<Loop*> &NestLoops, +ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion, + BasicBlock &bb, SmallVectorImpl<Loop *> &NestLoops, SmallVectorImpl<unsigned> &Scatter) - : Parent(parent), BB(&bb), IVS(NestLoops.size()) { + : Parent(parent), BB(&bb), IVS(NestLoops.size()) { // Setup the induction variables. for (unsigned i = 0, e = NestLoops.size(); i < e; ++i) { PHINode *PN = NestLoops[i]->getCanonicalInductionVariable(); @@ -611,17 +606,13 @@ ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, buildAccesses(tempScop, CurRegion); } -std::string ScopStmt::getDomainStr() const { - return stringFromIslObj(Domain); -} +std::string ScopStmt::getDomainStr() const { return stringFromIslObj(Domain); } std::string ScopStmt::getScatteringStr() const { return stringFromIslObj(Scattering); } -unsigned ScopStmt::getNumParams() const { - return Parent.getNumParams(); -} +unsigned ScopStmt::getNumParams() const { return Parent.getNumParams(); } unsigned ScopStmt::getNumIterators() const { // The final read has one dimension with one element. @@ -637,8 +628,8 @@ unsigned ScopStmt::getNumScattering() const { const char *ScopStmt::getBaseName() const { return BaseName.c_str(); } -const PHINode *ScopStmt::getInductionVariableForDimension(unsigned Dimension) - const { +const PHINode *ScopStmt::getInductionVariableForDimension( + unsigned Dimension) const { return IVS[Dimension].first; } @@ -646,21 +637,15 @@ const Loop *ScopStmt::getLoopForDimension(unsigned Dimension) const { return IVS[Dimension].second; } -isl_ctx *ScopStmt::getIslCtx() const { - return Parent.getIslCtx(); -} +isl_ctx *ScopStmt::getIslCtx() const { return Parent.getIslCtx(); } -isl_set *ScopStmt::getDomain() const { - return isl_set_copy(Domain); -} +isl_set *ScopStmt::getDomain() const { return isl_set_copy(Domain); } isl_space *ScopStmt::getDomainSpace() const { return isl_set_get_space(Domain); } -isl_id *ScopStmt::getDomainId() const { - return isl_set_get_tuple_id(Domain); -} +isl_id *ScopStmt::getDomainId() const { return isl_set_get_tuple_id(Domain); } ScopStmt::~ScopStmt() { while (!MemAccs.empty()) { @@ -762,12 +747,12 @@ void Scop::addParameterBounds() { isl_int_init(V); isl_int_set_si(V, 1); - isl_int_mul_2exp(V, V, Width-1); + isl_int_mul_2exp(V, V, Width - 1); isl_int_neg(V, V); isl_set_lower_bound(Context, isl_dim_param, i, V); isl_int_set_si(V, 1); - isl_int_mul_2exp(V, V, Width-1); + isl_int_mul_2exp(V, V, Width - 1); isl_int_sub_ui(V, V, 1); isl_set_upper_bound(Context, isl_dim_param, i, V); @@ -823,9 +808,7 @@ Scop::~Scop() { delete *I; } -std::string Scop::getContextStr() const { - return stringFromIslObj(Context); -} +std::string Scop::getContextStr() const { return stringFromIslObj(Context); } std::string Scop::getNameStr() const { std::string ExitName, EntryName; @@ -844,9 +827,7 @@ std::string Scop::getNameStr() const { return EntryName + "---" + ExitName; } -__isl_give isl_set *Scop::getContext() const { - return isl_set_copy(Context); -} +__isl_give isl_set *Scop::getContext() const { return isl_set_copy(Context); } __isl_give isl_space *Scop::getParamSpace() const { return isl_set_get_space(this->Context); } @@ -910,11 +891,9 @@ bool Scop::isTrivialBB(BasicBlock *BB, TempScop &tempScop) { return true; } -void Scop::buildScop(TempScop &tempScop, - const Region &CurRegion, - SmallVectorImpl<Loop*> &NestLoops, - SmallVectorImpl<unsigned> &Scatter, - LoopInfo &LI) { +void Scop::buildScop(TempScop &tempScop, const Region &CurRegion, + SmallVectorImpl<Loop *> &NestLoops, + SmallVectorImpl<unsigned> &Scatter, LoopInfo &LI) { Loop *L = castToLoop(CurRegion, LI); if (L) @@ -947,7 +926,7 @@ void Scop::buildScop(TempScop &tempScop, // Exiting a loop region. Scatter[loopDepth] = 0; NestLoops.pop_back(); - ++Scatter[loopDepth-1]; + ++Scatter[loopDepth - 1]; } //===----------------------------------------------------------------------===// @@ -983,7 +962,8 @@ bool ScopInfo::runOnRegion(Region *R, RGPassManager &RGM) { // Statistics. ++ScopFound; - if (tempScop->getMaxLoopDepth() > 0) ++RichScopFound; + if (tempScop->getMaxLoopDepth() > 0) + ++RichScopFound; scop = new Scop(*tempScop, LI, SE, ctx); |

