diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-12-29 23:47:38 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-12-29 23:47:38 +0000 |
commit | 1bb59b0dcfccdaada07e2d180d5929a2dd0b1493 (patch) | |
tree | 2c619d2ce5d50cc8752b7e424dc24e4bcdd13512 | |
parent | 9463dce9bf90d63480c894452cc82db1de182823 (diff) | |
download | bcm5719-llvm-1bb59b0dcfccdaada07e2d180d5929a2dd0b1493.tar.gz bcm5719-llvm-1bb59b0dcfccdaada07e2d180d5929a2dd0b1493.zip |
Fix obvious formatting problems.
We fix the following formatting problems found by clang-format:
- 80 cols violations
- Obvious problems with missing or too many spaces
- multiple new lines in a row
clang-format suggests many more changes, most of them falling in the following
two categories:
1) clang-format does not at all format a piece of code nicely
2) The style that clang-format suggests does not match the style used in
Polly/LLVM
I consider differences caused by reason 1) bugs, which should be fixed by
improving clang-format. Differences due to 2) need to be investigated closer
to understand the cause of the difference and the solution that should be taken.
llvm-svn: 171241
-rw-r--r-- | polly/lib/Analysis/Dependences.cpp | 7 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 23 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopGraphPrinter.cpp | 2 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 21 | ||||
-rw-r--r-- | polly/lib/Analysis/TempScopInfo.cpp | 2 | ||||
-rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 18 | ||||
-rw-r--r-- | polly/lib/CodeGen/Cloog.cpp | 6 | ||||
-rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 20 | ||||
-rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 23 | ||||
-rw-r--r-- | polly/lib/CodeGen/LoopGenerators.cpp | 3 |
10 files changed, 53 insertions, 72 deletions
diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp index 16be7abe098..366822ad1af 100644 --- a/polly/lib/Analysis/Dependences.cpp +++ b/polly/lib/Analysis/Dependences.cpp @@ -53,9 +53,8 @@ Dependences::Dependences() : ScopPass(ID) { RAW = WAR = WAW = NULL; } -void Dependences::collectInfo(Scop &S, - isl_union_map **Read, isl_union_map **Write, - isl_union_map **MayWrite, +void Dependences::collectInfo(Scop &S, isl_union_map **Read, + isl_union_map **Write, isl_union_map **MayWrite, isl_union_map **Schedule) { isl_space *Space = S.getParamSpace(); *Read = isl_union_map_empty(isl_space_copy(Space)); @@ -268,7 +267,7 @@ void Dependences::releaseMemory() { isl_union_map_free(WAR); isl_union_map_free(WAW); - RAW = WAR = WAW = NULL; + RAW = WAR = WAW = NULL; } isl_union_map *Dependences::getDependences(int Kinds) { diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index f4c3a9cffa1..b322152402a 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -153,8 +153,8 @@ std::string ScopDetection::regionIsInvalidBecause(const Region *R) const { return InvalidRegions.find(R)->second; } -bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const -{ +bool ScopDetection::isValidCFG(BasicBlock &BB, + DetectionContext &Context) const { Region &RefRegion = Context.CurRegion; TerminatorInst *TI = BB.getTerminator(); @@ -173,8 +173,7 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const // UndefValue is not allowed as condition. if (isa<UndefValue>(Condition)) - INVALID(AffFunc, "Condition based on 'undef' value in BB: " - + BB.getName()); + INVALID(AffFunc, "Condition based on 'undef' value in BB: " + BB.getName()); // Only Constant and ICmpInst are allowed as condition. if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition))) @@ -190,7 +189,7 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const // // TODO: This is not sufficient and just hides bugs. However it does pretty // well. - if(ICmp->isUnsigned()) + if (ICmp->isUnsigned()) return false; // Are both operands of the ICmp affine? @@ -256,7 +255,8 @@ bool ScopDetection::isValidMemoryAccess(Instruction &Inst, AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer); - if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue) && !AllowNonAffine) + if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue) && + !AllowNonAffine) INVALID(AffFunc, "Non affine access function: " << *AccessFunction); // FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions @@ -285,7 +285,6 @@ bool ScopDetection::isValidMemoryAccess(Instruction &Inst, return true; } - bool ScopDetection::hasScalarDependency(Instruction &Inst, Region &RefRegion) const { for (Instruction::use_iterator UI = Inst.use_begin(), UE = Inst.use_end(); @@ -380,7 +379,7 @@ bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const { Region *ScopDetection::expandRegion(Region &R) { // Initial no valid region was found (greater than R) Region *LastValidRegion = NULL; - Region *ExpandedRegion = R.getExpandedRegion(); + Region *ExpandedRegion = R.getExpandedRegion(); DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n"); @@ -427,7 +426,6 @@ Region *ScopDetection::expandRegion(Region &R) { return LastValidRegion; } - void ScopDetection::findScops(Region &R) { DetectionContext Context(R, *AA, false /*verifying*/); @@ -496,7 +494,7 @@ bool ScopDetection::isValidExit(DetectionContext &Context) const { // PHI nodes are not allowed in the exit basic block. if (BasicBlock *Exit = R.getExit()) { BasicBlock::iterator I = Exit->begin(); - if (I != Exit->end() && isa<PHINode> (*I)) + if (I != Exit->end() && isa<PHINode>(*I)) INVALID(Other, "PHI node in exit BB"); } @@ -561,7 +559,7 @@ void ScopDetection::getDebugLocation(const Region *R, unsigned &LineBegin, LineBegin = std::min(LineBegin, NewLine); LineEnd = std::max(LineEnd, NewLine); break; - } + } } void ScopDetection::printLocations() { @@ -594,7 +592,7 @@ bool ScopDetection::runOnFunction(llvm::Function &F) { if (OnlyFunction != "" && F.getName() != OnlyFunction) return false; - if(!isValidFunction(F)) + if (!isValidFunction(F)) return false; findScops(*TopRegion); @@ -605,7 +603,6 @@ bool ScopDetection::runOnFunction(llvm::Function &F) { return false; } - void polly::ScopDetection::verifyRegion(const Region &R) const { assert(isMaxRegionInScop(R) && "Expect R is a valid region."); DetectionContext Context(const_cast<Region&>(R), *AA, true /*verifying*/); diff --git a/polly/lib/Analysis/ScopGraphPrinter.cpp b/polly/lib/Analysis/ScopGraphPrinter.cpp index 02308dfa43a..6c2a7372376 100644 --- a/polly/lib/Analysis/ScopGraphPrinter.cpp +++ b/polly/lib/Analysis/ScopGraphPrinter.cpp @@ -166,7 +166,7 @@ struct DOTGraphTraits<ScopDetection*> : public DOTGraphTraits<RegionNode*> { } }; -} //end namespace llvm +} //end namespace llvm struct ScopViewer : public DOTGraphTraitsViewer<ScopDetection, false> { diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index f0827b3acd7..b8772dbe52e 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -230,17 +230,16 @@ MemoryAccess::~MemoryAccess() { isl_map_free(newAccessRelation); } -static void replace(std::string& str, const std::string& find, - const std::string& replace) { +static void replace(std::string &str, const std::string &find, + const std::string &replace) { size_t pos = 0; - while((pos = str.find(find, pos)) != std::string::npos) - { + while ((pos = str.find(find, pos)) != std::string::npos) { str.replace(pos, find.length(), replace); pos += replace.length(); } } -static void makeIslCompatible(std::string& str) { +static void makeIslCompatible(std::string &str) { str.erase(0, 1); replace(str, ".", "_"); replace(str, "\"", "_"); @@ -691,7 +690,7 @@ void ScopStmt::print(raw_ostream &OS) const { OS.indent(16) << "n/a\n"; for (MemoryAccessVec::const_iterator I = MemAccs.begin(), E = MemAccs.end(); - I != E; ++I) + I != E; ++I) (*I)->print(OS); } @@ -742,7 +741,7 @@ __isl_give isl_id *Scop::getIdForParam(const SCEV *Parameter) const { void Scop::buildContext() { isl_space *Space = isl_space_params_alloc(IslCtx, 0); - Context = isl_set_universe (Space); + Context = isl_set_universe(Space); } void Scop::addParameterBounds() { @@ -776,7 +775,6 @@ void Scop::addParameterBounds() { } } - void Scop::realignParams() { // Add all parameters into a common model. isl_space *Space = isl_space_params_alloc(IslCtx, ParameterIds.size()); @@ -826,7 +824,7 @@ Scop::~Scop() { } std::string Scop::getContextStr() const { - return stringFromIslObj(Context); + return stringFromIslObj(Context); } std::string Scop::getNameStr() const { @@ -875,13 +873,12 @@ void Scop::printContext(raw_ostream &OS) const { void Scop::printStatements(raw_ostream &OS) const { OS << "Statements {\n"; - for (const_iterator SI = begin(), SE = end();SI != SE; ++SI) + for (const_iterator SI = begin(), SE = end(); SI != SE; ++SI) OS.indent(4) << (**SI); OS.indent(4) << "}\n"; } - void Scop::print(raw_ostream &OS) const { printContext(OS.indent(4)); printStatements(OS.indent(4)); @@ -964,8 +961,6 @@ ScopInfo::~ScopInfo() { isl_ctx_free(ctx); } - - void ScopInfo::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<LoopInfo>(); AU.addRequired<RegionInfo>(); diff --git a/polly/lib/Analysis/TempScopInfo.cpp b/polly/lib/Analysis/TempScopInfo.cpp index 1d64db7bdad..ac07b738a25 100644 --- a/polly/lib/Analysis/TempScopInfo.cpp +++ b/polly/lib/Analysis/TempScopInfo.cpp @@ -146,7 +146,7 @@ void TempScopInfo::buildLoopBounds(TempScop &Scop) { } void TempScopInfo::buildAffineCondition(Value &V, bool inverted, - Comparison **Comp) const { + Comparison **Comp) const { if (ConstantInt *C = dyn_cast<ConstantInt>(&V)) { // If this is always true condition, we will create 1 >= 0, // otherwise we will create 1 == 0. diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index 1e5341a36e9..75122cadab9 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -84,7 +84,7 @@ SCEVCodegen("polly-codegen-scev", struct SCEVRewriter : public SCEVVisitor<SCEVRewriter, const SCEV*> { public: static const SCEV *rewrite(const SCEV *scev, Scop &S, ScalarEvolution &SE, - ValueMapT &GlobalMap, ValueMapT &BBMap) { + ValueMapT &GlobalMap, ValueMapT &BBMap) { SCEVRewriter Rewriter(S, SE, GlobalMap, BBMap); return Rewriter.visit(scev); } @@ -257,12 +257,11 @@ private: IRBuilder<> &Builder; std::vector<Value *> &IVS; - static int mergeIslAffValues(__isl_take isl_set *Set, - __isl_take isl_aff *Aff, void *User); + static int mergeIslAffValues(__isl_take isl_set *Set, __isl_take isl_aff *Aff, + void *User); }; } - Value *IslGenerator::generateIslInt(isl_int Int) { mpz_t IntMPZ; mpz_init(IntMPZ); @@ -523,8 +522,8 @@ Value *BlockGenerator::generateScalarStore(const StoreInst *Store, return Builder.CreateStore(ValueOperand, NewPointer); } -void BlockGenerator::copyInstruction(const Instruction *Inst, - ValueMapT &BBMap, ValueMapT &GlobalMap) { +void BlockGenerator::copyInstruction(const Instruction *Inst, ValueMapT &BBMap, + ValueMapT &GlobalMap) { // Terminator instructions control the control flow. They are explicitly // expressed in the clast and do not need to be copied. if (Inst->isTerminator()) @@ -546,7 +545,6 @@ void BlockGenerator::copyInstruction(const Instruction *Inst, copyInstScalar(Inst, BBMap, GlobalMap); } - void BlockGenerator::copyBB(ValueMapT &GlobalMap) { BasicBlock *BB = Statement.getBasicBlock(); BasicBlock *CopyBB = SplitBlock(Builder.GetInsertBlock(), @@ -711,8 +709,7 @@ void VectorBlockGenerator::copyBinaryInst(const BinaryOperator *Inst, NewOpZero = getVectorValue(OpZero, VectorMap, ScalarMaps); NewOpOne = getVectorValue(OpOne, VectorMap, ScalarMaps); - Value *NewInst = Builder.CreateBinOp(Inst->getOpcode(), NewOpZero, - NewOpOne, + Value *NewInst = Builder.CreateBinOp(Inst->getOpcode(), NewOpZero, NewOpOne, Inst->getName() + "p_vec"); VectorMap[Inst] = NewInst; } @@ -740,8 +737,7 @@ void VectorBlockGenerator::copyStore(const StoreInst *Store, Store->setAlignment(8); } else { for (unsigned i = 0; i < ScalarMaps.size(); i++) { - Value *Scalar = Builder.CreateExtractElement(Vector, - Builder.getInt32(i)); + Value *Scalar = Builder.CreateExtractElement(Vector, Builder.getInt32(i)); Value *NewPointer = getNewValue(Pointer, ScalarMaps[i], GlobalMaps[i]); Builder.CreateStore(Scalar, NewPointer); } diff --git a/polly/lib/CodeGen/Cloog.cpp b/polly/lib/CodeGen/Cloog.cpp index f08aa1c07ae..ed8162563eb 100644 --- a/polly/lib/CodeGen/Cloog.cpp +++ b/polly/lib/CodeGen/Cloog.cpp @@ -87,7 +87,6 @@ class FileToString { char buf[BUFFERSIZE + 1]; - public: FileToString() { pipe(FD); @@ -120,7 +119,6 @@ public: output += std::string(buf, readSize); } - return output; } @@ -173,7 +171,7 @@ CloogUnionDomain *Cloog::buildCloogUnionDomain() { CloogDomain *Domain; Scattering = cloog_scattering_from_isl_map(Stmt->getScattering()); - Domain = cloog_domain_from_isl_set(Stmt->getDomain()); + Domain = cloog_domain_from_isl_set(Stmt->getDomain()); std::string entryName = Stmt->getBaseName(); @@ -354,7 +352,7 @@ bool CloogInfo::runOnScop(Scop &S) { Function *F = S.getRegion().getEntry()->getParent(); DEBUG(dbgs() << ":: " << F->getName()); - DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n");; + DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n"); DEBUG(C->pprint(dbgs())); return false; diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 84788146f58..06378db25fb 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -176,7 +176,7 @@ Value *ClastExpCodeGen::codegen(const clast_reduction *r, Type *Ty) { && "Clast reduction type not supported"); Value *old = codegen(r->elts[0], Ty); - for (int i=1; i < r->n; ++i) { + for (int i = 1; i < r->n; ++i) { Value *exprValue = codegen(r->elts[i], Ty); switch (r->type) { @@ -341,7 +341,7 @@ private: IntegerType *getIntPtrTy(); - public: +public: void codegen(const clast_root *r); ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P); @@ -357,7 +357,7 @@ const std::vector<std::string> &ClastStmtCodeGen::getParallelLoops() { } void ClastStmtCodeGen::codegen(const clast_assignment *a) { - Value *V= ExpGen.codegen(a->RHS, getIntPtrTy()); + Value *V = ExpGen.codegen(a->RHS, getIntPtrTy()); ClastVars[a->LHS] = V; } @@ -425,7 +425,7 @@ void ClastStmtCodeGen::codegen(const clast_user_stmt *u, VectorValueMapT VectorMap(VectorDimensions); if (IVS) { - assert (u->substitutions && "Substitutions expected!"); + assert(u->substitutions && "Substitutions expected!"); int i = 0; for (std::vector<Value*>::iterator II = IVS->begin(), IE = IVS->end(); II != IE; ++II) { @@ -703,7 +703,7 @@ void ClastStmtCodeGen::codegenForGPGPU(const clast_for *F) { U = (const clast_user_stmt *) TmpStmt; ScopStmt *Statement = (ScopStmt *) U->statement->usr; for (unsigned i = 0; i < Statement->getNumIterators() - NonPLoopDepth; i++) { - const Value* IV = Statement->getInductionVariableForDimension(i); + const Value *IV = Statement->getInductionVariableForDimension(i); IVS.insert(const_cast<Value *>(IV)); } @@ -784,7 +784,7 @@ void ClastStmtCodeGen::codegenForVector(const clast_for *F) { APInt Stride = APInt_from_MPZ(F->stride); IntegerType *LoopIVType = dyn_cast<IntegerType>(LB->getType()); - Stride = Stride.zext(LoopIVType->getBitWidth()); + Stride = Stride.zext(LoopIVType->getBitWidth()); Value *StrideValue = ConstantInt::get(LoopIVType, Stride); std::vector<Value*> IVS(VectorWidth); @@ -811,7 +811,6 @@ void ClastStmtCodeGen::codegenForVector(const clast_for *F) { ClastVars.erase(F->iterator); } - bool ClastStmtCodeGen::isParallelFor(const clast_for *f) { isl_set *Domain = isl_set_from_cloog_domain(f->domain); assert(Domain && "Cannot access domain of loop"); @@ -952,14 +951,15 @@ void ClastStmtCodeGen::codegen(const clast_root *r) { codegen(stmt->next); } -ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P) : - S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) {} +ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P) + : S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) { +} namespace { class CodeGeneration : public ScopPass { std::vector<std::string> ParallelLoops; - public: +public: static char ID; CodeGeneration() : ScopPass(ID) {} diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index 2f22d18367e..48934b61795 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -261,7 +261,7 @@ Value *IslExprBuilder::createOpBin(__isl_take isl_ast_expr *Expr) { // result type cannot be larger than the type of the individual operand. isl // does not calculate correct types for these operations and we consequently // exclude those operations here. - switch(OpType) { + switch (OpType) { case isl_ast_op_pdiv_q: case isl_ast_op_pdiv_r: case isl_ast_op_div: @@ -690,11 +690,10 @@ void IslNodeBuilder::createUserVector(__isl_take isl_ast_node *User, isl_map *S = isl_map_from_union_map(Schedule); createSubstitutionsVector(isl_pw_multi_aff_copy(Info->PMA), - isl_ast_build_copy(Info->Context), - Stmt, VectorMap, IVS, IteratorID); + isl_ast_build_copy(Info->Context), Stmt, VectorMap, + IVS, IteratorID); VectorBlockGenerator::generate(Builder, *Stmt, VectorMap, S, P); - isl_map_free(S); isl_id_free(Annotation); isl_id_free(Id); @@ -754,8 +753,7 @@ void IslNodeBuilder::createForVector(__isl_take isl_ast_node *For, for (int i = 0; i < isl_ast_node_list_n_ast_node(List); ++i) createUserVector(isl_ast_node_list_get_ast_node(List, i), IVS, - isl_id_copy(IteratorID), - isl_union_map_copy(Schedule)); + isl_id_copy(IteratorID), isl_union_map_copy(Schedule)); isl_ast_node_free(Body); isl_ast_node_list_free(List); @@ -892,10 +890,9 @@ void IslNodeBuilder::createIf(__isl_take isl_ast_node *If) { } void IslNodeBuilder::createSubstitutions(__isl_take isl_pw_multi_aff *PMA, - __isl_take isl_ast_build *Context, - ScopStmt *Stmt, ValueMapT &VMap) { - for (unsigned i = 0; i < isl_pw_multi_aff_dim(PMA, isl_dim_out); - ++i) { + __isl_take isl_ast_build *Context, + ScopStmt *Stmt, ValueMapT &VMap) { + for (unsigned i = 0; i < isl_pw_multi_aff_dim(PMA, isl_dim_out); ++i) { isl_pw_aff *Aff; isl_ast_expr *Expr; const Value *OldIV; @@ -926,8 +923,8 @@ void IslNodeBuilder::createSubstitutionsVector(__isl_take isl_pw_multi_aff *PMA, for (std::vector<Value*>::iterator II = IVS.begin(), IE = IVS.end(); II != IE; ++II) { IDToValue[IteratorID] = *II; - createSubstitutions(isl_pw_multi_aff_copy(PMA), - isl_ast_build_copy(Context), Stmt, VMap[i]); + createSubstitutions(isl_pw_multi_aff_copy(PMA), isl_ast_build_copy(Context), + Stmt, VMap[i]); i++; } @@ -1017,7 +1014,7 @@ void IslNodeBuilder::addParameters(__isl_take isl_set *Context) { namespace { class IslCodeGeneration : public ScopPass { - public: +public: static char ID; IslCodeGeneration() : ScopPass(ID) {} diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp index 4edd01d81ac..dbcaf563b60 100644 --- a/polly/lib/CodeGen/LoopGenerators.cpp +++ b/polly/lib/CodeGen/LoopGenerators.cpp @@ -24,8 +24,7 @@ using namespace llvm; using namespace polly; Value *polly::createLoop(Value *LB, Value *UB, Value *Stride, - IRBuilder<> &Builder, Pass *P, - BasicBlock *&AfterBlock, + IRBuilder<> &Builder, Pass *P, BasicBlock *&AfterBlock, ICmpInst::Predicate Predicate) { DominatorTree &DT = P->getAnalysis<DominatorTree>(); Function *F = Builder.GetInsertBlock()->getParent(); |