[polly] r177796 - clang-format: Many more files
Tobias Grosser
grosser at fim.uni-passau.de
Fri Mar 22 18:05:08 PDT 2013
Author: grosser
Date: Fri Mar 22 20:05:07 2013
New Revision: 177796
URL: http://llvm.org/viewvc/llvm-project?rev=177796&view=rev
Log:
clang-format: Many more files
After this commit, polly is clang-format clean. This can be tested with
'ninja polly-check-format'. Updates to clang-format may change this, but the
differences will hopefully be both small and general improvements to the
formatting.
We currently have some not very nice formatting for a couple of items, DEBUG()
stmts for example. I believe the benefit of being clang-format clean outweights
the not perfect layout of this code.
Removed:
polly/trunk/test/polybench/utilities/instrument.h
Modified:
polly/trunk/include/polly/CodeGen/BlockGenerators.h
polly/trunk/include/polly/CodeGen/Cloog.h
polly/trunk/include/polly/CodeGen/CodeGeneration.h
polly/trunk/include/polly/CodeGen/IslAst.h
polly/trunk/include/polly/CodeGen/LoopGenerators.h
polly/trunk/include/polly/CodeGen/PTXGenerator.h
polly/trunk/include/polly/CodeGen/Utils.h
polly/trunk/include/polly/Dependences.h
polly/trunk/include/polly/LinkAllPasses.h
polly/trunk/include/polly/MayAliasSet.h
polly/trunk/include/polly/RegisterPasses.h
polly/trunk/include/polly/ScheduleOptimizer.h
polly/trunk/include/polly/ScopDetection.h
polly/trunk/include/polly/ScopInfo.h
polly/trunk/include/polly/ScopLib.h
polly/trunk/include/polly/Support/GICHelper.h
polly/trunk/include/polly/Support/SCEVValidator.h
polly/trunk/include/polly/TempScopInfo.h
polly/trunk/lib/Analysis/Dependences.cpp
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Analysis/TempScopInfo.cpp
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/Cloog.cpp
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/IslAst.cpp
polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
polly/trunk/lib/CodePreparation.cpp
polly/trunk/lib/DeadCodeElimination.cpp
polly/trunk/lib/Exchange/JSONExporter.cpp
polly/trunk/lib/Exchange/OpenScopExporter.cpp
polly/trunk/lib/Exchange/OpenScopImporter.cpp
polly/trunk/lib/Exchange/ScopLib.cpp
polly/trunk/lib/Exchange/ScopLibExporter.cpp
polly/trunk/lib/Exchange/ScopLibImporter.cpp
polly/trunk/lib/MayAliasSet.cpp
polly/trunk/lib/Pluto.cpp
polly/trunk/lib/Pocc.cpp
polly/trunk/lib/RegionSimplify.cpp
polly/trunk/lib/ScheduleOptimizer.cpp
polly/trunk/lib/Support/GICHelper.cpp
polly/trunk/lib/Support/SCEVValidator.cpp
polly/trunk/tools/GPURuntime/GPUJIT.c
polly/trunk/tools/GPURuntime/GPUJIT.h
Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Fri Mar 22 20:05:07 2013
@@ -25,9 +25,9 @@
#include <vector>
namespace llvm {
- class Pass;
- class Region;
- class ScalarEvolution;
+class Pass;
+class Region;
+class ScalarEvolution;
}
namespace polly {
@@ -36,7 +36,7 @@ extern bool SCEVCodegen;
using namespace llvm;
class ScopStmt;
-typedef DenseMap<const Value*, Value*> ValueMapT;
+typedef DenseMap<const Value *, Value *> ValueMapT;
typedef std::vector<ValueMapT> VectorValueMapT;
/// @brief Check whether an instruction can be synthesized by the code
@@ -119,25 +119,23 @@ protected:
///
/// @param L The loop that surrounded the instruction that referenced this
/// memory subscript in the original code.
- std::vector<Value*> getMemoryAccessIndex(__isl_keep isl_map *AccessRelation,
- Value *BaseAddress, ValueMapT &BBMap,
- ValueMapT &GlobalMap,
- LoopToScevMapT <S, Loop *L);
+ std::vector<Value *> getMemoryAccessIndex(
+ __isl_keep isl_map *AccessRelation, Value *BaseAddress, ValueMapT &BBMap,
+ ValueMapT &GlobalMap, LoopToScevMapT <S, Loop *L);
/// @brief Get the new operand address according to the changed access in
/// JSCOP file.
///
/// @param L The loop that surrounded the instruction that used this operand
/// in the original code.
- Value *getNewAccessOperand(__isl_keep isl_map *NewAccessRelation,
- Value *BaseAddress, ValueMapT &BBMap,
- ValueMapT &GlobalMap, LoopToScevMapT <S,
- Loop *L);
+ Value *getNewAccessOperand(
+ __isl_keep isl_map *NewAccessRelation, Value *BaseAddress,
+ ValueMapT &BBMap, ValueMapT &GlobalMap, LoopToScevMapT <S, Loop *L);
/// @brief Generate the operand address
- Value *generateLocationAccessed(const Instruction *Inst,
- const Value *Pointer, ValueMapT &BBMap,
- ValueMapT &GlobalMap, LoopToScevMapT <S);
+ Value *generateLocationAccessed(const Instruction *Inst, const Value *Pointer,
+ ValueMapT &BBMap, ValueMapT &GlobalMap,
+ LoopToScevMapT <S);
Value *generateScalarLoad(const LoadInst *load, ValueMapT &BBMap,
ValueMapT &GlobalMap, LoopToScevMapT <S);
@@ -194,11 +192,10 @@ public:
/// loop containing the statemenet.
/// @param P A reference to the pass this function is called from.
/// The pass is needed to update other analysis.
- static void generate(IRBuilder<> &B, ScopStmt &Stmt,
- VectorValueMapT &GlobalMaps,
- std::vector<LoopToScevMapT> &VLTS,
- __isl_keep isl_map *Schedule,
- Pass *P) {
+ static void generate(
+ IRBuilder<> &B, ScopStmt &Stmt, VectorValueMapT &GlobalMaps,
+ std::vector<LoopToScevMapT> &VLTS, __isl_keep isl_map *Schedule,
+ Pass *P) {
VectorBlockGenerator Generator(B, GlobalMaps, VLTS, Stmt, Schedule, P);
Generator.copyBB();
}
@@ -234,9 +231,8 @@ private:
isl_map *Schedule;
VectorBlockGenerator(IRBuilder<> &B, VectorValueMapT &GlobalMaps,
- std::vector<LoopToScevMapT> &VLTS,
- ScopStmt &Stmt, __isl_keep isl_map *Schedule,
- Pass *P);
+ std::vector<LoopToScevMapT> &VLTS, ScopStmt &Stmt,
+ __isl_keep isl_map *Schedule, Pass *P);
int getVectorWidth();
@@ -278,8 +274,8 @@ private:
/// %scalar 2 = load double* %p_2
/// %vec_2 = insertelement <2 x double> %vec_1, double %scalar_1, i32 1
///
- Value *generateUnknownStrideLoad(const LoadInst *Load,
- VectorValueMapT &ScalarMaps);
+ Value *
+ generateUnknownStrideLoad(const LoadInst *Load, VectorValueMapT &ScalarMaps);
void generateLoad(const LoadInst *Load, ValueMapT &VectorMap,
VectorValueMapT &ScalarMaps);
@@ -309,4 +305,3 @@ private:
}
#endif
-
Modified: polly/trunk/include/polly/CodeGen/Cloog.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/Cloog.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/Cloog.h (original)
+++ polly/trunk/include/polly/CodeGen/Cloog.h Fri Mar 22 20:05:07 2013
@@ -34,56 +34,54 @@
#include "cloog/cloog.h"
struct clast_name;
-namespace llvm {
- class raw_ostream;
-}
+namespace llvm { class raw_ostream; }
namespace polly {
- class Scop;
- class Cloog;
+class Scop;
+class Cloog;
- class CloogInfo : public ScopPass {
- Cloog *C;
- Scop *scop;
-
- public:
- static char ID;
- CloogInfo() : ScopPass(ID), C(0) {}
-
- /// Write a .cloog input file
- void dump(FILE *F);
-
- /// Print a source code representation of the program.
- void pprint(llvm::raw_ostream &OS);
-
- /// Create the CLooG AST from this program.
- const struct clast_root *getClast();
-
- bool runOnScop(Scop &S);
- void printScop(llvm::raw_ostream &OS) const;
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
- virtual void releaseMemory();
- };
-
- // Visitor class for clasts.
- // Only 'visitUser' has to be implemented by subclasses; the default
- // implementations of the other methods traverse the clast recursively.
- class ClastVisitor {
- public:
- virtual void visit(const clast_stmt *stmt);
-
- virtual void visitAssignment(const clast_assignment *stmt);
- virtual void visitBlock(const clast_block *stmt);
- virtual void visitFor(const clast_for *stmt);
- virtual void visitGuard(const clast_guard *stmt);
+class CloogInfo : public ScopPass {
+ Cloog *C;
+ Scop *scop;
+
+public:
+ static char ID;
+ CloogInfo() : ScopPass(ID), C(0) {}
+
+ /// Write a .cloog input file
+ void dump(FILE *F);
+
+ /// Print a source code representation of the program.
+ void pprint(llvm::raw_ostream &OS);
+
+ /// Create the CLooG AST from this program.
+ const struct clast_root *getClast();
+
+ bool runOnScop(Scop &S);
+ void printScop(llvm::raw_ostream &OS) const;
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+ virtual void releaseMemory();
+};
+
+// Visitor class for clasts.
+// Only 'visitUser' has to be implemented by subclasses; the default
+// implementations of the other methods traverse the clast recursively.
+class ClastVisitor {
+public:
+ virtual void visit(const clast_stmt *stmt);
+
+ virtual void visitAssignment(const clast_assignment *stmt);
+ virtual void visitBlock(const clast_block *stmt);
+ virtual void visitFor(const clast_for *stmt);
+ virtual void visitGuard(const clast_guard *stmt);
- virtual void visitUser(const clast_user_stmt *stmt) = 0;
- };
+ virtual void visitUser(const clast_user_stmt *stmt) = 0;
+};
}
namespace llvm {
- class PassRegistry;
- void initializeCloogInfoPass(llvm::PassRegistry&);
+class PassRegistry;
+void initializeCloogInfoPass(llvm::PassRegistry &);
}
#endif /* CLOOG_FOUND */
Modified: polly/trunk/include/polly/CodeGen/CodeGeneration.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/CodeGeneration.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/CodeGeneration.h (original)
+++ polly/trunk/include/polly/CodeGen/CodeGeneration.h Fri Mar 22 20:05:07 2013
@@ -71,4 +71,3 @@ static inline int getNumberOfIterations(
}
#endif // POLLY_CODEGENERATION_H
-
Modified: polly/trunk/include/polly/CodeGen/IslAst.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslAst.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslAst.h (original)
+++ polly/trunk/include/polly/CodeGen/IslAst.h Fri Mar 22 20:05:07 2013
@@ -28,79 +28,77 @@
#include "isl/ast.h"
struct clast_name;
-namespace llvm {
- class raw_ostream;
-}
+namespace llvm { class raw_ostream; }
struct isl_ast_node;
struct isl_ast_build;
struct isl_pw_multi_aff;
namespace polly {
- class Scop;
- class IslAst;
+class Scop;
+class IslAst;
- // Information about an ast node.
- struct IslAstUser {
- struct isl_ast_build *Context;
- struct isl_pw_multi_aff *PMA;
- // The node is the outermost parallel loop.
- int IsOutermostParallel;
-
- // The node is the innermost parallel loop.
- int IsInnermostParallel;
- };
-
- class IslAstInfo: public ScopPass {
- Scop *S;
- IslAst *Ast;
-
- public:
- static char ID;
- IslAstInfo() : ScopPass(ID), Ast(NULL) {}
-
- /// Print a source code representation of the program.
- void pprint(llvm::raw_ostream &OS);
-
- isl_ast_node *getAst();
-
- bool runOnScop(Scop &S);
- void printScop(llvm::raw_ostream &OS) const;
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
- virtual void releaseMemory();
- };
-
- // Returns true when Node has been tagged as an innermost parallel loop.
- static inline bool isInnermostParallel(__isl_keep isl_ast_node *Node) {
- isl_id *Id = isl_ast_node_get_annotation(Node);
- if (!Id)
- return false;
- struct IslAstUser *Info = (struct IslAstUser *) isl_id_get_user(Id);
-
- bool Res = false;
- if (Info)
- Res = Info->IsInnermostParallel;
- isl_id_free(Id);
- return Res;
- }
-
- // Returns true when Node has been tagged as an outermost parallel loop.
- static inline bool isOutermostParallel(__isl_keep isl_ast_node *Node) {
- isl_id *Id = isl_ast_node_get_annotation(Node);
- if (!Id)
- return false;
- struct IslAstUser *Info = (struct IslAstUser *) isl_id_get_user(Id);
-
- bool Res = false;
- if (Info)
- Res = Info->IsOutermostParallel;
- isl_id_free(Id);
- return Res;
- }
+// Information about an ast node.
+struct IslAstUser {
+ struct isl_ast_build *Context;
+ struct isl_pw_multi_aff *PMA;
+ // The node is the outermost parallel loop.
+ int IsOutermostParallel;
+
+ // The node is the innermost parallel loop.
+ int IsInnermostParallel;
+};
+
+class IslAstInfo : public ScopPass {
+ Scop *S;
+ IslAst *Ast;
+
+public:
+ static char ID;
+ IslAstInfo() : ScopPass(ID), Ast(NULL) {}
+
+ /// Print a source code representation of the program.
+ void pprint(llvm::raw_ostream &OS);
+
+ isl_ast_node *getAst();
+
+ bool runOnScop(Scop &S);
+ void printScop(llvm::raw_ostream &OS) const;
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+ virtual void releaseMemory();
+};
+
+// Returns true when Node has been tagged as an innermost parallel loop.
+static inline bool isInnermostParallel(__isl_keep isl_ast_node *Node) {
+ isl_id *Id = isl_ast_node_get_annotation(Node);
+ if (!Id)
+ return false;
+ struct IslAstUser *Info = (struct IslAstUser *)isl_id_get_user(Id);
+
+ bool Res = false;
+ if (Info)
+ Res = Info->IsInnermostParallel;
+ isl_id_free(Id);
+ return Res;
+}
+
+// Returns true when Node has been tagged as an outermost parallel loop.
+static inline bool isOutermostParallel(__isl_keep isl_ast_node *Node) {
+ isl_id *Id = isl_ast_node_get_annotation(Node);
+ if (!Id)
+ return false;
+ struct IslAstUser *Info = (struct IslAstUser *)isl_id_get_user(Id);
+
+ bool Res = false;
+ if (Info)
+ Res = Info->IsOutermostParallel;
+ isl_id_free(Id);
+ return Res;
+}
}
namespace llvm {
- class PassRegistry;
- void initializeIslAstInfoPass(llvm::PassRegistry&);
+class PassRegistry;
+void initializeIslAstInfoPass(llvm::PassRegistry &);
}
#endif /* POLLY_ISL_AST_H */
Modified: polly/trunk/include/polly/CodeGen/LoopGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/LoopGenerators.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/LoopGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/LoopGenerators.h Fri Mar 22 20:05:07 2013
@@ -19,9 +19,9 @@
#include <map>
namespace llvm {
- class Value;
- class Pass;
- class BasicBlock;
+class Value;
+class Pass;
+class BasicBlock;
}
namespace polly {
@@ -44,9 +44,9 @@ Value *createLoop(Value *LowerBound, Val
class OMPGenerator {
public:
- typedef std::map<Value*, Value*> ValueToValueMapTy;
+ typedef std::map<Value *, Value *> ValueToValueMapTy;
- OMPGenerator(IRBuilder<> &Builder, Pass *P): Builder(Builder), P(P) {}
+ OMPGenerator(IRBuilder<> &Builder, Pass *P) : Builder(Builder), P(P) {}
/// @brief Create an OpenMP parallel loop.
///
@@ -66,10 +66,10 @@ public:
/// instructions that form the actual loop body.
///
/// @return Value* The newly created induction variable for this loop.
- Value *createParallelLoop(Value *LowerBound, Value *UpperBound, Value *Stride,
- SetVector<Value*> &UsedValues,
- ValueToValueMapTy &VMap,
- BasicBlock::iterator *LoopBody);
+ Value *
+ createParallelLoop(Value *LowerBound, Value *UpperBound, Value *Stride,
+ SetVector<Value *> &UsedValues, ValueToValueMapTy &VMap,
+ BasicBlock::iterator *LoopBody);
private:
IRBuilder<> &Builder;
@@ -85,9 +85,9 @@ private:
void createCallParallelEnd();
void createCallLoopEndNowait();
- Value *loadValuesIntoStruct(SetVector<Value*> &Values);
- void extractValuesFromStruct(SetVector<Value*> OldValues,
- Value *Struct, ValueToValueMapTy &Map);
+ Value *loadValuesIntoStruct(SetVector<Value *> &Values);
+ void extractValuesFromStruct(SetVector<Value *> OldValues, Value *Struct,
+ ValueToValueMapTy &Map);
/// @brief Create the OpenMP subfunction.
///
@@ -103,14 +103,12 @@ private:
/// @param SubFunction The newly created SubFunction is returned here.
///
/// @return Value* The newly created induction variable.
- Value *createSubfunction(Value *Stride, Value *Struct,
- SetVector<Value*> UsedValues,
- ValueToValueMapTy &VMap,
- Function **SubFunction);
+ Value *
+ createSubfunction(Value *Stride, Value *Struct, SetVector<Value *> UsedValues,
+ ValueToValueMapTy &VMap, Function **SubFunction);
/// @brief Create the definition of the OpenMP subfunction.
Function *createSubfunctionDefinition();
};
} // end namespace polly
#endif
-
Modified: polly/trunk/include/polly/CodeGen/PTXGenerator.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/PTXGenerator.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/PTXGenerator.h (original)
+++ polly/trunk/include/polly/CodeGen/PTXGenerator.h Fri Mar 22 20:05:07 2013
@@ -22,9 +22,9 @@
#include <map>
namespace llvm {
- class Value;
- class Pass;
- class BasicBlock;
+class Value;
+class Pass;
+class BasicBlock;
}
namespace polly {
@@ -32,7 +32,7 @@ using namespace llvm;
class PTXGenerator {
public:
- typedef std::map<Value*, Value*> ValueToValueMapTy;
+ typedef std::map<Value *, Value *> ValueToValueMapTy;
PTXGenerator(IRBuilder<> &Builder, Pass *P, const std::string &Triple);
@@ -47,8 +47,8 @@ public:
/// @param LoopBody A pointer to an iterator that is set to point to the
/// body of the created loop. It should be used to insert
/// instructions that form the actual loop body.
- void startGeneration(SetVector<Value*> &UsedValues,
- SetVector<Value*> &OriginalIVS, ValueToValueMapTy &VMap,
+ void startGeneration(SetVector<Value *> &UsedValues,
+ SetVector<Value *> &OriginalIVS, ValueToValueMapTy &VMap,
BasicBlock::iterator *LoopBody);
/// @brief Execute the post-operations to build a GPGPU parallel loop.
@@ -73,9 +73,7 @@ public:
/// This size is used to allocate memory on the device and the host.
///
/// @param Bytes Output array size in bytes.
- void setOutputBytes(unsigned Bytes) {
- OutputBytes = Bytes;
- }
+ void setOutputBytes(unsigned Bytes) { OutputBytes = Bytes; }
private:
IRBuilder<> &Builder;
@@ -94,16 +92,16 @@ private:
StructType *ContextTy, *ModuleTy, *KernelTy, *DeviceTy, *DevDataTy, *EventTy;
void InitializeGPUDataTypes();
- IntegerType *getInt64Type(); // i64
- PointerType *getI8PtrType(); // char *
- PointerType *getPtrI8PtrType(); // char **
- PointerType *getFloatPtrType(); // float *
- PointerType *getGPUContextPtrType(); // %struct.PollyGPUContextT *
- PointerType *getGPUModulePtrType(); // %struct.PollyGPUModuleT *
- PointerType *getGPUDevicePtrType(); // %struct.PollyGPUDeviceT *
- PointerType *getPtrGPUDevicePtrType(); // %struct.PollyGPUDevicePtrT *
- PointerType *getGPUFunctionPtrType(); // %struct.PollyGPUFunctionT *
- PointerType *getGPUEventPtrType(); // %struct.PollyGPUEventT *
+ IntegerType *getInt64Type(); // i64
+ PointerType *getI8PtrType(); // char *
+ PointerType *getPtrI8PtrType(); // char **
+ PointerType *getFloatPtrType(); // float *
+ PointerType *getGPUContextPtrType(); // %struct.PollyGPUContextT *
+ PointerType *getGPUModulePtrType(); // %struct.PollyGPUModuleT *
+ PointerType *getGPUDevicePtrType(); // %struct.PollyGPUDeviceT *
+ PointerType *getPtrGPUDevicePtrType(); // %struct.PollyGPUDevicePtrT *
+ PointerType *getGPUFunctionPtrType(); // %struct.PollyGPUFunctionT *
+ PointerType *getGPUEventPtrType(); // %struct.PollyGPUEventT *
Module *getModule();
@@ -123,11 +121,9 @@ private:
void createCallInitDevice(Value *Context, Value *Device);
void createCallGetPTXModule(Value *Buffer, Value *Module);
- void createCallGetPTXKernelEntry(Value *Entry, Value *Module,
- Value *Kernel);
+ void createCallGetPTXKernelEntry(Value *Entry, Value *Module, Value *Kernel);
void createCallAllocateMemoryForHostAndDevice(Value *HostData,
- Value *DeviceData,
- Value *Size);
+ Value *DeviceData, Value *Size);
void createCallCopyFromHostToDevice(Value *DeviceData, Value *HostData,
Value *Size);
void createCallCopyFromDeviceToHost(Value *HostData, Value *DeviceData,
@@ -136,8 +132,7 @@ private:
Value *BlockHeight, Value *DeviceData);
void createCallLaunchKernel(Value *Kernel, Value *GridWidth,
Value *GridHeight);
- void createCallStartTimerByCudaEvent(Value *StartEvent,
- Value *StopEvent);
+ void createCallStartTimerByCudaEvent(Value *StartEvent, Value *StopEvent);
void createCallStopTimerByCudaEvent(Value *StartEvent, Value *StopEvent,
Value *Timer);
void createCallCleanupGPGPUResources(Value *HostData, Value *DeviceData,
@@ -153,10 +148,9 @@ private:
/// their content is available within the loop body.
/// @param OriginalIVS The new values of the original induction variables.
/// @param SubFunction The newly created SubFunction is returned here.
- void createSubfunction(SetVector<Value*> &UsedValues,
- SetVector<Value*> &OriginalIVS,
- ValueToValueMapTy &VMap,
- Function **SubFunction);
+ void createSubfunction(SetVector<Value *> &UsedValues,
+ SetVector<Value *> &OriginalIVS,
+ ValueToValueMapTy &VMap, Function **SubFunction);
/// @brief Create the definition of the CUDA subfunction.
///
@@ -192,6 +186,6 @@ private:
/// @param SubFunction A pointer to the device code function.
void eraseUnusedFunctions(Function *SubFunction);
};
-} // end namespace polly
+} // end namespace polly
#endif /* GPU_CODEGEN */
#endif /* POLLY_CODEGEN_PTXGENERATOR_H */
Modified: polly/trunk/include/polly/CodeGen/Utils.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/Utils.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/Utils.h (original)
+++ polly/trunk/include/polly/CodeGen/Utils.h Fri Mar 22 20:05:07 2013
@@ -14,13 +14,13 @@
#define POLLY_CODEGEN_UTILS_H
namespace llvm {
- class Pass;
- class BasicBlock;
+class Pass;
+class BasicBlock;
}
namespace polly {
- class Scop;
+class Scop;
/// @brief Execute a Scop conditionally.
///
@@ -60,4 +60,3 @@ llvm::BasicBlock *executeScopConditional
}
#endif
-
Modified: polly/trunk/include/polly/Dependences.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Dependences.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/Dependences.h (original)
+++ polly/trunk/include/polly/Dependences.h Fri Mar 22 20:05:07 2013
@@ -38,84 +38,83 @@ using namespace llvm;
namespace polly {
- class Scop;
- class ScopStmt;
+class Scop;
+class ScopStmt;
- class Dependences : public ScopPass {
- public:
- static char ID;
-
- /// @brief The type of the dependences.
- enum Type {
- // Write after read
- TYPE_WAR = 0x1,
-
- // Read after write
- TYPE_RAW = 0x2,
-
- // Write after write
- TYPE_WAW = 0x4,
-
- // All dependences
- TYPE_ALL = (TYPE_WAR | TYPE_RAW | TYPE_WAW)
- };
-
- typedef std::map<ScopStmt*, isl_map*> StatementToIslMapTy;
-
- Dependences();
-
- // @brief Check if a new scattering is valid.
- //
- // @param NewScattering The new scatterings
- //
- // @return bool True if the new scattering is valid, false it it reverses
- // dependences.
- bool isValidScattering(StatementToIslMapTy *NewScatterings);
-
- /// @brief Check if a dimension of the Scop can be executed in parallel.
- ///
- /// @param LoopDomain The subset of the scattering space that is executed in
- /// parallel.
- /// @param ParallelDimension The scattering dimension that is being executed
- /// in parallel.
- ///
- /// @return bool Returns true, if executing parallelDimension in parallel is
- /// valid for the scattering domain subset given.
- bool isParallelDimension(__isl_take isl_set *LoopDomain,
- unsigned ParallelDimension);
-
- /// @brief Get the dependences in this Scop.
- ///
- /// @param Kinds This integer defines the different kinds of dependences
- /// that will be returned. To return more than one kind, the
- /// different kinds are 'ored' together.
- isl_union_map *getDependences(int Kinds);
-
- bool runOnScop(Scop &S);
- void printScop(raw_ostream &OS) const;
- virtual void releaseMemory();
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+class Dependences : public ScopPass {
+public:
+ static char ID;
+
+ /// @brief The type of the dependences.
+ enum Type {
+ // Write after read
+ TYPE_WAR = 0x1,
-private:
- // The different kinds of dependences we calculate.
- isl_union_map *RAW;
- isl_union_map *WAR;
- isl_union_map *WAW;
-
- /// @brief Collect information about the SCoP.
- void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write,
- isl_union_map **MayWrite, isl_union_map **Schedule);
+ // Read after write
+ TYPE_RAW = 0x2,
+
+ // Write after write
+ TYPE_WAW = 0x4,
- // @brief Calculate the dependences for a certain SCoP.
- void calculateDependences(Scop &S);
+ // All dependences
+ TYPE_ALL = (TYPE_WAR | TYPE_RAW | TYPE_WAW)
};
+ typedef std::map<ScopStmt *, isl_map *> StatementToIslMapTy;
+
+ Dependences();
+
+ // @brief Check if a new scattering is valid.
+ //
+ // @param NewScattering The new scatterings
+ //
+ // @return bool True if the new scattering is valid, false it it reverses
+ // dependences.
+ bool isValidScattering(StatementToIslMapTy *NewScatterings);
+
+ /// @brief Check if a dimension of the Scop can be executed in parallel.
+ ///
+ /// @param LoopDomain The subset of the scattering space that is executed in
+ /// parallel.
+ /// @param ParallelDimension The scattering dimension that is being executed
+ /// in parallel.
+ ///
+ /// @return bool Returns true, if executing parallelDimension in parallel is
+ /// valid for the scattering domain subset given.
+ bool isParallelDimension(__isl_take isl_set *LoopDomain,
+ unsigned ParallelDimension);
+
+ /// @brief Get the dependences in this Scop.
+ ///
+ /// @param Kinds This integer defines the different kinds of dependences
+ /// that will be returned. To return more than one kind, the
+ /// different kinds are 'ored' together.
+ isl_union_map *getDependences(int Kinds);
+
+ bool runOnScop(Scop &S);
+ void printScop(raw_ostream &OS) const;
+ virtual void releaseMemory();
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+
+private:
+ // The different kinds of dependences we calculate.
+ isl_union_map *RAW;
+ isl_union_map *WAR;
+ isl_union_map *WAW;
+
+ /// @brief Collect information about the SCoP.
+ void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write,
+ isl_union_map **MayWrite, isl_union_map **Schedule);
+
+ // @brief Calculate the dependences for a certain SCoP.
+ void calculateDependences(Scop &S);
+};
} // End polly namespace.
namespace llvm {
- class PassRegistry;
- void initializeDependencesPass(llvm::PassRegistry&);
+class PassRegistry;
+void initializeDependencesPass(llvm::PassRegistry &);
}
#endif
Modified: polly/trunk/include/polly/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/LinkAllPasses.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/LinkAllPasses.h (original)
+++ polly/trunk/include/polly/LinkAllPasses.h Fri Mar 22 20:05:07 2013
@@ -19,129 +19,129 @@
#include <cstdlib>
namespace llvm {
- class Pass;
- class PassInfo;
- class PassRegistry;
- class RegionPass;
+class Pass;
+class PassInfo;
+class PassRegistry;
+class RegionPass;
}
namespace polly {
#ifdef CLOOG_FOUND
- llvm::Pass *createCloogExporterPass();
- llvm::Pass *createCloogInfoPass();
- llvm::Pass *createCodeGenerationPass();
-#endif
- llvm::Pass *createCodePreparationPass();
- llvm::Pass *createDeadCodeElimPass();
- llvm::Pass *createDependencesPass();
- llvm::Pass *createDOTOnlyPrinterPass();
- llvm::Pass *createDOTOnlyViewerPass();
- llvm::Pass *createDOTPrinterPass();
- llvm::Pass *createDOTViewerPass();
- llvm::Pass *createIndependentBlocksPass();
- llvm::Pass *createIndVarSimplifyPass();
- llvm::Pass *createJSONExporterPass();
- llvm::Pass *createJSONImporterPass();
+llvm::Pass *createCloogExporterPass();
+llvm::Pass *createCloogInfoPass();
+llvm::Pass *createCodeGenerationPass();
+#endif
+llvm::Pass *createCodePreparationPass();
+llvm::Pass *createDeadCodeElimPass();
+llvm::Pass *createDependencesPass();
+llvm::Pass *createDOTOnlyPrinterPass();
+llvm::Pass *createDOTOnlyViewerPass();
+llvm::Pass *createDOTPrinterPass();
+llvm::Pass *createDOTViewerPass();
+llvm::Pass *createIndependentBlocksPass();
+llvm::Pass *createIndVarSimplifyPass();
+llvm::Pass *createJSONExporterPass();
+llvm::Pass *createJSONImporterPass();
#ifdef PLUTO_FOUND
- llvm::Pass *createPlutoOptimizerPass();
+llvm::Pass *createPlutoOptimizerPass();
#endif
- llvm::Pass *createRegionSimplifyPass();
- llvm::Pass *createScopDetectionPass();
- llvm::Pass *createScopInfoPass();
- llvm::Pass *createIslAstInfoPass();
- llvm::Pass *createIslCodeGenerationPass();
- llvm::Pass *createIslScheduleOptimizerPass();
- llvm::Pass *createTempScopInfoPass();
+llvm::Pass *createRegionSimplifyPass();
+llvm::Pass *createScopDetectionPass();
+llvm::Pass *createScopInfoPass();
+llvm::Pass *createIslAstInfoPass();
+llvm::Pass *createIslCodeGenerationPass();
+llvm::Pass *createIslScheduleOptimizerPass();
+llvm::Pass *createTempScopInfoPass();
#ifdef OPENSCOP_FOUND
- llvm::Pass *createScopExporterPass();
- llvm::Pass *createScopImporterPass();
+llvm::Pass *createScopExporterPass();
+llvm::Pass *createScopImporterPass();
#endif
#ifdef SCOPLIB_FOUND
- llvm::Pass *createPoccPass();
- llvm::Pass *createScopLibExporterPass();
- llvm::Pass *createScopLibImporterPass();
+llvm::Pass *createPoccPass();
+llvm::Pass *createScopLibExporterPass();
+llvm::Pass *createScopLibImporterPass();
#endif
- extern char &IndependentBlocksID;
- extern char &CodePreparationID;
+extern char &IndependentBlocksID;
+extern char &CodePreparationID;
}
using namespace polly;
namespace {
- struct PollyForcePassLinking {
- PollyForcePassLinking() {
- // We must reference the passes in such a way that compilers will not
- // delete it all as dead code, even with whole program optimization,
- // yet is effectively a NO-OP. As the compiler isn't smart enough
- // to know that getenv() never returns -1, this will do the job.
- if (std::getenv("bar") != (char*) -1)
- return;
+struct PollyForcePassLinking {
+ PollyForcePassLinking() {
+ // We must reference the passes in such a way that compilers will not
+ // delete it all as dead code, even with whole program optimization,
+ // yet is effectively a NO-OP. As the compiler isn't smart enough
+ // to know that getenv() never returns -1, this will do the job.
+ if (std::getenv("bar") != (char *)- 1)
+ return;
#ifdef CLOOG_FOUND
- createCloogExporterPass();
- createCloogInfoPass();
- createCodeGenerationPass();
-#endif
- createCodePreparationPass();
- createDeadCodeElimPass();
- createDependencesPass();
- createDOTOnlyPrinterPass();
- createDOTOnlyViewerPass();
- createDOTPrinterPass();
- createDOTViewerPass();
- createIndependentBlocksPass();
- createIndVarSimplifyPass();
- createJSONExporterPass();
- createJSONImporterPass();
- createRegionSimplifyPass();
- createScopDetectionPass();
- createScopInfoPass();
+ createCloogExporterPass();
+ createCloogInfoPass();
+ createCodeGenerationPass();
+#endif
+ createCodePreparationPass();
+ createDeadCodeElimPass();
+ createDependencesPass();
+ createDOTOnlyPrinterPass();
+ createDOTOnlyViewerPass();
+ createDOTPrinterPass();
+ createDOTViewerPass();
+ createIndependentBlocksPass();
+ createIndVarSimplifyPass();
+ createJSONExporterPass();
+ createJSONImporterPass();
+ createRegionSimplifyPass();
+ createScopDetectionPass();
+ createScopInfoPass();
#ifdef PLUTO_FOUND
- createPlutoOptimizerPass();
+ createPlutoOptimizerPass();
#endif
- createIslAstInfoPass();
- createIslCodeGenerationPass();
- createIslScheduleOptimizerPass();
- createTempScopInfoPass();
+ createIslAstInfoPass();
+ createIslCodeGenerationPass();
+ createIslScheduleOptimizerPass();
+ createTempScopInfoPass();
#ifdef OPENSCOP_FOUND
- createScopExporterPass();
- createScopImporterPass();
+ createScopExporterPass();
+ createScopImporterPass();
#endif
#ifdef SCOPLIB_FOUND
- createPoccPass();
- createScopLibExporterPass();
- createScopLibImporterPass();
+ createPoccPass();
+ createScopLibExporterPass();
+ createScopLibImporterPass();
#endif
- }
- } PollyForcePassLinking; // Force link by creating a global definition.
+ }
+} PollyForcePassLinking; // Force link by creating a global definition.
}
namespace llvm {
- class PassRegistry;
+class PassRegistry;
#ifdef CLOOG_FOUND
- void initializeCodeGenerationPass(llvm::PassRegistry&);
+void initializeCodeGenerationPass(llvm::PassRegistry &);
#endif
- void initializeCodePreparationPass(llvm::PassRegistry&);
- void initializeDeadCodeElimPass(llvm::PassRegistry&);
- void initializeIndependentBlocksPass(llvm::PassRegistry&);
- void initializeJSONExporterPass(llvm::PassRegistry&);
- void initializeJSONImporterPass(llvm::PassRegistry&);
- void initializeIslAstInfoPass(llvm::PassRegistry&);
- void initializeIslCodeGenerationPass(llvm::PassRegistry&);
- void initializeIslScheduleOptimizerPass(llvm::PassRegistry&);
+void initializeCodePreparationPass(llvm::PassRegistry &);
+void initializeDeadCodeElimPass(llvm::PassRegistry &);
+void initializeIndependentBlocksPass(llvm::PassRegistry &);
+void initializeJSONExporterPass(llvm::PassRegistry &);
+void initializeJSONImporterPass(llvm::PassRegistry &);
+void initializeIslAstInfoPass(llvm::PassRegistry &);
+void initializeIslCodeGenerationPass(llvm::PassRegistry &);
+void initializeIslScheduleOptimizerPass(llvm::PassRegistry &);
#ifdef PLUTO_FOUND
- void initializePlutoOptimizerPass(llvm::PassRegistry&);
+void initializePlutoOptimizerPass(llvm::PassRegistry &);
#endif
#ifdef SCOPLIB_FOUND
- void initializePoccPass(llvm::PassRegistry&);
+void initializePoccPass(llvm::PassRegistry &);
#endif
- void initializePollyIndVarSimplifyPass(llvm::PassRegistry&);
- void initializeRegionSimplifyPass(llvm::PassRegistry&);
+void initializePollyIndVarSimplifyPass(llvm::PassRegistry &);
+void initializeRegionSimplifyPass(llvm::PassRegistry &);
}
#endif
Modified: polly/trunk/include/polly/MayAliasSet.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/MayAliasSet.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/MayAliasSet.h (original)
+++ polly/trunk/include/polly/MayAliasSet.h Fri Mar 22 20:05:07 2013
@@ -37,7 +37,7 @@
// a -> A
// b -> B
// ptr0 -> A, B
-//
+//
// After that, SCoPInfo pass will build a access function for each MayAliasSet,
// so "%2 = load i32* %ptr0, align 4" will be translated to "read A" and
// "read B", while "%3 = load i32* %a, align 4" will be translated to "read A",
@@ -55,9 +55,9 @@
#include <map>
namespace llvm {
- class Value;
- class AliasAnalysis;
- class raw_ostream;
+class Value;
+class AliasAnalysis;
+class raw_ostream;
}
using namespace llvm;
@@ -78,7 +78,7 @@ class MayAliasSet {
// TODO: Use CallbackVH to update the set when some base pointers are deleted
// by some pass.
- SmallPtrSet<const Value*, 8> MustAliasPtrs;
+ SmallPtrSet<const Value *, 8> MustAliasPtrs;
MayAliasSet() {}
@@ -89,15 +89,15 @@ public:
///
/// These iterators iterate over all must alias pointers in the set.
//@{
- typedef SmallPtrSetIterator<const Value*> const_iterator;
+ typedef SmallPtrSetIterator<const Value *> const_iterator;
const_iterator mustalias_begin() const { return MustAliasPtrs.begin(); }
- const_iterator mustalias_end() const { return MustAliasPtrs.end(); }
+ const_iterator mustalias_end() const { return MustAliasPtrs.end(); }
//@}
/// @brief Add a must alias pointer to this set.
///
/// @param V The pointer to add.
- void addMustAliasPtr(const Value* V) { MustAliasPtrs.insert(V); }
+ void addMustAliasPtr(const Value *V) { MustAliasPtrs.insert(V); }
void print(raw_ostream &OS) const;
void dump() const;
@@ -114,7 +114,7 @@ class MayAliasSetInfo {
SpecificBumpPtrAllocator<MayAliasSet> MayASAllocator;
// Mapping the pointers to their may-alias sets.
- typedef std::multimap<const Value*, MayAliasSet*> MayAliasSetMapType;
+ typedef std::multimap<const Value *, MayAliasSet *> MayAliasSetMapType;
MayAliasSetMapType BasePtrMap;
public:
@@ -127,7 +127,7 @@ public:
//@{
typedef MayAliasSetMapType::iterator alias_iterator;
typedef MayAliasSetMapType::const_iterator const_alias_iterator;
-
+
alias_iterator alias_begin(const Value *BasePtr) {
return BasePtrMap.lower_bound(BasePtr);
}
@@ -145,7 +145,6 @@ public:
}
//@}
-
/// @brief Build MayAliasSets in a SCoP.
///
/// @param Scop The SCoP to build MayAliasSets in.
Modified: polly/trunk/include/polly/RegisterPasses.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/RegisterPasses.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/RegisterPasses.h (original)
+++ polly/trunk/include/polly/RegisterPasses.h Fri Mar 22 20:05:07 2013
@@ -13,7 +13,5 @@
#ifndef POLLY_REGISTER_PASSES_H
#define POLLY_REGISTER_PASSES_H
-namespace llvm {
- class PassManagerBase;
-}
+namespace llvm { class PassManagerBase; }
#endif
Modified: polly/trunk/include/polly/ScheduleOptimizer.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScheduleOptimizer.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/ScheduleOptimizer.h (original)
+++ polly/trunk/include/polly/ScheduleOptimizer.h Fri Mar 22 20:05:07 2013
@@ -12,8 +12,6 @@
#ifndef POLLY_SCEDULE_OPTIMIZER_H
#define POLLY_SCHEDULE_OPTIMZER_H
-namespace polly {
- extern bool DisablePollyTiling;
-}
+namespace polly { extern bool DisablePollyTiling; }
#endif
Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Fri Mar 22 20:05:07 2013
@@ -56,21 +56,21 @@
using namespace llvm;
namespace llvm {
- class RegionInfo;
- class Region;
- class LoopInfo;
- class Loop;
- class ScalarEvolution;
- class SCEV;
- class SCEVAddRecExpr;
- class CallInst;
- class Instruction;
- class AliasAnalysis;
- class Value;
+class RegionInfo;
+class Region;
+class LoopInfo;
+class Loop;
+class ScalarEvolution;
+class SCEV;
+class SCEVAddRecExpr;
+class CallInst;
+class Instruction;
+class AliasAnalysis;
+class Value;
}
namespace polly {
-typedef std::set<const SCEV*> ParamSetType;
+typedef std::set<const SCEV *> ParamSetType;
//===----------------------------------------------------------------------===//
/// @brief Pass to detect the maximal static control parts (Scops) of a
@@ -84,7 +84,7 @@ class ScopDetection : public FunctionPas
/// @brief Analysis passes used.
//@{
- ScalarEvolution* SE;
+ ScalarEvolution *SE;
LoopInfo *LI;
RegionInfo *RI;
AliasAnalysis *AA;
@@ -92,22 +92,22 @@ class ScopDetection : public FunctionPas
/// @brief Context variables for SCoP detection.
struct DetectionContext {
- Region &CurRegion; // The region to check.
- AliasSetTracker AST; // The AliasSetTracker to hold the alias information.
- bool Verifying; // If we are in the verification phase?
+ Region &CurRegion; // The region to check.
+ AliasSetTracker AST; // The AliasSetTracker to hold the alias information.
+ bool Verifying; // If we are in the verification phase?
DetectionContext(Region &R, AliasAnalysis &AA, bool Verify)
- : CurRegion(R), AST(AA), Verifying(Verify) {}
+ : CurRegion(R), AST(AA), Verifying(Verify) {}
};
// Remember the valid regions
- typedef std::set<const Region*> RegionSet;
+ typedef std::set<const Region *> RegionSet;
RegionSet ValidRegions;
// Invalid regions and the reason they fail.
- std::map<const Region*, std::string> InvalidRegions;
+ std::map<const Region *, std::string> InvalidRegions;
// Remember the invalid functions producted by backends;
- typedef std::set<const Function*> FunctionSet;
+ typedef std::set<const Function *> FunctionSet;
FunctionSet InvalidFunctions;
mutable std::string LastFailure;
@@ -247,20 +247,18 @@ public:
typedef RegionSet::iterator iterator;
typedef RegionSet::const_iterator const_iterator;
- iterator begin() { return ValidRegions.begin(); }
- iterator end() { return ValidRegions.end(); }
+ iterator begin() { return ValidRegions.begin(); }
+ iterator end() { return ValidRegions.end(); }
const_iterator begin() const { return ValidRegions.begin(); }
- const_iterator end() const { return ValidRegions.end(); }
+ const_iterator end() const { return ValidRegions.end(); }
//@}
/// @brief Mark the function as invalid so we will not extract any scop from
/// the function.
///
/// @param F The function to mark as invalid.
- void markFunctionAsInvalid(const Function *F) {
- InvalidFunctions.insert(F);
- }
+ void markFunctionAsInvalid(const Function *F) { InvalidFunctions.insert(F); }
/// @brief Verify if all valid Regions in this Function are still valid
/// after some transformations.
@@ -284,8 +282,8 @@ public:
} //end namespace polly
namespace llvm {
- class PassRegistry;
- void initializeScopDetectionPass(llvm::PassRegistry&);
+class PassRegistry;
+void initializeScopDetectionPass(llvm::PassRegistry &);
}
#endif
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Mar 22 20:05:07 2013
@@ -29,13 +29,13 @@
using namespace llvm;
namespace llvm {
- class Loop;
- class LoopInfo;
- class PHINode;
- class ScalarEvolution;
- class SCEV;
- class SCEVAddRecExpr;
- class Type;
+class Loop;
+class LoopInfo;
+class PHINode;
+class ScalarEvolution;
+class SCEV;
+class SCEVAddRecExpr;
+class Type;
}
struct isl_ctx;
@@ -96,7 +96,7 @@ private:
isl_map *AccessRelation;
enum AccessType Type;
- const Value* BaseAddr;
+ const Value *BaseAddr;
std::string BaseName;
isl_basic_map *createBasicAccessMap(ScopStmt *Statement);
void setBaseName();
@@ -112,7 +112,8 @@ public:
// @param Access The memory access.
// @param Statement The statement that contains the access.
// @param SE The ScalarEvolution analysis.
- MemoryAccess(const IRAccess &Access, const Instruction *AccInst, ScopStmt *Statement);
+ MemoryAccess(const IRAccess &Access, const Instruction *AccInst,
+ ScopStmt *Statement);
// @brief Create a memory access that reads a complete memory object.
//
@@ -133,17 +134,11 @@ public:
/// @brief Get an isl string representing this access function.
std::string getAccessRelationStr() const;
- const Value *getBaseAddr() const {
- return BaseAddr;
- }
+ const Value *getBaseAddr() const { return BaseAddr; }
- const std::string &getBaseName() const {
- return BaseName;
- }
+ const std::string &getBaseName() const { return BaseName; }
- const Instruction *getAccessInstruction() const {
- return Inst;
- }
+ const Instruction *getAccessInstruction() const { return Inst; }
/// @brief Get the new access function imported from JSCOP file
isl_map *getNewAccessRelation() const;
@@ -203,7 +198,6 @@ class ScopStmt {
// DO NOT IMPLEMENT
const ScopStmt &operator=(const ScopStmt &);
-
/// Polyhedral description
//@{
@@ -264,9 +258,9 @@ class ScopStmt {
/// The memory accesses of this statement.
///
/// The only side effects of a statement are its memory accesses.
- typedef SmallVector<MemoryAccess*, 8> MemoryAccessVec;
+ typedef SmallVector<MemoryAccess *, 8> MemoryAccessVec;
MemoryAccessVec MemAccs;
- std::map<const Instruction*, MemoryAccess*> InstructionToAccess;
+ std::map<const Instruction *, MemoryAccess *> InstructionToAccess;
//@}
@@ -276,28 +270,26 @@ class ScopStmt {
/// @brief The loop induction variables surrounding the statement.
///
/// This information is only needed for final code generation.
- std::vector<PHINode*> IVS;
- std::vector<Loop*> NestLoops;
+ std::vector<PHINode *> IVS;
+ std::vector<Loop *> NestLoops;
std::string BaseName;
/// Build the statment.
//@{
__isl_give isl_set *buildConditionSet(const Comparison &Cmp);
- __isl_give isl_set *addConditionsToDomain(__isl_take isl_set *Domain,
- TempScop &tempScop,
- const Region &CurRegion);
- __isl_give isl_set *addLoopBoundsToDomain(__isl_take isl_set *Domain,
- TempScop &tempScop);
- __isl_give isl_set *buildDomain(TempScop &tempScop,
- const Region &CurRegion);
+ __isl_give isl_set *addConditionsToDomain(
+ __isl_take isl_set *Domain, TempScop &tempScop, const Region &CurRegion);
+ __isl_give isl_set *
+ addLoopBoundsToDomain(__isl_take isl_set *Domain, TempScop &tempScop);
+ __isl_give isl_set *buildDomain(TempScop &tempScop, const Region &CurRegion);
void buildScattering(SmallVectorImpl<unsigned> &Scatter);
void buildAccesses(TempScop &tempScop, const Region &CurRegion);
//@}
/// Create the ScopStmt from a BasicBlock.
ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion,
- BasicBlock &bb, SmallVectorImpl<Loop*> &NestLoops,
+ BasicBlock &bb, SmallVectorImpl<Loop *> &NestLoops,
SmallVectorImpl<unsigned> &Scatter);
friend class Scop;
@@ -344,8 +336,8 @@ public:
}
MemoryAccess *lookupAccessFor(const Instruction *Inst) const {
- std::map<const Instruction*, MemoryAccess*>::const_iterator at
- = InstructionToAccess.find(Inst);
+ std::map<const Instruction *, MemoryAccess *>::const_iterator at =
+ InstructionToAccess.find(Inst);
return at == InstructionToAccess.end() ? NULL : at->second;
}
@@ -388,7 +380,7 @@ public:
};
/// @brief Print ScopStmt S to raw_ostream O.
-static inline raw_ostream& operator<<(raw_ostream &O, const ScopStmt &S) {
+static inline raw_ostream &operator<<(raw_ostream &O, const ScopStmt &S) {
S.print(O);
return O;
}
@@ -426,16 +418,16 @@ class Scop {
/// Max loop depth.
unsigned MaxLoopDepth;
- typedef std::vector<ScopStmt*> StmtSet;
+ typedef std::vector<ScopStmt *> StmtSet;
/// The Statments in this Scop.
StmtSet Stmts;
/// Parameters of this Scop
- typedef SmallVector<const SCEV*, 8> ParamVecType;
+ typedef SmallVector<const SCEV *, 8> ParamVecType;
ParamVecType Parameters;
/// The isl_ids that are used to represent the parameters
- typedef std::map<const SCEV*, int> ParamIdType;
+ typedef std::map<const SCEV *, int> ParamIdType;
ParamIdType ParameterIds;
// Isl context.
@@ -467,11 +459,10 @@ class Scop {
/// Build the Scop and Statement with precalculate scop information.
void buildScop(TempScop &TempScop, const Region &CurRegion,
- // Loops in Scop containing CurRegion
- SmallVectorImpl<Loop*> &NestLoops,
- // The scattering numbers
- SmallVectorImpl<unsigned> &Scatter,
- LoopInfo &LI);
+ // Loops in Scop containing CurRegion
+ SmallVectorImpl<Loop *> &NestLoops,
+ // The scattering numbers
+ SmallVectorImpl<unsigned> &Scatter, LoopInfo &LI);
/// Helper function for printing the Scop.
void printContext(raw_ostream &OS) const;
@@ -497,7 +488,7 @@ public:
inline const ParamVecType &getParams() const { return Parameters; }
/// @brief Take a list of parameters and add the new ones to the scop.
- void addParams(std::vector<const SCEV*> NewParameters);
+ void addParams(std::vector<const SCEV *> NewParameters);
/// @brief Return the isl_id that represents a certain parameter.
///
@@ -514,9 +505,9 @@ public:
typedef ParamVecType::const_iterator const_param_iterator;
param_iterator param_begin() { return Parameters.begin(); }
- param_iterator param_end() { return Parameters.end(); }
+ param_iterator param_end() { return Parameters.end(); }
const_param_iterator param_begin() const { return Parameters.begin(); }
- const_param_iterator param_end() const { return Parameters.end(); }
+ const_param_iterator param_end() const { return Parameters.end(); }
//@}
/// @brief Get the maximum region of this static control part.
@@ -549,7 +540,7 @@ public:
///
/// @return The constraint on parameter of this Scop.
__isl_give isl_set *getContext() const;
- __isl_give isl_space *getParamSpace() const;
+ __isl_give isl_space *getParamSpace() const;
/// @brief Get an isl string representing the context.
std::string getContextStr() const;
@@ -562,20 +553,20 @@ public:
typedef StmtSet::const_iterator const_iterator;
iterator begin() { return Stmts.begin(); }
- iterator end() { return Stmts.end(); }
+ iterator end() { return Stmts.end(); }
const_iterator begin() const { return Stmts.begin(); }
- const_iterator end() const { return Stmts.end(); }
+ const_iterator end() const { return Stmts.end(); }
typedef StmtSet::reverse_iterator reverse_iterator;
typedef StmtSet::const_reverse_iterator const_reverse_iterator;
reverse_iterator rbegin() { return Stmts.rbegin(); }
- reverse_iterator rend() { return Stmts.rend(); }
+ reverse_iterator rend() { return Stmts.rend(); }
const_reverse_iterator rbegin() const { return Stmts.rbegin(); }
- const_reverse_iterator rend() const { return Stmts.rend(); }
+ const_reverse_iterator rend() const { return Stmts.rend(); }
//@}
- void setContext(isl_set* NewContext);
+ void setContext(isl_set *NewContext);
/// @brief Align the parameters in the statement to the scop context
void realignParams();
@@ -598,7 +589,7 @@ public:
};
/// @brief Print Scop scop to raw_ostream O.
-static inline raw_ostream& operator<<(raw_ostream &O, const Scop &scop) {
+static inline raw_ostream &operator<<(raw_ostream &O, const Scop &scop) {
scop.print(O);
return O;
}
@@ -655,8 +646,8 @@ public:
} //end namespace polly
namespace llvm {
- class PassRegistry;
- void initializeScopInfoPass(llvm::PassRegistry&);
+class PassRegistry;
+void initializeScopInfoPass(llvm::PassRegistry &);
}
#endif
Modified: polly/trunk/include/polly/ScopLib.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopLib.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopLib.h (original)
+++ polly/trunk/include/polly/ScopLib.h Fri Mar 22 20:05:07 2013
@@ -22,9 +22,7 @@
#include <map>
-namespace llvm {
- class Value;
-}
+namespace llvm { class Value; }
struct isl_constraint;
struct isl_basic_map;
@@ -33,40 +31,40 @@ struct isl_map;
struct isl_set;
namespace polly {
- class Dependences;
- class ScopStmt;
- class Scop;
- class ScopLib {
- Scop *PollyScop;
- scoplib_scop_p scoplib;
- Dependences *D;
-
- std::map<const llvm::Value*, int> ArrayMap;
-
- void initializeArrays();
- void initializeParameters();
- void initializeScattering();
- void initializeStatements();
- scoplib_statement_p initializeStatement(ScopStmt *stmt);
- void freeStatement(scoplib_statement_p stmt);
- static int accessToMatrix_constraint(isl_constraint *c, void *user);
- static int accessToMatrix_basic_map(isl_basic_map *bmap, void *user);
- scoplib_matrix_p createAccessMatrix(ScopStmt *S, bool isRead);
- static int domainToMatrix_constraint(isl_constraint *c, void *user);
- static int domainToMatrix_basic_set(isl_basic_set *bset, void *user);
- scoplib_matrix_p domainToMatrix(__isl_take isl_set *set);
- static int scatteringToMatrix_constraint(isl_constraint *c, void *user);
- static int scatteringToMatrix_basic_map(isl_basic_map *bmap, void *user);
- scoplib_matrix_p scatteringToMatrix(__isl_take isl_map *map);
-
- public:
- ScopLib(Scop *S);
- ScopLib(Scop *S, FILE *F, Dependences *D);
- ~ScopLib();
- void print(FILE *F);
- bool updateScattering();
+class Dependences;
+class ScopStmt;
+class Scop;
+class ScopLib {
+ Scop *PollyScop;
+ scoplib_scop_p scoplib;
+ Dependences *D;
+
+ std::map<const llvm::Value *, int> ArrayMap;
+
+ void initializeArrays();
+ void initializeParameters();
+ void initializeScattering();
+ void initializeStatements();
+ scoplib_statement_p initializeStatement(ScopStmt *stmt);
+ void freeStatement(scoplib_statement_p stmt);
+ static int accessToMatrix_constraint(isl_constraint *c, void *user);
+ static int accessToMatrix_basic_map(isl_basic_map *bmap, void *user);
+ scoplib_matrix_p createAccessMatrix(ScopStmt *S, bool isRead);
+ static int domainToMatrix_constraint(isl_constraint *c, void *user);
+ static int domainToMatrix_basic_set(isl_basic_set *bset, void *user);
+ scoplib_matrix_p domainToMatrix(__isl_take isl_set *set);
+ static int scatteringToMatrix_constraint(isl_constraint *c, void *user);
+ static int scatteringToMatrix_basic_map(isl_basic_map *bmap, void *user);
+ scoplib_matrix_p scatteringToMatrix(__isl_take isl_map *map);
+
+public:
+ ScopLib(Scop *S);
+ ScopLib(Scop *S, FILE *F, Dependences *D);
+ ~ScopLib();
+ void print(FILE *F);
+ bool updateScattering();
- };
+};
}
#endif /* POLLY_SCOPLIB_H */
Modified: polly/trunk/include/polly/Support/GICHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/GICHelper.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/GICHelper.h (original)
+++ polly/trunk/include/polly/Support/GICHelper.h Fri Mar 22 20:05:07 2013
@@ -33,12 +33,12 @@ namespace polly {
///
/// @param v The mpz_t object your want to hold the result.
/// @param apint The APInt you want to convert.
-void MPZ_from_APInt (mpz_t v, const llvm::APInt apint, bool is_signed = true);
+void MPZ_from_APInt(mpz_t v, const llvm::APInt apint, bool is_signed = true);
/// @brief Convert mpz to APInt.
///
/// @param mpz The mpz_t you want to convert.
-llvm::APInt APInt_from_MPZ (const mpz_t mpz);
+llvm::APInt APInt_from_MPZ(const mpz_t mpz);
/// @brief Get c++ string from Isl objects.
//@{
Modified: polly/trunk/include/polly/Support/SCEVValidator.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/SCEVValidator.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/SCEVValidator.h (original)
+++ polly/trunk/include/polly/Support/SCEVValidator.h Fri Mar 22 20:05:07 2013
@@ -15,27 +15,25 @@
#include <vector>
namespace llvm {
- class Region;
- class SCEV;
- class ScalarEvolution;
- class Value;
+class Region;
+class SCEV;
+class ScalarEvolution;
+class Value;
}
namespace polly {
- /// Returns true when the SCEV contains references to instructions within the
- /// region.
- ///
- /// @param S The SCEV to analyze.
- /// @param R The region in which we look for dependences.
- bool hasScalarDepsInsideRegion(const llvm::SCEV *S, const llvm::Region *R);
- bool isAffineExpr(const llvm::Region *R, const llvm::SCEV *Expression,
- llvm::ScalarEvolution &SE,
- const llvm::Value *BaseAddress = 0);
- std::vector<const llvm::SCEV*> getParamsInAffineExpr(
- const llvm::Region *R,
- const llvm::SCEV *Expression,
- llvm::ScalarEvolution &SE,
- const llvm::Value *BaseAddress = 0);
+/// Returns true when the SCEV contains references to instructions within the
+/// region.
+///
+/// @param S The SCEV to analyze.
+/// @param R The region in which we look for dependences.
+bool hasScalarDepsInsideRegion(const llvm::SCEV *S, const llvm::Region *R);
+bool isAffineExpr(const llvm::Region *R, const llvm::SCEV *Expression,
+ llvm::ScalarEvolution &SE,
+ const llvm::Value *BaseAddress = 0);
+std::vector<const llvm::SCEV *> getParamsInAffineExpr(
+ const llvm::Region *R, const llvm::SCEV *Expression,
+ llvm::ScalarEvolution &SE, const llvm::Value *BaseAddress = 0);
}
Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Fri Mar 22 20:05:07 2013
@@ -22,9 +22,7 @@
#include "llvm/Analysis/RegionPass.h"
#include "llvm/IR/Instructions.h"
-namespace llvm {
- class DataLayout;
-}
+namespace llvm { class DataLayout; }
using namespace llvm;
@@ -40,7 +38,10 @@ public:
const SCEV *Offset;
// The type of the scev affine function
- enum TypeKind { READ, WRITE };
+ enum TypeKind {
+ READ,
+ WRITE
+ };
private:
unsigned ElemBytes;
@@ -48,10 +49,10 @@ private:
bool IsAffine;
public:
- explicit IRAccess (TypeKind Type, const Value *BaseAddress,
- const SCEV *Offset, unsigned elemBytes, bool Affine)
- : BaseAddress(BaseAddress), Offset(Offset),
- ElemBytes(elemBytes), Type(Type), IsAffine(Affine) {}
+ explicit IRAccess(TypeKind Type, const Value *BaseAddress, const SCEV *Offset,
+ unsigned elemBytes, bool Affine)
+ : BaseAddress(BaseAddress), Offset(Offset), ElemBytes(elemBytes),
+ Type(Type), IsAffine(Affine) {}
enum TypeKind getType() const { return Type; }
@@ -77,7 +78,7 @@ class Comparison {
public:
Comparison(const SCEV *LHS, const SCEV *RHS, ICmpInst::Predicate Pred)
- : LHS(LHS), RHS(RHS), Pred(Pred) {}
+ : LHS(LHS), RHS(RHS), Pred(Pred) {}
const SCEV *getLHS() const { return LHS; }
const SCEV *getRHS() const { return RHS; }
@@ -97,13 +98,13 @@ typedef SmallVector<Comparison, 4> BBCon
/// A canonical induction variable is:
/// an integer recurrence that starts at 0 and increments by one each time
/// through the loop.
-typedef std::map<const Loop*, const SCEV*> LoopBoundMapType;
+typedef std::map<const Loop *, const SCEV *> LoopBoundMapType;
/// Mapping BBs to its condition constrains
-typedef std::map<const BasicBlock*, BBCond> BBCondMapType;
+typedef std::map<const BasicBlock *, BBCond> BBCondMapType;
-typedef std::vector<std::pair<IRAccess, Instruction*> > AccFuncSetType;
-typedef std::map<const BasicBlock*, AccFuncSetType> AccFuncMapType;
+typedef std::vector<std::pair<IRAccess, Instruction *> > AccFuncSetType;
+typedef std::map<const BasicBlock *, AccFuncSetType> AccFuncMapType;
//===---------------------------------------------------------------------===//
/// @brief Scop represent with llvm objects.
@@ -123,7 +124,7 @@ class TempScop {
// Access function of bbs.
const AccFuncMapType &AccFuncMap;
-
+
// The alias information about this SCoP.
MayAliasSetInfo *MayASInfo;
@@ -131,8 +132,8 @@ class TempScop {
explicit TempScop(Region &r, LoopBoundMapType &loopBounds,
BBCondMapType &BBCmps, AccFuncMapType &accFuncMap)
- : R(r), MaxLoopDepth(0), LoopBounds(loopBounds), BBConds(BBCmps),
- AccFuncMap(accFuncMap), MayASInfo(new MayAliasSetInfo()) {}
+ : R(r), MaxLoopDepth(0), LoopBounds(loopBounds), BBConds(BBCmps),
+ AccFuncMap(accFuncMap), MayASInfo(new MayAliasSetInfo()) {}
public:
~TempScop();
@@ -176,9 +177,9 @@ public:
///
/// @return All access functions in BB
///
- const AccFuncSetType *getAccessFunctions(const BasicBlock* BB) const {
+ const AccFuncSetType *getAccessFunctions(const BasicBlock *BB) const {
AccFuncMapType::const_iterator at = AccFuncMap.find(BB);
- return at != AccFuncMap.end()? &(at->second) : 0;
+ return at != AccFuncMap.end() ? &(at->second) : 0;
}
//@}
@@ -195,11 +196,11 @@ public:
/// @param OS The output stream the access functions is printed to.
/// @param SE The ScalarEvolution that help printing the access functions.
/// @param LI The LoopInfo that help printing the access functions.
- void printDetail(raw_ostream &OS, ScalarEvolution *SE,
- LoopInfo *LI, const Region *Reg, unsigned ind) const;
+ void printDetail(raw_ostream &OS, ScalarEvolution *SE, LoopInfo *LI,
+ const Region *Reg, unsigned ind) const;
};
-typedef std::map<const Region*, TempScop*> TempScopMapType;
+typedef std::map<const Region *, TempScop *> TempScopMapType;
//===----------------------------------------------------------------------===//
/// @brief The Function Pass to extract temporary information for Static control
/// part in llvm function.
@@ -212,7 +213,7 @@ class TempScopInfo : public FunctionPass
const TempScopInfo &operator=(const TempScopInfo &);
// The ScalarEvolution to help building Scop.
- ScalarEvolution* SE;
+ ScalarEvolution *SE;
// LoopInfo for information about loops
LoopInfo *LI;
@@ -290,8 +291,8 @@ public:
} // end namespace polly
namespace llvm {
- class PassRegistry;
- void initializeTempScopInfoPass(llvm::PassRegistry&);
+class PassRegistry;
+void initializeTempScopInfoPass(llvm::PassRegistry &);
}
#endif
Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Fri Mar 22 20:05:07 2013
@@ -286,12 +286,10 @@ void Dependences::getAnalysisUsage(Analy
char Dependences::ID = 0;
+Pass *polly::createDependencesPass() { return new Dependences(); }
+
INITIALIZE_PASS_BEGIN(Dependences, "polly-dependences",
- "Polly - Calculate dependences", false, false)
-INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+ "Polly - Calculate dependences", false, false);
+INITIALIZE_PASS_DEPENDENCY(ScopInfo);
INITIALIZE_PASS_END(Dependences, "polly-dependences",
"Polly - Calculate dependences", false, false)
-
-Pass *polly::createDependencesPass() {
- return new Dependences();
-}
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Fri Mar 22 20:05:07 2013
@@ -175,7 +175,8 @@ bool ScopDetection::isValidCFG(BasicBloc
// Only Constant and ICmpInst are allowed as condition.
if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition)))
- INVALID(AffFunc, "Condition in BB '" + BB.getName() + "' neither "
+ INVALID(AffFunc, "Condition in BB '" + BB.getName() +
+ "' neither "
"constant nor an icmp instruction");
// Allow perfectly nested conditions.
@@ -201,7 +202,8 @@ bool ScopDetection::isValidCFG(BasicBloc
if (!isAffineExpr(&Context.CurRegion, LHS, *SE) ||
!isAffineExpr(&Context.CurRegion, RHS, *SE))
INVALID(AffFunc, "Non affine branch in BB '" << BB.getName()
- << "' with LHS: " << *LHS << " and RHS: " << *RHS);
+ << "' with LHS: " << *LHS
+ << " and RHS: " << *RHS);
}
// Allow loop exit conditions.
@@ -404,8 +406,9 @@ bool ScopDetection::isValidLoop(Loop *L,
// Is the loop count affine?
const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
if (!isAffineExpr(&Context.CurRegion, LoopCount, *SE))
- INVALID(LoopBound, "Non affine loop bound '" << *LoopCount << "' in loop: "
- << L->getHeader()->getName());
+ INVALID(LoopBound,
+ "Non affine loop bound '"
+ << *LoopCount << "' in loop: " << L->getHeader()->getName());
return true;
}
@@ -450,12 +453,9 @@ Region *ScopDetection::expandRegion(Regi
}
}
- DEBUG(
- if (LastValidRegion)
- dbgs() << "\tto " << LastValidRegion->getNameStr() << "\n";
- else
- dbgs() << "\tExpanding " << R.getNameStr() << " failed\n";
- );
+ DEBUG(if (LastValidRegion)
+ dbgs() << "\tto " << LastValidRegion->getNameStr() << "\n";
+ else dbgs() << "\tExpanding " << R.getNameStr() << " failed\n";);
return LastValidRegion;
}
@@ -543,8 +543,7 @@ bool ScopDetection::isValidRegion(Detect
// The toplevel region is no valid region.
if (!R.getParent()) {
- DEBUG(dbgs() << "Top level region is invalid";
- dbgs() << "\n");
+ DEBUG(dbgs() << "Top level region is invalid"; dbgs() << "\n");
return false;
}
@@ -668,7 +667,7 @@ void ScopDetection::getAnalysisUsage(Ana
AU.setPreservesAll();
}
-void ScopDetection::print(raw_ostream &OS, const Module *)const {
+void ScopDetection::print(raw_ostream &OS, const Module *) const {
for (RegionSet::const_iterator I = ValidRegions.begin(),
E = ValidRegions.end();
I != E; ++I)
@@ -685,18 +684,16 @@ void ScopDetection::releaseMemory() {
char ScopDetection::ID = 0;
+Pass *polly::createScopDetectionPass() { return new ScopDetection(); }
+
INITIALIZE_PASS_BEGIN(ScopDetection, "polly-detect",
"Polly - Detect static control parts (SCoPs)", false,
- false)
-INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
-INITIALIZE_PASS_DEPENDENCY(DominatorTree)
-INITIALIZE_PASS_DEPENDENCY(LoopInfo)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
-INITIALIZE_PASS_DEPENDENCY(RegionInfo)
-INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+ false);
+INITIALIZE_AG_DEPENDENCY(AliasAnalysis);
+INITIALIZE_PASS_DEPENDENCY(DominatorTree);
+INITIALIZE_PASS_DEPENDENCY(LoopInfo);
+INITIALIZE_PASS_DEPENDENCY(PostDominatorTree);
+INITIALIZE_PASS_DEPENDENCY(RegionInfo);
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution);
INITIALIZE_PASS_END(ScopDetection, "polly-detect",
"Polly - Detect static control parts (SCoPs)", false, false)
-
-Pass *polly::createScopDetectionPass() {
- return new ScopDetection();
-}
Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Fri Mar 22 20:05:07 2013
@@ -25,25 +25,23 @@ using namespace polly;
using namespace llvm;
namespace llvm {
- template <> struct GraphTraits<ScopDetection*>
- : public GraphTraits<RegionInfo*> {
+template <>
+struct GraphTraits<ScopDetection *> : public GraphTraits<RegionInfo *> {
- static NodeType *getEntryNode(ScopDetection *SD) {
- return GraphTraits<RegionInfo*>::getEntryNode(SD->getRI());
- }
- static nodes_iterator nodes_begin(ScopDetection *SD) {
- return nodes_iterator::begin(getEntryNode(SD));
- }
- static nodes_iterator nodes_end(ScopDetection *SD) {
- return nodes_iterator::end(getEntryNode(SD));
- }
- };
+ static NodeType *getEntryNode(ScopDetection *SD) {
+ return GraphTraits<RegionInfo *>::getEntryNode(SD->getRI());
+ }
+ static nodes_iterator nodes_begin(ScopDetection *SD) {
+ return nodes_iterator::begin(getEntryNode(SD));
+ }
+ static nodes_iterator nodes_end(ScopDetection *SD) {
+ return nodes_iterator::end(getEntryNode(SD));
+ }
+};
-template<>
-struct DOTGraphTraits<RegionNode*> : public DefaultDOTGraphTraits {
+template <> struct DOTGraphTraits<RegionNode *> : public DefaultDOTGraphTraits {
- DOTGraphTraits (bool isSimple=false)
- : DefaultDOTGraphTraits(isSimple) {}
+ DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
std::string getNodeLabel(RegionNode *Node, RegionNode *Graph) {
@@ -51,27 +49,26 @@ struct DOTGraphTraits<RegionNode*> : pub
BasicBlock *BB = Node->getNodeAs<BasicBlock>();
if (isSimple())
- return DOTGraphTraits<const Function*>
- ::getSimpleNodeLabel(BB, BB->getParent());
+ return DOTGraphTraits<const Function *>::getSimpleNodeLabel(
+ BB, BB->getParent());
else
- return DOTGraphTraits<const Function*>
- ::getCompleteNodeLabel(BB, BB->getParent());
+ return DOTGraphTraits<const Function *>::getCompleteNodeLabel(
+ BB, BB->getParent());
}
return "Not implemented";
}
};
-template<>
-struct DOTGraphTraits<ScopDetection*> : public DOTGraphTraits<RegionNode*> {
- DOTGraphTraits (bool isSimple=false)
- : DOTGraphTraits<RegionNode*>(isSimple) {}
- static std::string getGraphName(ScopDetection *SD) {
- return "Scop Graph";
- }
+template <>
+struct DOTGraphTraits<ScopDetection *> : public DOTGraphTraits<RegionNode *> {
+ DOTGraphTraits(bool isSimple = false)
+ : DOTGraphTraits<RegionNode *>(isSimple) {}
+ static std::string getGraphName(ScopDetection *SD) { return "Scop Graph"; }
std::string getEdgeAttributes(RegionNode *srcNode,
- GraphTraits<RegionInfo*>::ChildIteratorType CI, ScopDetection *SD) {
+ GraphTraits<RegionInfo *>::ChildIteratorType CI,
+ ScopDetection *SD) {
RegionNode *destNode = *CI;
@@ -98,15 +95,15 @@ struct DOTGraphTraits<ScopDetection*> :
}
std::string getNodeLabel(RegionNode *Node, ScopDetection *SD) {
- return DOTGraphTraits<RegionNode*>
- ::getNodeLabel(Node, SD->getRI()->getTopLevelRegion());
+ return DOTGraphTraits<RegionNode *>::getNodeLabel(
+ Node, SD->getRI()->getTopLevelRegion());
}
static std::string escapeString(std::string String) {
std::string Escaped;
- for (std::string::iterator SI = String.begin(), SE = String.end();
- SI != SE; ++SI) {
+ for (std::string::iterator SI = String.begin(), SE = String.end(); SI != SE;
+ ++SI) {
if (*SI == '"')
Escaped += '\\';
@@ -120,8 +117,8 @@ struct DOTGraphTraits<ScopDetection*> :
// and adds a different background color for each group.
static void printRegionCluster(const ScopDetection *SD, const Region *R,
raw_ostream &O, unsigned depth = 0) {
- O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void*>(R)
- << " {\n";
+ O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void *>(R)
+ << " {\n";
std::string ErrorMessage = SD->regionIsInvalidBecause(R);
ErrorMessage = escapeString(ErrorMessage);
O.indent(2 * (depth + 1)) << "label = \"" << ErrorMessage << "\";\n";
@@ -140,8 +137,7 @@ struct DOTGraphTraits<ScopDetection*> :
if (color == 3)
color = 6;
- O.indent(2 * (depth + 1)) << "color = "
- << color << "\n";
+ O.indent(2 * (depth + 1)) << "color = " << color << "\n";
}
for (Region::const_iterator RI = R->begin(), RE = R->end(); RI != RE; ++RI)
@@ -150,57 +146,53 @@ struct DOTGraphTraits<ScopDetection*> :
RegionInfo *RI = R->getRegionInfo();
for (Region::const_block_iterator BI = R->block_begin(),
- BE = R->block_end(); BI != BE; ++BI)
+ BE = R->block_end();
+ BI != BE; ++BI)
if (RI->getRegionFor(*BI) == R)
- O.indent(2 * (depth + 1)) << "Node"
- << static_cast<const void*>(RI->getTopLevelRegion()->getBBNode(*BI))
- << ";\n";
+ O.indent(2 * (depth + 1))
+ << "Node" << static_cast<const void *>(
+ RI->getTopLevelRegion()->getBBNode(*BI)) << ";\n";
O.indent(2 * depth) << "}\n";
}
static void addCustomGraphFeatures(const ScopDetection *SD,
- GraphWriter<ScopDetection*> &GW) {
+ GraphWriter<ScopDetection *> &GW) {
raw_ostream &O = GW.getOStream();
O << "\tcolorscheme = \"paired12\"\n";
printRegionCluster(SD, SD->getRI()->getTopLevelRegion(), O, 4);
}
};
-} //end namespace llvm
+} //end namespace llvm
-struct ScopViewer
- : public DOTGraphTraitsViewer<ScopDetection, false> {
+struct ScopViewer : public DOTGraphTraitsViewer<ScopDetection, false> {
static char ID;
- ScopViewer() : DOTGraphTraitsViewer<ScopDetection, false>("scops", ID){}
+ ScopViewer() : DOTGraphTraitsViewer<ScopDetection, false>("scops", ID) {}
};
char ScopViewer::ID = 0;
-struct ScopOnlyViewer
- : public DOTGraphTraitsViewer<ScopDetection, true> {
+struct ScopOnlyViewer : public DOTGraphTraitsViewer<ScopDetection, true> {
static char ID;
ScopOnlyViewer()
- : DOTGraphTraitsViewer<ScopDetection, true>("scopsonly", ID){}
+ : DOTGraphTraitsViewer<ScopDetection, true>("scopsonly", ID) {}
};
char ScopOnlyViewer::ID = 0;
-struct ScopPrinter
- : public DOTGraphTraitsPrinter<ScopDetection, false> {
+struct ScopPrinter : public DOTGraphTraitsPrinter<ScopDetection, false> {
static char ID;
- ScopPrinter() :
- DOTGraphTraitsPrinter<ScopDetection, false>("scops", ID) {}
+ ScopPrinter() : DOTGraphTraitsPrinter<ScopDetection, false>("scops", ID) {}
};
char ScopPrinter::ID = 0;
-struct ScopOnlyPrinter
- : public DOTGraphTraitsPrinter<ScopDetection, true> {
+struct ScopOnlyPrinter : public DOTGraphTraitsPrinter<ScopDetection, true> {
static char ID;
- ScopOnlyPrinter() :
- DOTGraphTraitsPrinter<ScopDetection, true>("scopsonly", ID) {}
+ ScopOnlyPrinter()
+ : DOTGraphTraitsPrinter<ScopDetection, true>("scopsonly", ID) {}
};
char ScopOnlyPrinter::ID = 0;
static RegisterPass<ScopViewer>
-X("view-scops","Polly - View Scops of function");
+X("view-scops", "Polly - View Scops of function");
static RegisterPass<ScopOnlyViewer>
Y("view-scops-only",
@@ -213,18 +205,10 @@ static RegisterPass<ScopOnlyPrinter>
N("dot-scops-only",
"Polly - Print Scops of function (with no function bodies)");
-Pass *polly::createDOTViewerPass() {
- return new ScopViewer();
-}
-
-Pass *polly::createDOTOnlyViewerPass() {
- return new ScopOnlyViewer();
-}
-
-Pass *polly::createDOTPrinterPass() {
- return new ScopPrinter();
-}
-
-Pass *polly::createDOTOnlyPrinterPass() {
- return new ScopOnlyPrinter();
-}
+Pass *polly::createDOTViewerPass() { return new ScopViewer(); }
+
+Pass *polly::createDOTOnlyViewerPass() { return new ScopOnlyViewer(); }
+
+Pass *polly::createDOTPrinterPass() { return new ScopPrinter(); }
+
+Pass *polly::createDOTOnlyPrinterPass() { return new ScopOnlyPrinter(); }
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Mar 22 20:05:07 2013
@@ -95,8 +95,7 @@ public:
SCEVAffinator(const ScopStmt *Stmt)
: Ctx(Stmt->getIslCtx()), NbLoopSpaces(Stmt->getNumIterators()),
- S(Stmt->getParent()) {
- }
+ S(Stmt->getParent()) {}
__isl_give isl_pw_aff *visitConstant(const SCEVConstant *Constant) {
ConstantInt *Value = Constant->getValue();
@@ -588,7 +587,7 @@ ScopStmt::buildDomain(TempScop &tempScop
ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion,
BasicBlock &bb, SmallVectorImpl<Loop *> &Nest,
SmallVectorImpl<unsigned> &Scatter)
- : Parent(parent), BB(&bb), IVS(Nest.size()), NestLoops(Nest.size()) {
+ : Parent(parent), BB(&bb), IVS(Nest.size()), NestLoops(Nest.size()) {
// Setup the induction variables.
for (unsigned i = 0, e = Nest.size(); i < e; ++i) {
if (!SCEVCodegen) {
@@ -980,17 +979,15 @@ bool ScopInfo::runOnRegion(Region *R, RG
char ScopInfo::ID = 0;
+Pass *polly::createScopInfoPass() { return new ScopInfo(); }
+
INITIALIZE_PASS_BEGIN(ScopInfo, "polly-scops",
"Polly - Create polyhedral description of Scops", false,
- false)
-INITIALIZE_PASS_DEPENDENCY(LoopInfo)
-INITIALIZE_PASS_DEPENDENCY(RegionInfo)
-INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
-INITIALIZE_PASS_DEPENDENCY(TempScopInfo)
+ false);
+INITIALIZE_PASS_DEPENDENCY(LoopInfo);
+INITIALIZE_PASS_DEPENDENCY(RegionInfo);
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution);
+INITIALIZE_PASS_DEPENDENCY(TempScopInfo);
INITIALIZE_PASS_END(ScopInfo, "polly-scops",
"Polly - Create polyhedral description of Scops", false,
false)
-
-Pass *polly::createScopInfoPass() {
- return new ScopInfo();
-}
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Fri Mar 22 20:05:07 2013
@@ -73,8 +73,7 @@ void TempScop::print(raw_ostream &OS, Sc
void TempScop::printDetail(llvm::raw_ostream &OS, ScalarEvolution *SE,
LoopInfo *LI, const Region *CurR,
- unsigned ind) const {
-}
+ unsigned ind) const {}
void TempScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB) {
AccFuncSetType Functions;
@@ -106,7 +105,8 @@ void TempScopInfo::buildAccessFunctions(
Functions.push_back(
std::make_pair(IRAccess(Type, BasePointer->getValue(), AccessFunction,
- Size, IsAffine), &Inst));
+ Size, IsAffine),
+ &Inst));
}
}
@@ -164,7 +164,7 @@ void TempScopInfo::buildAffineCondition(
assert(ICmp && "Only ICmpInst of constant as condition supported!");
const SCEV *LHS = SE->getSCEV(ICmp->getOperand(0)),
- *RHS = SE->getSCEV(ICmp->getOperand(1));
+ *RHS = SE->getSCEV(ICmp->getOperand(1));
ICmpInst::Predicate Pred = ICmp->getPredicate();
@@ -245,7 +245,7 @@ TempScop *TempScopInfo::getTempScop(cons
return at == TempScops.end() ? 0 : at->second;
}
-void TempScopInfo::print(raw_ostream &OS, const Module *)const {
+void TempScopInfo::print(raw_ostream &OS, const Module *) const {
for (TempScopMapType::const_iterator I = TempScops.begin(),
E = TempScops.end();
I != E; ++I)
@@ -295,20 +295,18 @@ void TempScopInfo::clear() {
// TempScop information extraction pass implement
char TempScopInfo::ID = 0;
+Pass *polly::createTempScopInfoPass() { return new TempScopInfo(); }
+
INITIALIZE_PASS_BEGIN(TempScopInfo, "polly-analyze-ir",
"Polly - Analyse the LLVM-IR in the detected regions",
- false, false)
-INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
-INITIALIZE_PASS_DEPENDENCY(DominatorTree)
-INITIALIZE_PASS_DEPENDENCY(LoopInfo)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
-INITIALIZE_PASS_DEPENDENCY(RegionInfo)
-INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
-INITIALIZE_PASS_DEPENDENCY(DataLayout)
+ false, false);
+INITIALIZE_AG_DEPENDENCY(AliasAnalysis);
+INITIALIZE_PASS_DEPENDENCY(DominatorTree);
+INITIALIZE_PASS_DEPENDENCY(LoopInfo);
+INITIALIZE_PASS_DEPENDENCY(PostDominatorTree);
+INITIALIZE_PASS_DEPENDENCY(RegionInfo);
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution);
+INITIALIZE_PASS_DEPENDENCY(DataLayout);
INITIALIZE_PASS_END(TempScopInfo, "polly-analyze-ir",
"Polly - Analyse the LLVM-IR in the detected regions",
false, false)
-
-Pass *polly::createTempScopInfoPass() {
- return new TempScopInfo();
-}
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Fri Mar 22 20:05:07 2013
@@ -37,10 +37,9 @@ Aligned("enable-polly-aligned", cl::desc
cl::Hidden, cl::value_desc("OpenMP code generation enabled if true"),
cl::init(false), cl::ZeroOrMore);
-static cl::opt<bool, true>
-SCEVCodegenF("polly-codegen-scev", cl::desc("Use SCEV based code generation."),
- cl::Hidden, cl::location(SCEVCodegen), cl::init(false),
- cl::ZeroOrMore);
+static cl::opt<bool, true> SCEVCodegenF(
+ "polly-codegen-scev", cl::desc("Use SCEV based code generation."),
+ cl::Hidden, cl::location(SCEVCodegen), cl::init(false), cl::ZeroOrMore);
bool polly::SCEVCodegen;
@@ -62,7 +61,6 @@ bool polly::canSynthesize(const Instruct
return L && I == L->getCanonicalInductionVariable();
}
-
// Helper class to generate memory location.
namespace {
class IslGenerator {
@@ -181,7 +179,7 @@ Value *BlockGenerator::getNewValue(const
Value *New = GlobalMap[Old];
if (Old->getType()->getScalarSizeInBits() <
- New->getType()->getScalarSizeInBits())
+ New->getType()->getScalarSizeInBits())
New = Builder.CreateTruncOrBitCast(New, Old->getType());
return New;
@@ -312,8 +310,7 @@ Value *BlockGenerator::generateLocationA
return NewPointer;
}
-Loop *
-BlockGenerator::getLoopForInst(const llvm::Instruction *Inst) {
+Loop *BlockGenerator::getLoopForInst(const llvm::Instruction *Inst) {
return P->getAnalysis<LoopInfo>().getLoopFor(Inst->getParent());
}
@@ -390,9 +387,9 @@ VectorBlockGenerator::VectorBlockGenerat
assert(Schedule && "No statement domain provided");
}
-Value *VectorBlockGenerator::getVectorValue(
- const Value *Old, ValueMapT &VectorMap, VectorValueMapT &ScalarMaps,
- Loop *L) {
+Value *
+VectorBlockGenerator::getVectorValue(const Value *Old, ValueMapT &VectorMap,
+ VectorValueMapT &ScalarMaps, Loop *L) {
if (VectorMap.count(Old))
return VectorMap[Old];
Modified: polly/trunk/lib/CodeGen/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Cloog.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Cloog.cpp (original)
+++ polly/trunk/lib/CodeGen/Cloog.cpp Fri Mar 22 20:05:07 2013
@@ -330,7 +330,7 @@ bool CloogInfo::runOnScop(Scop &S) {
C = new Cloog(&S);
Function *F = S.getRegion().getEntry()->getParent();
- (void)F;
+ (void) F;
DEBUG(dbgs() << ":: " << F->getName());
DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n");
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Fri Mar 22 20:05:07 2013
@@ -193,7 +193,7 @@ Value *ClastExpCodeGen::codegen(const cl
}
ClastExpCodeGen::ClastExpCodeGen(IRBuilder<> &B, CharMapT &IVMap)
- : Builder(B), IVS(IVMap) {}
+ : Builder(B), IVS(IVMap) {}
Value *ClastExpCodeGen::codegen(const clast_expr *e, Type *Ty) {
switch (e->type) {
@@ -366,10 +366,9 @@ void ClastStmtCodeGen::codegen(const cla
ClastVars[a->LHS] = V;
}
-void ClastStmtCodeGen::codegen(const clast_assignment *A, ScopStmt *Stmt,
- unsigned Dim, int VectorDim,
- std::vector<ValueMapT> *VectorVMap,
- std::vector<LoopToScevMapT> *VLTS) {
+void ClastStmtCodeGen::codegen(
+ const clast_assignment *A, ScopStmt *Stmt, unsigned Dim, int VectorDim,
+ std::vector<ValueMapT> *VectorVMap, std::vector<LoopToScevMapT> *VLTS) {
Value *RHS;
assert(!A->LHS && "Statement assignments do not have left hand side");
@@ -970,8 +969,7 @@ void ClastStmtCodeGen::codegen(const cla
}
ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P)
- : S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) {
-}
+ : S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) {}
namespace {
class CodeGeneration : public ScopPass {
@@ -1040,9 +1038,7 @@ public:
char CodeGeneration::ID = 1;
-Pass *polly::createCodeGenerationPass() {
- return new CodeGeneration();
-}
+Pass *polly::createCodeGenerationPass() { return new CodeGeneration(); }
INITIALIZE_PASS_BEGIN(CodeGeneration, "polly-codegen",
"Polly - Create LLVM-IR from SCoPs", false, false);
@@ -1054,6 +1050,6 @@ INITIALIZE_PASS_DEPENDENCY(ScalarEvoluti
INITIALIZE_PASS_DEPENDENCY(ScopDetection);
INITIALIZE_PASS_DEPENDENCY(DataLayout);
INITIALIZE_PASS_END(CodeGeneration, "polly-codegen",
- "Polly - Create LLVM-IR from SCoPs", false, false)
+ "Polly - Create LLVM-IR from SCoPs", false, false)
#endif // CLOOG_FOUND
Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Fri Mar 22 20:05:07 2013
@@ -326,13 +326,12 @@ IslAst::IslAst(Scop *Scop, Dependences &
isl_union_map *Schedule = getSchedule();
Function *F = Scop->getRegion().getEntry()->getParent();
- (void)F;
+ (void) F;
DEBUG(dbgs() << ":: isl ast :: " << F->getName()
<< " :: " << Scop->getRegion().getNameStr() << "\n");
- DEBUG(dbgs() << S->getContextStr() << "\n";
- isl_union_map_dump(Schedule));
+ DEBUG(dbgs() << S->getContextStr() << "\n"; isl_union_map_dump(Schedule));
if (DetectParallel || PollyVectorizerChoice != VECTORIZER_NONE) {
BuildInfo.Deps = &D;
@@ -433,9 +432,9 @@ char IslAstInfo::ID = 0;
Pass *polly::createIslAstInfoPass() { return new IslAstInfo(); }
INITIALIZE_PASS_BEGIN(IslAstInfo, "polly-ast",
- "Generate an AST of the SCoP (isl)", false, false);
+ "Polly - Generate an AST of the SCoP (isl)", false,
+ false);
INITIALIZE_PASS_DEPENDENCY(ScopInfo);
INITIALIZE_PASS_DEPENDENCY(Dependences);
INITIALIZE_PASS_END(IslAstInfo, "polly-ast",
- "Generate an AST from the SCoP (isl)", false, false)
-
+ "Polly - Generate an AST from the SCoP (isl)", false, false)
Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Fri Mar 22 20:05:07 2013
@@ -126,7 +126,7 @@ void RuntimeDebugBuilder::createStrPrint
void RuntimeDebugBuilder::createIntPrinter(Value *V) {
IntegerType *Ty = dyn_cast<IntegerType>(V->getType());
- (void)Ty;
+ (void) Ty;
assert(Ty && Ty->getBitWidth() == 64 &&
"Cannot insert printer for this type.");
@@ -1080,4 +1080,3 @@ INITIALIZE_PASS_DEPENDENCY(ScalarEvoluti
INITIALIZE_PASS_DEPENDENCY(ScopDetection);
INITIALIZE_PASS_END(IslCodeGeneration, "polly-codegen-isl",
"Polly - Create LLVM-IR from SCoPs", false, false)
-
Modified: polly/trunk/lib/CodePreparation.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodePreparation.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/CodePreparation.cpp (original)
+++ polly/trunk/lib/CodePreparation.cpp Fri Mar 22 20:05:07 2013
@@ -183,4 +183,3 @@ INITIALIZE_PASS_BEGIN(CodePreparation, "
INITIALIZE_PASS_DEPENDENCY(LoopInfo);
INITIALIZE_PASS_END(CodePreparation, "polly-prepare",
"Polly - Prepare code for polly", false, false)
-
Modified: polly/trunk/lib/DeadCodeElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/DeadCodeElimination.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/DeadCodeElimination.cpp (original)
+++ polly/trunk/lib/DeadCodeElimination.cpp Fri Mar 22 20:05:07 2013
@@ -71,4 +71,3 @@ INITIALIZE_PASS_DEPENDENCY(Dependences);
INITIALIZE_PASS_DEPENDENCY(ScopInfo);
INITIALIZE_PASS_END(DeadCodeElim, "polly-dce", "Polly - Remove dead iterations",
false, false)
-
Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Fri Mar 22 20:05:07 2013
@@ -39,20 +39,18 @@
using namespace llvm;
using namespace polly;
-STATISTIC(NewAccessMapFound, "Number of updated access functions");
+STATISTIC(NewAccessMapFound, "Number of updated access functions");
namespace {
-static cl::opt<std::string>
-ImportDir("polly-import-jscop-dir",
- cl::desc("The directory to import the .jscop files from."),
- cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
- cl::init("."));
-
-static cl::opt<std::string>
-ImportPostfix("polly-import-jscop-postfix",
- cl::desc("Postfix to append to the import .jsop files."),
- cl::Hidden, cl::value_desc("File postfix"), cl::ValueRequired,
- cl::init(""));
+static cl::opt<std::string> ImportDir(
+ "polly-import-jscop-dir",
+ cl::desc("The directory to import the .jscop files from."), cl::Hidden,
+ cl::value_desc("Directory path"), cl::ValueRequired, cl::init("."));
+
+static cl::opt<std::string> ImportPostfix(
+ "polly-import-jscop-postfix",
+ cl::desc("Postfix to append to the import .jsop files."), cl::Hidden,
+ cl::value_desc("File postfix"), cl::ValueRequired, cl::init(""));
struct JSONExporter : public ScopPass {
static char ID;
@@ -82,15 +80,12 @@ struct JSONImporter : public ScopPass {
char JSONExporter::ID = 0;
std::string JSONExporter::getFileName(Scop *S) const {
- std::string FunctionName =
- S->getRegion().getEntry()->getParent()->getName();
+ std::string FunctionName = S->getRegion().getEntry()->getParent()->getName();
std::string FileName = FunctionName + "___" + S->getNameStr() + ".jscop";
return FileName;
}
-void JSONExporter::printScop(raw_ostream &OS) const {
- S->print(OS);
-}
+void JSONExporter::printScop(raw_ostream &OS) const { S->print(OS); }
Json::Value JSONExporter::getJSON(Scop &scop) const {
Json::Value root;
@@ -110,7 +105,8 @@ Json::Value JSONExporter::getJSON(Scop &
statement["accesses"];
for (ScopStmt::memacc_iterator MI = Stmt->memacc_begin(),
- ME = Stmt->memacc_end(); MI != ME; ++MI) {
+ ME = Stmt->memacc_end();
+ MI != ME; ++MI) {
Json::Value access;
access["kind"] = (*MI)->isRead() ? "read" : "write";
@@ -141,7 +137,7 @@ bool JSONExporter::runOnScop(Scop &scop)
std::string FunctionName = R.getEntry()->getParent()->getName();
errs() << "Writing JScop '" << R.getNameStr() << "' in function '"
- << FunctionName << "' to '" << FileName << "'.\n";
+ << FunctionName << "' to '" << FileName << "'.\n";
if (ErrInfo.empty()) {
F.os() << fileContent;
@@ -164,22 +160,11 @@ void JSONExporter::getAnalysisUsage(Anal
AU.addRequired<ScopInfo>();
}
-INITIALIZE_PASS_BEGIN(JSONExporter, "polly-export-jscop",
- "Polly - Export Scops as JSON"
- " (Writes a .jscop file for each Scop)", false, false)
-INITIALIZE_PASS_DEPENDENCY(Dependences)
-INITIALIZE_PASS_END(JSONExporter, "polly-export-jscop",
- "Polly - Export Scops as JSON"
- " (Writes a .jscop file for each Scop)", false, false)
-
-Pass *polly::createJSONExporterPass() {
- return new JSONExporter();
-}
+Pass *polly::createJSONExporterPass() { return new JSONExporter(); }
char JSONImporter::ID = 0;
std::string JSONImporter::getFileName(Scop *S) const {
- std::string FunctionName =
- S->getRegion().getEntry()->getParent()->getName();
+ std::string FunctionName = S->getRegion().getEntry()->getParent()->getName();
std::string FileName = FunctionName + "___" + S->getNameStr() + ".jscop";
if (ImportPostfix != "")
@@ -191,7 +176,8 @@ std::string JSONImporter::getFileName(Sc
void JSONImporter::printScop(raw_ostream &OS) const {
S->print(OS);
for (std::vector<std::string>::const_iterator I = newAccessStrings.begin(),
- E = newAccessStrings.end(); I != E; I++)
+ E = newAccessStrings.end();
+ I != E; I++)
OS << "New access function '" << *I << "'detected in JSCOP file\n";
}
@@ -206,7 +192,7 @@ bool JSONImporter::runOnScop(Scop &scop)
std::string FunctionName = R.getEntry()->getParent()->getName();
errs() << "Reading JScop '" << R.getNameStr() << "' in function '"
- << FunctionName << "' from '" << FileName << "'.\n";
+ << FunctionName << "' from '" << FileName << "'.\n";
OwningPtr<MemoryBuffer> result;
error_code ec = MemoryBuffer::getFile(FileName, result);
@@ -226,8 +212,8 @@ bool JSONImporter::runOnScop(Scop &scop)
}
isl_set *OldContext = S->getContext();
- isl_set *NewContext = isl_set_read_from_str(S->getIslCtx(),
- jscop["context"].asCString());
+ isl_set *NewContext =
+ isl_set_read_from_str(S->getIslCtx(), jscop["context"].asCString());
for (unsigned i = 0; i < isl_set_dim(OldContext, isl_dim_param); i++) {
isl_id *id = isl_set_get_dim_id(OldContext, isl_dim_param, i);
@@ -275,15 +261,16 @@ bool JSONImporter::runOnScop(Scop &scop)
int memoryAccessIdx = 0;
for (ScopStmt::memacc_iterator MI = Stmt->memacc_begin(),
- ME = Stmt->memacc_end(); MI != ME; ++MI) {
- Json::Value accesses = jscop["statements"][statementIdx]
- ["accesses"][memoryAccessIdx]["relation"];
- isl_map *newAccessMap = isl_map_read_from_str(S->getIslCtx(),
- accesses.asCString());
+ ME = Stmt->memacc_end();
+ MI != ME; ++MI) {
+ Json::Value accesses = jscop["statements"][statementIdx]["accesses"][
+ memoryAccessIdx]["relation"];
+ isl_map *newAccessMap =
+ isl_map_read_from_str(S->getIslCtx(), accesses.asCString());
isl_map *currentAccessMap = (*MI)->getAccessRelation();
if (isl_map_dim(newAccessMap, isl_dim_param) !=
- isl_map_dim(currentAccessMap, isl_dim_param)) {
+ isl_map_dim(currentAccessMap, isl_dim_param)) {
errs() << "JScop file changes the number of parameter dimensions\n";
isl_map_free(currentAccessMap);
isl_map_free(newAccessMap);
@@ -339,15 +326,27 @@ void JSONImporter::getAnalysisUsage(Anal
ScopPass::getAnalysisUsage(AU);
AU.addRequired<Dependences>();
}
+Pass *polly::createJSONImporterPass() { return new JSONImporter(); }
+
+INITIALIZE_PASS_BEGIN(JSONExporter, "polly-export-jscop",
+ "Polly - Export Scops as JSON"
+ " (Writes a .jscop file for each Scop)",
+ false, false);
+INITIALIZE_PASS_DEPENDENCY(Dependences);
+INITIALIZE_PASS_END(JSONExporter, "polly-export-jscop",
+ "Polly - Export Scops as JSON"
+ " (Writes a .jscop file for each Scop)",
+ false, false)
+
+ // typedef to make clang-format introduce a linebreak
+ typedef int clangformatdef;
INITIALIZE_PASS_BEGIN(JSONImporter, "polly-import-jscop",
"Polly - Import Scops from JSON"
- " (Reads a .jscop file for each Scop)", false, false)
-INITIALIZE_PASS_DEPENDENCY(Dependences)
+ " (Reads a .jscop file for each Scop)",
+ false, false);
+INITIALIZE_PASS_DEPENDENCY(Dependences);
INITIALIZE_PASS_END(JSONImporter, "polly-import-jscop",
"Polly - Import Scops from JSON"
- " (Reads a .jscop file for each Scop)", false, false)
-
-Pass *polly::createJSONImporterPass() {
- return new JSONImporter();
-}
+ " (Reads a .jscop file for each Scop)",
+ false, false)
Modified: polly/trunk/lib/Exchange/OpenScopExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/OpenScopExporter.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/OpenScopExporter.cpp (original)
+++ polly/trunk/lib/Exchange/OpenScopExporter.cpp Fri Mar 22 20:05:07 2013
@@ -58,7 +58,7 @@ class OpenScop {
Scop *PollyScop;
openscop_scop_p openscop;
- std::map<const Value*, int> ArrayMap;
+ std::map<const Value *, int> ArrayMap;
void initializeArrays();
void initializeParameters();
@@ -94,7 +94,7 @@ OpenScop::OpenScop(Scop *S) : PollyScop(
void OpenScop::initializeParameters() {
openscop->nb_parameters = PollyScop->getNumParams();
- openscop->parameters = new char*[openscop->nb_parameters];
+ openscop->parameters = new char *[openscop->nb_parameters];
for (int i = 0; i < openscop->nb_parameters; ++i) {
openscop->parameters[i] = new char[20];
@@ -108,7 +108,8 @@ void OpenScop::initializeArrays() {
for (Scop::iterator SI = PollyScop->begin(), SE = PollyScop->end(); SI != SE;
++SI)
for (ScopStmt::memacc_iterator MI = (*SI)->memacc_begin(),
- ME = (*SI)->memacc_end(); MI != ME; ++MI) {
+ ME = (*SI)->memacc_end();
+ MI != ME; ++MI) {
const Value *BaseAddr = (*MI)->getBaseAddr();
if (ArrayMap.find(BaseAddr) == ArrayMap.end()) {
ArrayMap.insert(std::make_pair(BaseAddr, nb_arrays));
@@ -117,11 +118,12 @@ void OpenScop::initializeArrays() {
}
openscop->nb_arrays = nb_arrays;
- openscop->arrays = new char*[nb_arrays];
+ openscop->arrays = new char *[nb_arrays];
for (int i = 0; i < nb_arrays; ++i)
- for (std::map<const Value*, int>::iterator VI = ArrayMap.begin(),
- VE = ArrayMap.end(); VI != VE; ++VI)
+ for (std::map<const Value *, int>::iterator VI = ArrayMap.begin(),
+ VE = ArrayMap.end();
+ VI != VE; ++VI)
if ((*VI).second == i) {
const Value *V = (*VI).first;
std::string name = V->getName();
@@ -132,7 +134,7 @@ void OpenScop::initializeArrays() {
void OpenScop::initializeScattering() {
openscop->nb_scattdims = PollyScop->getScatterDim();
- openscop->scattdims = new char*[openscop->nb_scattdims];
+ openscop->scattdims = new char *[openscop->nb_scattdims];
for (int i = 0; i < openscop->nb_scattdims; ++i) {
openscop->scattdims[i] = new char[20];
@@ -151,15 +153,14 @@ openscop_statement_p OpenScop::initializ
isl_set_free(domain);
isl_map_free(Scattering);
-
// Statement name
const char *entryName = stmt->getBaseName();
- Stmt->body = (char*)malloc(sizeof(char) * (strlen(entryName) + 1));
+ Stmt->body = (char *)malloc(sizeof(char) * (strlen(entryName) + 1));
strcpy(Stmt->body, entryName);
// Iterator names
Stmt->nb_iterators = isl_set_n_dim(stmt->getDomain());
- Stmt->iterators = new char*[Stmt->nb_iterators];
+ Stmt->iterators = new char *[Stmt->nb_iterators];
for (int i = 0; i < Stmt->nb_iterators; ++i) {
Stmt->iterators[i] = new char[20];
@@ -213,9 +214,7 @@ void OpenScop::freeStatement(openscop_st
openscop_statement_free(stmt);
}
-void OpenScop::print(FILE *F) {
- openscop_scop_print_dot_scop(F, openscop);
-}
+void OpenScop::print(FILE *F) { openscop_scop_print_dot_scop(F, openscop); }
/// Add an isl constraint to an OpenScop matrix.
///
@@ -286,8 +285,8 @@ openscop_matrix_p OpenScop::domainToMatr
// Create a canonical copy of this set.
isl_set *set = isl_set_copy(PS);
- set = isl_set_compute_divs (set);
- set = isl_set_align_divs (set);
+ set = isl_set_compute_divs(set);
+ set = isl_set_align_divs(set);
// Initialize the matrix.
unsigned NbRows, NbColumns;
@@ -318,7 +317,7 @@ int OpenScop::scatteringToMatrix_constra
assert(!nb_div && "Existentially quantified variables not yet supported");
openscop_vector_p vec =
- openscop_vector_malloc(nb_params + nb_in + nb_out + 2);
+ openscop_vector_malloc(nb_params + nb_in + nb_out + 2);
// Assign type
if (isl_constraint_is_equality(c))
@@ -380,14 +379,14 @@ openscop_matrix_p OpenScop::scatteringTo
// Create a canonical copy of this set.
isl_map *map = isl_map_copy(pmap);
- map = isl_map_compute_divs (map);
- map = isl_map_align_divs (map);
+ map = isl_map_compute_divs(map);
+ map = isl_map_align_divs(map);
// Initialize the matrix.
unsigned NbRows, NbColumns;
NbRows = 0;
- NbColumns = isl_map_n_in(pmap) + isl_map_n_out(pmap) + isl_map_n_param(pmap)
- + 2;
+ NbColumns =
+ isl_map_n_in(pmap) + isl_map_n_out(pmap) + isl_map_n_param(pmap) + 2;
openscop_matrix_p matrix = openscop_matrix_malloc(NbRows, NbColumns);
// Copy the content into the matrix.
@@ -411,8 +410,7 @@ int OpenScop::accessToMatrix_constraint(
assert(!nb_div && "Existentially quantified variables not yet supported");
- openscop_vector_p vec =
- openscop_vector_malloc(nb_params + nb_in + 2);
+ openscop_vector_p vec = openscop_vector_malloc(nb_params + nb_in + 2);
isl_int v;
isl_int_init(v);
@@ -420,13 +418,14 @@ int OpenScop::accessToMatrix_constraint(
// The access dimension has to be one.
isl_constraint_get_coefficient(c, isl_space_out, 0, &v);
assert(isl_int_is_one(v));
- bool inverse = true ;
+ bool inverse = true;
// Assign variables
for (int i = 0; i < nb_in; ++i) {
isl_constraint_get_coefficient(c, isl_space_in, i, &v);
- if (inverse) isl_int_neg(v,v);
+ if (inverse)
+ isl_int_neg(v, v);
isl_int_set(vec->p[i + 1], v);
}
@@ -435,7 +434,8 @@ int OpenScop::accessToMatrix_constraint(
for (int i = 0; i < nb_params; ++i) {
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
- if (inverse) isl_int_neg(v,v);
+ if (inverse)
+ isl_int_neg(v, v);
isl_int_set(vec->p[nb_in + i + 1], v);
}
@@ -443,7 +443,8 @@ int OpenScop::accessToMatrix_constraint(
// Assign constant
isl_constraint_get_constant(c, &v);
- if (inverse) isl_int_neg(v,v);
+ if (inverse)
+ isl_int_neg(v, v);
isl_int_set(vec->p[nb_in + nb_params + 1], v);
@@ -452,7 +453,6 @@ int OpenScop::accessToMatrix_constraint(
return 0;
}
-
/// Add an isl basic map to a OpenScop matrix_list
///
/// @param bmap The basic map to add
@@ -487,8 +487,8 @@ openscop_matrix_p OpenScop::createAccess
&accessToMatrix_basic_map, m);
// Set the index of the memory access base element.
- std::map<const Value*, int>::iterator BA =
- ArrayMap.find((*MI)->getBaseAddr());
+ std::map<const Value *, int>::iterator BA =
+ ArrayMap.find((*MI)->getBaseAddr());
isl_int_set_si(m->p[m->NbRows - 1][0], (*BA).second + 1);
}
@@ -536,15 +536,12 @@ OpenScop::~OpenScop() {
}
std::string ScopExporter::getFileName(Scop *S) const {
- std::string FunctionName =
- S->getRegion().getEntry()->getParent()->getName();
+ std::string FunctionName = S->getRegion().getEntry()->getParent()->getName();
std::string FileName = FunctionName + "___" + S->getNameStr() + ".scop";
return FileName;
}
-void ScopExporter::printScop(raw_ostream &OS) const {
- S->print(OS);
-}
+void ScopExporter::printScop(raw_ostream &OS) const { S->print(OS); }
bool ScopExporter::runOnScop(Scop &scop) {
S = &scop;
@@ -565,7 +562,7 @@ bool ScopExporter::runOnScop(Scop &scop)
std::string FunctionName = R.getEntry()->getParent()->getName();
errs() << "Writing Scop '" << R.getNameStr() << "' in function '"
- << FunctionName << "' to '" << FileName << "'.\n";
+ << FunctionName << "' to '" << FileName << "'.\n";
return false;
}
@@ -574,14 +571,10 @@ void ScopExporter::getAnalysisUsage(Anal
ScopPass::getAnalysisUsage(AU);
}
-static RegisterPass<ScopExporter> A("polly-export",
- "Polly - Export Scops with OpenScop library"
- " (Writes a .scop file for each Scop)"
- );
+static RegisterPass<ScopExporter>
+A("polly-export", "Polly - Export Scops with OpenScop library"
+ " (Writes a .scop file for each Scop)");
-Pass *polly::createScopExporterPass() {
- return new ScopExporter();
-}
+Pass *polly::createScopExporterPass() { return new ScopExporter(); }
#endif
-
Modified: polly/trunk/lib/Exchange/OpenScopImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/OpenScopImporter.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/OpenScopImporter.cpp (original)
+++ polly/trunk/lib/Exchange/OpenScopImporter.cpp Fri Mar 22 20:05:07 2013
@@ -34,29 +34,27 @@ using namespace llvm;
using namespace polly;
namespace {
- static cl::opt<std::string>
- ImportDir("polly-import-dir",
- cl::desc("The directory to import the .scop files from."),
- cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
- cl::init("."));
- static cl::opt<std::string>
- ImportPostfix("polly-import-postfix",
- cl::desc("Postfix to append to the import .scop files."),
- cl::Hidden, cl::value_desc("File postfix"), cl::ValueRequired,
- cl::init(""));
-
- struct ScopImporter : public ScopPass {
- static char ID;
- Scop *S;
- Dependences *D;
- explicit ScopImporter() : ScopPass(ID) {}
- bool updateScattering(Scop *S, openscop_scop_p OScop);
-
- std::string getFileName(Scop *S) const;
- virtual bool runOnScop(Scop &S);
- virtual void printScop(raw_ostream &OS) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
- };
+static cl::opt<std::string>
+ImportDir("polly-import-dir",
+ cl::desc("The directory to import the .scop files from."), cl::Hidden,
+ cl::value_desc("Directory path"), cl::ValueRequired, cl::init("."));
+static cl::opt<std::string> ImportPostfix(
+ "polly-import-postfix",
+ cl::desc("Postfix to append to the import .scop files."), cl::Hidden,
+ cl::value_desc("File postfix"), cl::ValueRequired, cl::init(""));
+
+struct ScopImporter : public ScopPass {
+ static char ID;
+ Scop *S;
+ Dependences *D;
+ explicit ScopImporter() : ScopPass(ID) {}
+ bool updateScattering(Scop *S, openscop_scop_p OScop);
+
+ std::string getFileName(Scop *S) const;
+ virtual bool runOnScop(Scop &S);
+ virtual void printScop(raw_ostream &OS) const;
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+};
}
char ScopImporter::ID = 0;
@@ -88,7 +86,8 @@ isl_constraint *constraintFromMatrixRow(
isl_constraint_set_coefficient(c, isl_space_in, j, row[current_column++]);
for (unsigned j = 0; j < NbParam; ++j)
- isl_constraint_set_coefficient(c, isl_space_param, j, row[current_column++]);
+ isl_constraint_set_coefficient(c, isl_space_param, j,
+ row[current_column++]);
isl_constraint_set_constant(c, row[current_column]);
@@ -181,7 +180,7 @@ bool ScopImporter::updateScattering(Scop
if (!D->isValidScattering(NewScattering)) {
errs() << "OpenScop file contains a scattering that changes the "
- << "dependences. Use -disable-polly-legality to continue anyways\n";
+ << "dependences. Use -disable-polly-legality to continue anyways\n";
return false;
}
@@ -195,15 +194,12 @@ bool ScopImporter::updateScattering(Scop
return true;
}
std::string ScopImporter::getFileName(Scop *S) const {
- std::string FunctionName =
- S->getRegion().getEntry()->getParent()->getName();
+ std::string FunctionName = S->getRegion().getEntry()->getParent()->getName();
std::string FileName = FunctionName + "___" + S->getNameStr() + ".scop";
return FileName;
}
-void ScopImporter::printScop(raw_ostream &OS) const {
- S->print(OS);
-}
+void ScopImporter::printScop(raw_ostream &OS) const { S->print(OS); }
bool ScopImporter::runOnScop(Scop &scop) {
S = &scop;
@@ -224,12 +220,13 @@ bool ScopImporter::runOnScop(Scop &scop)
std::string FunctionName = R.getEntry()->getParent()->getName();
errs() << "Reading Scop '" << R.getNameStr() << "' in function '"
- << FunctionName << "' from '" << FileName << "'.\n";
+ << FunctionName << "' from '" << FileName << "'.\n";
bool UpdateSuccessfull = updateScattering(S, openscop);
if (!UpdateSuccessfull) {
- errs() << "Update failed" << "\n";
+ errs() << "Update failed"
+ << "\n";
}
return false;
@@ -240,13 +237,10 @@ void ScopImporter::getAnalysisUsage(Anal
AU.addRequired<Dependences>();
}
-static RegisterPass<ScopImporter> A("polly-import",
- "Polly - Import Scops with OpenScop library"
- " (Reads a .scop file for each Scop)"
- );
+static RegisterPass<ScopImporter>
+A("polly-import", "Polly - Import Scops with OpenScop library"
+ " (Reads a .scop file for each Scop)");
-Pass *polly::createScopImporterPass() {
- return new ScopImporter();
-}
+Pass *polly::createScopImporterPass() { return new ScopImporter(); }
#endif
Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Fri Mar 22 20:05:07 2013
@@ -46,10 +46,11 @@ ScopLib::ScopLib(Scop *S, FILE *F, Depen
void ScopLib::initializeParameters() {
scoplib->nb_parameters = PollyScop->getNumParams();
- scoplib->parameters = (char**) malloc(sizeof(char*) * scoplib->nb_parameters);
+ scoplib->parameters =
+ (char **)malloc(sizeof(char *) * scoplib->nb_parameters);
for (int i = 0; i < scoplib->nb_parameters; ++i) {
- scoplib->parameters[i] = (char *) malloc(sizeof(char*) * 20);
+ scoplib->parameters[i] = (char *)malloc(sizeof(char *) * 20);
sprintf(scoplib->parameters[i], "p_%d", i);
}
}
@@ -60,7 +61,8 @@ void ScopLib::initializeArrays() {
for (Scop::iterator SI = PollyScop->begin(), SE = PollyScop->end(); SI != SE;
++SI)
for (ScopStmt::memacc_iterator MI = (*SI)->memacc_begin(),
- ME = (*SI)->memacc_end(); MI != ME; ++MI) {
+ ME = (*SI)->memacc_end();
+ MI != ME; ++MI) {
const Value *BaseAddr = (*MI)->getBaseAddr();
if (ArrayMap.find(BaseAddr) == ArrayMap.end()) {
ArrayMap.insert(std::make_pair(BaseAddr, nb_arrays));
@@ -69,21 +71,21 @@ void ScopLib::initializeArrays() {
}
scoplib->nb_arrays = nb_arrays;
- scoplib->arrays = (char**)malloc(sizeof(char*) * nb_arrays);
+ scoplib->arrays = (char **)malloc(sizeof(char *) * nb_arrays);
for (int i = 0; i < nb_arrays; ++i)
- for (std::map<const Value*, int>::iterator VI = ArrayMap.begin(),
- VE = ArrayMap.end(); VI != VE; ++VI)
+ for (std::map<const Value *, int>::iterator VI = ArrayMap.begin(),
+ VE = ArrayMap.end();
+ VI != VE; ++VI)
if ((*VI).second == i) {
const Value *V = (*VI).first;
std::string name = V->getName();
- scoplib->arrays[i] = (char*) malloc(sizeof(char*) * (name.size() + 1));
+ scoplib->arrays[i] = (char *)malloc(sizeof(char *) * (name.size() + 1));
strcpy(scoplib->arrays[i], name.c_str());
}
}
-void ScopLib::initializeScattering() {
-}
+void ScopLib::initializeScattering() {}
scoplib_statement_p ScopLib::initializeStatement(ScopStmt *stmt) {
scoplib_statement_p Stmt = scoplib_statement_malloc();
@@ -98,15 +100,15 @@ scoplib_statement_p ScopLib::initializeS
raw_string_ostream OS(entryName);
WriteAsOperand(OS, stmt->getBasicBlock(), false);
entryName = OS.str();
- Stmt->body = (char*)malloc(sizeof(char) * (entryName.size() + 1));
+ Stmt->body = (char *)malloc(sizeof(char) * (entryName.size() + 1));
strcpy(Stmt->body, entryName.c_str());
// Iterator names
Stmt->nb_iterators = stmt->getNumIterators();
- Stmt->iterators = (char**) malloc(sizeof(char*) * Stmt->nb_iterators);
+ Stmt->iterators = (char **)malloc(sizeof(char *) * Stmt->nb_iterators);
for (int i = 0; i < Stmt->nb_iterators; ++i) {
- Stmt->iterators[i] = (char*) malloc(sizeof(char*) * 20);
+ Stmt->iterators[i] = (char *)malloc(sizeof(char *) * 20);
sprintf(Stmt->iterators[i], "i_%d", i);
}
@@ -161,9 +163,7 @@ void ScopLib::freeStatement(scoplib_stat
scoplib_statement_free(stmt);
}
-void ScopLib::print(FILE *F) {
- scoplib_scop_print_dot_scop(F, scoplib);
-}
+void ScopLib::print(FILE *F) { scoplib_scop_print_dot_scop(F, scoplib); }
/// Add an isl constraint to an ScopLib matrix.
///
@@ -180,7 +180,6 @@ int ScopLib::domainToMatrix_constraint(i
scoplib_vector_p vec = scoplib_vector_malloc(nb_params + nb_vars + 2);
-
// Assign type
if (isl_constraint_is_equality(c))
scoplib_vector_tag_equality(vec);
@@ -237,8 +236,8 @@ int ScopLib::domainToMatrix_basic_set(is
/// @param PS The set to be translated
/// @return A ScopLib Matrix
scoplib_matrix_p ScopLib::domainToMatrix(__isl_take isl_set *set) {
- set = isl_set_compute_divs (set);
- set = isl_set_align_divs (set);
+ set = isl_set_compute_divs(set);
+ set = isl_set_align_divs(set);
// Initialize the matrix.
unsigned NbRows, NbColumns;
@@ -267,8 +266,7 @@ int ScopLib::scatteringToMatrix_constrai
assert(!nb_div && "Existentially quantified variables not yet supported");
- scoplib_vector_p vec =
- scoplib_vector_malloc(nb_params + nb_in + 2);
+ scoplib_vector_p vec = scoplib_vector_malloc(nb_params + nb_in + 2);
// Assign type
if (isl_constraint_is_equality(c))
@@ -295,8 +293,7 @@ int ScopLib::scatteringToMatrix_constrai
isl_constraint_get_constant(c, &v);
isl_int_set(vec->p[nb_in + nb_params + 1], v);
- scoplib_vector_p null =
- scoplib_vector_malloc(nb_params + nb_in + 2);
+ scoplib_vector_p null = scoplib_vector_malloc(nb_params + nb_in + 2);
vec = scoplib_vector_sub(null, vec);
scoplib_matrix_insert_vector(m, vec, 0);
@@ -329,8 +326,8 @@ int ScopLib::scatteringToMatrix_basic_ma
/// @param map The map to be translated
/// @return A ScopLib Matrix
scoplib_matrix_p ScopLib::scatteringToMatrix(__isl_take isl_map *map) {
- map = isl_map_compute_divs (map);
- map = isl_map_align_divs (map);
+ map = isl_map_compute_divs(map);
+ map = isl_map_align_divs(map);
// Initialize the matrix.
unsigned NbRows, NbColumns;
@@ -342,10 +339,10 @@ scoplib_matrix_p ScopLib::scatteringToMa
isl_map_foreach_basic_map(map, &scatteringToMatrix_basic_map, matrix);
// Only keep the relevant rows.
- scoplib_matrix_p reduced = scoplib_matrix_ncopy(matrix,
- isl_map_n_in(map) * 2 + 1);
+ scoplib_matrix_p reduced =
+ scoplib_matrix_ncopy(matrix, isl_map_n_in(map) * 2 + 1);
- scoplib_matrix_free (matrix);
+ scoplib_matrix_free(matrix);
isl_map_free(map);
return reduced;
@@ -364,23 +361,23 @@ int ScopLib::accessToMatrix_constraint(i
assert(!nb_div && "Existentially quantified variables not yet supported");
- scoplib_vector_p vec =
- scoplib_vector_malloc(nb_params + nb_in + 2);
+ scoplib_vector_p vec = scoplib_vector_malloc(nb_params + nb_in + 2);
isl_int v;
isl_int_init(v);
// The access dimension has to be one.
isl_constraint_get_coefficient(c, isl_dim_out, 0, &v);
- assert((isl_int_is_one(v) || isl_int_is_negone(v))
- && "Access relations not supported in scoplib");
+ assert((isl_int_is_one(v) || isl_int_is_negone(v)) &&
+ "Access relations not supported in scoplib");
bool inverse = isl_int_is_one(v);
// Assign variables
for (int i = 0; i < nb_in; ++i) {
isl_constraint_get_coefficient(c, isl_dim_in, i, &v);
- if (inverse) isl_int_neg(v,v);
+ if (inverse)
+ isl_int_neg(v, v);
isl_int_set(vec->p[i + 1], v);
}
@@ -389,7 +386,8 @@ int ScopLib::accessToMatrix_constraint(i
for (int i = 0; i < nb_params; ++i) {
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
- if (inverse) isl_int_neg(v,v);
+ if (inverse)
+ isl_int_neg(v, v);
isl_int_set(vec->p[nb_in + i + 1], v);
}
@@ -397,7 +395,8 @@ int ScopLib::accessToMatrix_constraint(i
// Assign constant
isl_constraint_get_constant(c, &v);
- if (inverse) isl_int_neg(v,v);
+ if (inverse)
+ isl_int_neg(v, v);
isl_int_set(vec->p[nb_in + nb_params + 1], v);
@@ -409,7 +408,6 @@ int ScopLib::accessToMatrix_constraint(i
return 0;
}
-
/// Add an isl basic map to a ScopLib matrix_list
///
/// @param bmap The basic map to add
@@ -442,13 +440,12 @@ scoplib_matrix_p ScopLib::createAccessMa
if ((*MI)->isRead() == isRead) {
// Extract the access function.
isl_map *AccessRelation = (*MI)->getAccessRelation();
- isl_map_foreach_basic_map(AccessRelation,
- &accessToMatrix_basic_map, m);
+ isl_map_foreach_basic_map(AccessRelation, &accessToMatrix_basic_map, m);
isl_map_free(AccessRelation);
// Set the index of the memory access base element.
- std::map<const Value*, int>::iterator BA =
- ArrayMap.find((*MI)->getBaseAddr());
+ std::map<const Value *, int>::iterator BA =
+ ArrayMap.find((*MI)->getBaseAddr());
isl_int_set_si(m->p[m->NbRows - 1][0], (*BA).second + 1);
}
@@ -495,8 +492,8 @@ ScopLib::~ScopLib() {
/// @param Space An isl space object, describing how to spilt the dimensions.
///
/// @return An isl constraint representing this integer array.
-isl_constraint *constraintFromMatrixRow(isl_int *row,
- __isl_take isl_space *Space) {
+isl_constraint *
+constraintFromMatrixRow(isl_int *row, __isl_take isl_space *Space) {
isl_constraint *c;
unsigned NbIn = isl_space_dim(Space, isl_dim_in);
@@ -566,8 +563,8 @@ isl_map *mapFromMatrix(scoplib_matrix_p
/// @param Space An isl space object, describing how to spilt the dimensions.
///
/// @return An isl constraint representing this integer array.
-isl_constraint *constraintFromMatrixRowFull(isl_int *row,
- __isl_take isl_space *Space) {
+isl_constraint *
+constraintFromMatrixRowFull(isl_int *row, __isl_take isl_space *Space) {
isl_constraint *c;
unsigned NbOut = isl_space_dim(Space, isl_dim_out);
@@ -624,8 +621,8 @@ isl_map *mapFromMatrix(scoplib_matrix_p
/// @param PollyStmt The statement to create the scattering for.
///
/// @return An isl_map describing the scattering.
-isl_map *scatteringForStmt(scoplib_matrix_p m, ScopStmt *PollyStmt,
- int scatteringDims) {
+isl_map *
+scatteringForStmt(scoplib_matrix_p m, ScopStmt *PollyStmt, int scatteringDims) {
unsigned NbParam = PollyStmt->getNumParams();
unsigned NbIterators = PollyStmt->getNumIterators();
@@ -644,8 +641,7 @@ isl_map *scatteringForStmt(scoplib_matri
// We need to copy the isl_ids for the parameter dimensions to the new
// map. Without doing this the current map would have different
// ids then the new one, even though both are named identically.
- for (unsigned i = 0; i < isl_space_dim(Space, isl_dim_param);
- i++) {
+ for (unsigned i = 0; i < isl_space_dim(Space, isl_dim_param); i++) {
isl_id *id = isl_space_get_dim_id(ParamSpace, isl_dim_param, i);
Space = isl_space_set_dim_id(Space, isl_dim_param, i, id);
}
@@ -697,8 +693,8 @@ StatementToIslMapTy *readScattering(Scop
int numScatteringDims = -1;
ScopStmt *pollyStmt = *S->begin();
- if (stmt->schedule->NbColumns
- == 2 + pollyStmt->getNumParams() + pollyStmt->getNumIterators()) {
+ if (stmt->schedule->NbColumns ==
+ 2 + pollyStmt->getNumParams() + pollyStmt->getNumIterators()) {
numScatteringDims = maxScattering(stmt);
}
@@ -709,8 +705,8 @@ StatementToIslMapTy *readScattering(Scop
return NULL;
}
- NewScattering[*SI] = scatteringForStmt(stmt->schedule, *SI,
- numScatteringDims);
+ NewScattering[*SI] =
+ scatteringForStmt(stmt->schedule, *SI, numScatteringDims);
stmt = stmt->next;
}
@@ -737,7 +733,7 @@ bool ScopLib::updateScattering() {
if (!D->isValidScattering(NewScattering)) {
freeStmtToIslMap(NewScattering);
errs() << "OpenScop file contains a scattering that changes the "
- << "dependences. Use -disable-polly-legality to continue anyways\n";
+ << "dependences. Use -disable-polly-legality to continue anyways\n";
return false;
}
Modified: polly/trunk/lib/Exchange/ScopLibExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLibExporter.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLibExporter.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLibExporter.cpp Fri Mar 22 20:05:07 2013
@@ -30,31 +30,29 @@ using namespace llvm;
using namespace polly;
namespace {
- static cl::opt<std::string>
- ExportDir("polly-export-scoplib-dir",
- cl::desc("The directory to export the .scoplib files to."),
- cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
- cl::init("."));
-
- class ScopLibExporter : public ScopPass {
- Scop *S;
-
- std::string getFileName(Scop *S) const;
- public:
- static char ID;
- explicit ScopLibExporter() : ScopPass(ID) {}
-
- virtual bool runOnScop(Scop &scop);
- void getAnalysisUsage(AnalysisUsage &AU) const;
- };
+static cl::opt<std::string> ExportDir(
+ "polly-export-scoplib-dir",
+ cl::desc("The directory to export the .scoplib files to."), cl::Hidden,
+ cl::value_desc("Directory path"), cl::ValueRequired, cl::init("."));
+
+class ScopLibExporter : public ScopPass {
+ Scop *S;
+
+ std::string getFileName(Scop *S) const;
+public:
+ static char ID;
+ explicit ScopLibExporter() : ScopPass(ID) {}
+
+ virtual bool runOnScop(Scop &scop);
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+};
}
char ScopLibExporter::ID = 0;
std::string ScopLibExporter::getFileName(Scop *S) const {
- std::string FunctionName =
- S->getRegion().getEntry()->getParent()->getName();
+ std::string FunctionName = S->getRegion().getEntry()->getParent()->getName();
std::string FileName = FunctionName + "___" + S->getNameStr() + ".scoplib";
return FileName;
}
@@ -78,7 +76,7 @@ bool ScopLibExporter::runOnScop(Scop &sc
std::string FunctionName = R->getEntry()->getParent()->getName();
errs() << "Writing Scop '" << R->getNameStr() << "' in function '"
- << FunctionName << "' to '" << FileName << "'.\n";
+ << FunctionName << "' to '" << FileName << "'.\n";
return false;
}
@@ -87,13 +85,10 @@ void ScopLibExporter::getAnalysisUsage(A
ScopPass::getAnalysisUsage(AU);
}
-static RegisterPass<ScopLibExporter> A("polly-export-scoplib",
- "Polly - Export Scops with ScopLib library"
- " (Writes a .scoplib file for each Scop)"
- );
+static RegisterPass<ScopLibExporter>
+A("polly-export-scoplib", "Polly - Export Scops with ScopLib library"
+ " (Writes a .scoplib file for each Scop)");
-Pass *polly::createScopLibExporterPass() {
- return new ScopLibExporter();
-}
+Pass *polly::createScopLibExporterPass() { return new ScopLibExporter(); }
#endif
Modified: polly/trunk/lib/Exchange/ScopLibImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLibImporter.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLibImporter.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLibImporter.cpp Fri Mar 22 20:05:07 2013
@@ -32,37 +32,34 @@ using namespace llvm;
using namespace polly;
namespace {
- static cl::opt<std::string>
- ImportDir("polly-import-scoplib-dir",
- cl::desc("The directory to import the .scoplib files from."),
- cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
- cl::init("."));
- static cl::opt<std::string>
- ImportPostfix("polly-import-scoplib-postfix",
- cl::desc("Postfix to append to the import .scoplib files."),
- cl::Hidden, cl::value_desc("File postfix"), cl::ValueRequired,
- cl::init(""));
-
- struct ScopLibImporter : public RegionPass {
- static char ID;
- Scop *S;
- Dependences *D;
- explicit ScopLibImporter() : RegionPass(ID) {}
-
- bool updateScattering(Scop *S, scoplib_scop_p OScop);
- std::string getFileName(Scop *S) const;
- virtual bool runOnRegion(Region *R, RGPassManager &RGM);
- virtual void print(raw_ostream &OS, const Module *) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
- };
+static cl::opt<std::string> ImportDir(
+ "polly-import-scoplib-dir",
+ cl::desc("The directory to import the .scoplib files from."), cl::Hidden,
+ cl::value_desc("Directory path"), cl::ValueRequired, cl::init("."));
+static cl::opt<std::string> ImportPostfix(
+ "polly-import-scoplib-postfix",
+ cl::desc("Postfix to append to the import .scoplib files."), cl::Hidden,
+ cl::value_desc("File postfix"), cl::ValueRequired, cl::init(""));
+
+struct ScopLibImporter : public RegionPass {
+ static char ID;
+ Scop *S;
+ Dependences *D;
+ explicit ScopLibImporter() : RegionPass(ID) {}
+
+ bool updateScattering(Scop *S, scoplib_scop_p OScop);
+ std::string getFileName(Scop *S) const;
+ virtual bool runOnRegion(Region *R, RGPassManager &RGM);
+ virtual void print(raw_ostream &OS, const Module *) const;
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+};
}
char ScopLibImporter::ID = 0;
namespace {
std::string ScopLibImporter::getFileName(Scop *S) const {
- std::string FunctionName =
- S->getRegion().getEntry()->getParent()->getName();
+ std::string FunctionName = S->getRegion().getEntry()->getParent()->getName();
std::string FileName = FunctionName + "___" + S->getNameStr() + ".scoplib";
return FileName;
}
@@ -87,14 +84,15 @@ bool ScopLibImporter::runOnRegion(Region
std::string FunctionName = R->getEntry()->getParent()->getName();
errs() << "Reading Scop '" << R->getNameStr() << "' in function '"
- << FunctionName << "' from '" << FileName << "'.\n";
+ << FunctionName << "' from '" << FileName << "'.\n";
ScopLib scoplib(S, F, D);
bool UpdateSuccessfull = scoplib.updateScattering();
fclose(F);
if (!UpdateSuccessfull) {
- errs() << "Update failed" << "\n";
+ errs() << "Update failed"
+ << "\n";
}
return false;
@@ -108,13 +106,10 @@ void ScopLibImporter::getAnalysisUsage(A
}
-static RegisterPass<ScopLibImporter> A("polly-import-scoplib",
- "Polly - Import Scops with ScopLib library"
- " (Reads a .scoplib file for each Scop)"
- );
+static RegisterPass<ScopLibImporter>
+A("polly-import-scoplib", "Polly - Import Scops with ScopLib library"
+ " (Reads a .scoplib file for each Scop)");
-Pass *polly::createScopLibImporterPass() {
- return new ScopLibImporter();
-}
+Pass *polly::createScopLibImporterPass() { return new ScopLibImporter(); }
#endif
Modified: polly/trunk/lib/MayAliasSet.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/MayAliasSet.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/MayAliasSet.cpp (original)
+++ polly/trunk/lib/MayAliasSet.cpp Fri Mar 22 20:05:07 2013
@@ -29,7 +29,7 @@ using namespace polly;
void MayAliasSet::print(raw_ostream &OS) const {
OS << "Must alias {";
-
+
for (const_iterator I = mustalias_begin(), E = mustalias_end(); I != E; ++I) {
WriteAsOperand(OS, *I, false);
OS << ", ";
@@ -39,9 +39,6 @@ void MayAliasSet::print(raw_ostream &OS)
OS << '}';
}
-void MayAliasSet::dump() const {
- print(dbgs());
-}
+void MayAliasSet::dump() const { print(dbgs()); }
-void MayAliasSetInfo::buildMayAliasSets(TempScop &Scop, AliasAnalysis &AA) {
-}
+void MayAliasSetInfo::buildMayAliasSets(TempScop &Scop, AliasAnalysis &AA) {}
Modified: polly/trunk/lib/Pluto.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Pluto.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Pluto.cpp (original)
+++ polly/trunk/lib/Pluto.cpp Fri Mar 22 20:05:07 2013
@@ -27,51 +27,45 @@
#include "pluto/libpluto.h"
#include "isl/map.h"
-
using namespace llvm;
using namespace polly;
-static cl::opt<bool>
-EnableTiling("polly-pluto-tile",
- cl::desc("Enable tiling"),
- cl::Hidden, cl::init(false));
+static cl::opt<bool> EnableTiling("polly-pluto-tile", cl::desc("Enable tiling"),
+ cl::Hidden, cl::init(false));
namespace {
/// Convert an int into a string.
-static std::string convertInt(int number)
-{
+static std::string convertInt(int number) {
if (number == 0)
return "0";
std::string temp = "";
std::string returnvalue = "";
- while (number > 0)
- {
+ while (number > 0) {
temp += number % 10 + 48;
number /= 10;
}
for (unsigned i = 0; i < temp.length(); i++)
- returnvalue+=temp[temp.length() - i - 1];
+ returnvalue += temp[temp.length() - i - 1];
return returnvalue;
}
+class PlutoOptimizer : public ScopPass {
- class PlutoOptimizer : public ScopPass {
-
- public:
- static char ID;
- explicit PlutoOptimizer() : ScopPass(ID) {}
-
- virtual bool runOnScop(Scop &S);
- void printScop(llvm::raw_ostream &OS) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
- static void extendScattering(Scop &S, unsigned NewDimensions);
- };
+public:
+ static char ID;
+ explicit PlutoOptimizer() : ScopPass(ID) {}
+
+ virtual bool runOnScop(Scop &S);
+ void printScop(llvm::raw_ostream &OS) const;
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+ static void extendScattering(Scop &S, unsigned NewDimensions);
+};
}
char PlutoOptimizer::ID = 0;
static int getSingleMap(__isl_take isl_map *map, void *user) {
- isl_map **singleMap = (isl_map **) user;
+ isl_map **singleMap = (isl_map **)user;
*singleMap = map;
return 0;
@@ -93,7 +87,6 @@ void PlutoOptimizer::extendScattering(Sc
for (unsigned i = OldDimensions; i < NewDimensions; i++)
Map = isl_map_fix_si(Map, isl_dim_out, i, 0);
-
Map = isl_map_align_params(Map, S.getParamSpace());
New = isl_map_apply_range(Stmt->getScattering(), Map);
Stmt->setScattering(New);
@@ -107,8 +100,8 @@ bool PlutoOptimizer::runOnScop(Scop &S)
Dependences *D = &getAnalysis<Dependences>();
- int DependencesKinds = Dependences::TYPE_RAW | Dependences::TYPE_WAR
- | Dependences::TYPE_WAW;
+ int DependencesKinds =
+ Dependences::TYPE_RAW | Dependences::TYPE_WAR | Dependences::TYPE_WAW;
Deps = D->getDependences(DependencesKinds);
Domain = S.getDomains();
@@ -119,7 +112,7 @@ bool PlutoOptimizer::runOnScop(Scop &S)
ScopStmt *Stmt = *SI;
std::string Name = "S_" + convertInt(counter);
isl_map *Identity = isl_map_identity(isl_space_map_from_domain_and_range(
- Stmt->getDomainSpace(), Stmt->getDomainSpace()));
+ Stmt->getDomainSpace(), Stmt->getDomainSpace()));
Identity = isl_map_set_tuple_name(Identity, isl_dim_out, Name.c_str());
ToPlutoNames = isl_union_map_add_map(ToPlutoNames, Identity);
counter++;
@@ -133,10 +126,8 @@ bool PlutoOptimizer::runOnScop(Scop &S)
Options->fuse = 0;
Options->tile = EnableTiling;
- DEBUG(
- dbgs() << "Domain: " << stringFromIslObj(Domain) << "\n";
- dbgs() << "Dependences: " << stringFromIslObj(Deps) << "\n";
- );
+ DEBUG(dbgs() << "Domain: " << stringFromIslObj(Domain) << "\n";
+ dbgs() << "Dependences: " << stringFromIslObj(Deps) << "\n";);
Schedule = pluto_schedule(Domain, Deps, Options);
pluto_options_free(Options);
@@ -146,15 +137,15 @@ bool PlutoOptimizer::runOnScop(Scop &S)
if (!Schedule)
return false;
- Schedule = isl_union_map_apply_domain(Schedule,
- isl_union_map_reverse(ToPlutoNames));
+ Schedule =
+ isl_union_map_apply_domain(Schedule, isl_union_map_reverse(ToPlutoNames));
for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
ScopStmt *Stmt = *SI;
isl_set *Domain = Stmt->getDomain();
isl_union_map *StmtBand;
StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(Schedule),
- isl_union_set_from_set(Domain));
+ isl_union_set_from_set(Domain));
isl_map *StmtSchedule;
isl_union_map_foreach_map(StmtBand, getSingleMap, &StmtSchedule);
Stmt->setScattering(StmtSchedule);
@@ -172,23 +163,21 @@ bool PlutoOptimizer::runOnScop(Scop &S)
return false;
}
-void PlutoOptimizer::printScop(raw_ostream &OS) const {
-}
+void PlutoOptimizer::printScop(raw_ostream &OS) const {}
void PlutoOptimizer::getAnalysisUsage(AnalysisUsage &AU) const {
ScopPass::getAnalysisUsage(AU);
AU.addRequired<Dependences>();
}
+Pass *polly::createPlutoOptimizerPass() { return new PlutoOptimizer(); }
+
INITIALIZE_PASS_BEGIN(PlutoOptimizer, "polly-opt-pluto",
- "Polly - Optimize schedule of SCoP (Pluto)", false, false)
-INITIALIZE_PASS_DEPENDENCY(Dependences)
-INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+ "Polly - Optimize schedule of SCoP (Pluto)", false,
+ false);
+INITIALIZE_PASS_DEPENDENCY(Dependences);
+INITIALIZE_PASS_DEPENDENCY(ScopInfo);
INITIALIZE_PASS_END(PlutoOptimizer, "polly-opt-pluto",
- "Polly - Optimize schedule of SCoP (Pluto)", false, false)
-
-Pass* polly::createPlutoOptimizerPass() {
- return new PlutoOptimizer();
-}
+ "Polly - Optimize schedule of SCoP (Pluto)", false, false)
#endif // PLUTO_FOUND
Modified: polly/trunk/lib/Pocc.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Pocc.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Pocc.cpp (original)
+++ polly/trunk/lib/Pocc.cpp Fri Mar 22 20:05:07 2013
@@ -39,35 +39,32 @@
#include "isl/map.h"
#include "isl/constraint.h"
-
using namespace llvm;
using namespace polly;
static cl::opt<std::string>
-PlutoFuse("pluto-fuse",
- cl::desc(""), cl::Hidden,
- cl::value_desc("Set fuse mode of Pluto"),
- cl::init("maxfuse"));
+PlutoFuse("pluto-fuse", cl::desc(""), cl::Hidden,
+ cl::value_desc("Set fuse mode of Pluto"), cl::init("maxfuse"));
namespace {
- class Pocc : public ScopPass {
- sys::Path plutoStderr;
- sys::Path plutoStdout;
- std::vector<const char*> arguments;
-
- public:
- static char ID;
- explicit Pocc() : ScopPass(ID) {}
-
- std::string getFileName(Region *R) const;
- virtual bool runOnScop(Scop &S);
- void printScop(llvm::raw_ostream &OS) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
-
- private:
- bool runTransform(Scop &S);
- };
+class Pocc : public ScopPass {
+ sys::Path plutoStderr;
+ sys::Path plutoStdout;
+ std::vector<const char *> arguments;
+
+public:
+ static char ID;
+ explicit Pocc() : ScopPass(ID) {}
+
+ std::string getFileName(Region *R) const;
+ virtual bool runOnScop(Scop &S);
+ void printScop(llvm::raw_ostream &OS) const;
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+
+private:
+ bool runTransform(Scop &S);
+};
}
@@ -127,13 +124,13 @@ bool Pocc::runTransform(Scop &S) {
plutoStderr = tempDir;
plutoStderr.appendComponent("pluto.stderr");
- std::vector<sys::Path*> redirect;
+ std::vector<sys::Path *> redirect;
redirect.push_back(0);
redirect.push_back(&plutoStdout);
redirect.push_back(&plutoStderr);
program.ExecuteAndWait(pocc, &arguments[0], 0,
- (sys::Path const **) &redirect[0]);
+ (sys::Path const **)&redirect[0]);
// Read the created scop file
sys::Path newScopFile = tempDir;
@@ -145,8 +142,9 @@ bool Pocc::runTransform(Scop &S) {
if (!newScoplib.updateScattering()) {
errs() << "Failure when calculating the optimization with "
"the following command: ";
- for (std::vector<const char*>::const_iterator AI = arguments.begin(),
- AE = arguments.end(); AI != AE; ++AI)
+ for (std::vector<const char *>::const_iterator AI = arguments.begin(),
+ AE = arguments.end();
+ AI != AE; ++AI)
if (*AI)
errs() << " " << *AI;
errs() << "\n";
@@ -246,8 +244,9 @@ void Pocc::printScop(raw_ostream &OS) co
OS << "Command line: ";
- for (std::vector<const char*>::const_iterator AI = arguments.begin(),
- AE = arguments.end(); AI != AE; ++AI)
+ for (std::vector<const char *>::const_iterator AI = arguments.begin(),
+ AE = arguments.end();
+ AI != AE; ++AI)
if (*AI)
OS << " " << *AI;
@@ -273,14 +272,12 @@ void Pocc::getAnalysisUsage(AnalysisUsag
AU.addRequired<Dependences>();
}
+Pass *polly::createPoccPass() { return new Pocc(); }
+
INITIALIZE_PASS_BEGIN(Pocc, "polly-opt-pocc",
- "Polly - Optimize the scop using pocc", false, false)
-INITIALIZE_PASS_DEPENDENCY(Dependences)
-INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+ "Polly - Optimize the scop using pocc", false, false);
+INITIALIZE_PASS_DEPENDENCY(Dependences);
+INITIALIZE_PASS_DEPENDENCY(ScopInfo);
INITIALIZE_PASS_END(Pocc, "polly-opt-pocc",
"Polly - Optimize the scop using pocc", false, false)
-
-Pass* polly::createPoccPass() {
- return new Pocc();
-}
#endif /* SCOPLIB_FOUND */
Modified: polly/trunk/lib/RegionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegionSimplify.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/RegionSimplify.cpp (original)
+++ polly/trunk/lib/RegionSimplify.cpp Fri Mar 22 20:05:07 2013
@@ -33,7 +33,7 @@ STATISTIC(NumEntries, "The # of created
STATISTIC(NumExits, "The # of created exit edges");
namespace {
-class RegionSimplify: public RegionPass {
+class RegionSimplify : public RegionPass {
// Remember the modified region.
Region *r;
void createSingleEntryEdge(Region *R);
@@ -51,21 +51,13 @@ public:
char RegionSimplify::ID = 0;
-INITIALIZE_PASS_BEGIN(RegionSimplify, "polly-region-simplify",
- "Transform refined regions into simple regions", false,
- false)
-INITIALIZE_PASS_DEPENDENCY(RegionInfo)
-INITIALIZE_PASS_END(RegionSimplify, "polly-region-simplify",
- "Transform refined regions into simple regions", false,
- false)
namespace polly {
- Pass *createRegionSimplifyPass() {
- return new RegionSimplify();
- }
+Pass *createRegionSimplifyPass() { return new RegionSimplify(); }
}
void RegionSimplify::print(raw_ostream &O, const Module *M) const {
- if (r == 0) return;
+ if (r == 0)
+ return;
BasicBlock *enteringBlock = r->getEnteringBlock();
BasicBlock *exitingBlock = r->getExitingBlock();
@@ -92,19 +84,19 @@ void RegionSimplify::getAnalysisUsage(An
// Function SplitBlockPredecessors currently updates/preserves AliasAnalysis,
/// DominatorTree, LoopInfo, and LCCSA but no other analyses.
//AU.addPreserved<AliasAnalysis>(); Break SCEV-AA
- AU.addPreserved<DominatorTree> ();
+ AU.addPreserved<DominatorTree>();
AU.addPreserved<LoopInfo>();
AU.addPreservedID(LCSSAID);
- AU.addPreserved<RegionInfo> ();
- AU.addRequired<RegionInfo> ();
+ AU.addPreserved<RegionInfo>();
+ AU.addRequired<RegionInfo>();
}
// createSingleEntryEdge - Split the entry basic block of the given
// region after the last PHINode to form a single entry edge.
void RegionSimplify::createSingleEntryEdge(Region *R) {
BasicBlock *oldEntry = R->getEntry();
- SmallVector<BasicBlock*, 4> Preds;
+ SmallVector<BasicBlock *, 4> Preds;
for (pred_iterator PI = pred_begin(oldEntry), PE = pred_end(oldEntry);
PI != PE; ++PI)
if (!R->contains(*PI))
@@ -112,10 +104,10 @@ void RegionSimplify::createSingleEntryEd
assert(Preds.size() && "This region has already a single entry edge");
- BasicBlock *newEntry = SplitBlockPredecessors(oldEntry, Preds,
- ".single_entry", this);
+ BasicBlock *newEntry =
+ SplitBlockPredecessors(oldEntry, Preds, ".single_entry", this);
- RegionInfo *RI = &getAnalysis<RegionInfo> ();
+ RegionInfo *RI = &getAnalysis<RegionInfo>();
// We do not update entry node for children of this region.
// This make it easier to extract children regions because they do not share
// the entry node with their parents.
@@ -123,7 +115,7 @@ void RegionSimplify::createSingleEntryEd
Region *r = R->getParent();
// Put the new entry to R's parent.
- RI->setRegionFor(newEntry,r);
+ RI->setRegionFor(newEntry, r);
while (r->getEntry() == oldEntry && !r->isTopLevelRegion()) {
r->replaceEntry(newEntry);
@@ -137,11 +129,11 @@ void RegionSimplify::createSingleEntryEd
std::vector<Region *> RQ;
RQ.push_back(r);
- while (!RQ.empty()){
+ while (!RQ.empty()) {
r = RQ.back();
RQ.pop_back();
- for (Region::const_iterator RI = r->begin(), RE = r->end(); RI!=RE; ++RI)
+ for (Region::const_iterator RI = r->begin(), RE = r->end(); RI != RE; ++RI)
RQ.push_back(*RI);
if (r->getExit() == oldEntry && !R->contains(r))
@@ -155,37 +147,37 @@ void RegionSimplify::createSingleEntryEd
void RegionSimplify::createSingleExitEdge(Region *R) {
BasicBlock *oldExit = R->getExit();
- SmallVector<BasicBlock*, 4> Preds;
- for (pred_iterator PI = pred_begin(oldExit), PE = pred_end(oldExit);
- PI != PE; ++PI)
+ SmallVector<BasicBlock *, 4> Preds;
+ for (pred_iterator PI = pred_begin(oldExit), PE = pred_end(oldExit); PI != PE;
+ ++PI)
if (R->contains(*PI))
Preds.push_back(*PI);
DEBUG(dbgs() << "Going to create single exit for:\n");
DEBUG(R->print(dbgs(), true, 0, Region::PrintRN));
- BasicBlock *newExit = SplitBlockPredecessors(oldExit, Preds,
- ".single_exit", this);
+ BasicBlock *newExit =
+ SplitBlockPredecessors(oldExit, Preds, ".single_exit", this);
RegionInfo *RI = &getAnalysis<RegionInfo>();
// We do not need to update entry nodes because this split happens inside
// this region and it affects only this region and all of its children.
// The new split node belongs to this region
- RI->setRegionFor(newExit,R);
+ RI->setRegionFor(newExit, R);
DEBUG(dbgs() << "Adding new exiting block: " << newExit->getName() << '\n');
// all children of this region whose exit is oldExit is changed to newExit
std::vector<Region *> RQ;
- for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE; ++RI)
+ for (Region::const_iterator RI = R->begin(), RE = R->end(); RI != RE; ++RI)
RQ.push_back(*RI);
- while (!RQ.empty()){
+ while (!RQ.empty()) {
R = RQ.back();
RQ.pop_back();
if (R->getExit() != oldExit)
continue;
- for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE; ++RI)
+ for (Region::const_iterator RI = R->begin(), RE = R->end(); RI != RE; ++RI)
RQ.push_back(*RI);
R->replaceExit(newExit);
@@ -203,8 +195,8 @@ bool RegionSimplify::runOnRegion(Region
if (!R->isTopLevelRegion()) {
// split entry node if the region has multiple entry edges
- if (!(R->getEnteringBlock())
- && (pred_begin(R->getEntry()) != pred_end(R->getEntry()))) {
+ if (!(R->getEnteringBlock()) &&
+ (pred_begin(R->getEntry()) != pred_end(R->getEntry()))) {
createSingleEntryEdge(R);
r = R;
++NumEntries;
@@ -220,3 +212,11 @@ bool RegionSimplify::runOnRegion(Region
return r != 0;
}
+
+INITIALIZE_PASS_BEGIN(RegionSimplify, "polly-region-simplify",
+ "Transform refined regions into simple regions", false,
+ false);
+INITIALIZE_PASS_DEPENDENCY(RegionInfo);
+INITIALIZE_PASS_END(RegionSimplify, "polly-region-simplify",
+ "Transform refined regions into simple regions", false,
+ false)
Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Fri Mar 22 20:05:07 2013
@@ -39,13 +39,10 @@
using namespace llvm;
using namespace polly;
-namespace polly {
- bool DisablePollyTiling;
-}
-static cl::opt<bool, true>
-DisableTiling("polly-no-tiling",
- cl::desc("Disable tiling in the scheduler"), cl::Hidden,
- cl::location(polly::DisablePollyTiling), cl::init(false));
+namespace polly { bool DisablePollyTiling; }
+static cl::opt<bool, true> DisableTiling(
+ "polly-no-tiling", cl::desc("Disable tiling in the scheduler"), cl::Hidden,
+ cl::location(polly::DisablePollyTiling), cl::init(false));
static cl::opt<std::string>
OptimizeDeps("polly-opt-optimize-only",
@@ -54,8 +51,8 @@ OptimizeDeps("polly-opt-optimize-only",
static cl::opt<std::string>
SimplifyDeps("polly-opt-simplify-deps",
- cl::desc("Dependences should be simplified (yes/no)"),
- cl::Hidden, cl::init("yes"));
+ cl::desc("Dependences should be simplified (yes/no)"), cl::Hidden,
+ cl::init("yes"));
static cl::opt<int>
MaxConstantTerm("polly-opt-max-constant-term",
@@ -67,140 +64,133 @@ MaxCoefficient("polly-opt-max-coefficien
cl::desc("The maximal coefficient allowed (-1 is unlimited)"),
cl::Hidden, cl::init(20));
-static cl::opt<std::string>
-FusionStrategy("polly-opt-fusion",
- cl::desc("The fusion strategy to choose (min/max)"),
- cl::Hidden, cl::init("min"));
-
-static cl::opt<std::string>
-MaximizeBandDepth("polly-opt-maximize-bands",
- cl::desc("Maximize the band depth (yes/no)"),
- cl::Hidden, cl::init("yes"));
+static cl::opt<std::string> FusionStrategy(
+ "polly-opt-fusion", cl::desc("The fusion strategy to choose (min/max)"),
+ cl::Hidden, cl::init("min"));
+
+static cl::opt<std::string> MaximizeBandDepth(
+ "polly-opt-maximize-bands", cl::desc("Maximize the band depth (yes/no)"),
+ cl::Hidden, cl::init("yes"));
namespace {
- class IslScheduleOptimizer : public ScopPass {
+class IslScheduleOptimizer : public ScopPass {
- public:
- static char ID;
- explicit IslScheduleOptimizer() : ScopPass(ID) {
- LastSchedule = NULL;
- }
-
- ~IslScheduleOptimizer() {
- isl_schedule_free(LastSchedule);
- }
-
- virtual bool runOnScop(Scop &S);
- void printScop(llvm::raw_ostream &OS) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
-
- private:
- isl_schedule *LastSchedule;
-
- static void extendScattering(Scop &S, unsigned NewDimensions);
-
- /// @brief Create a map that describes a n-dimensonal tiling.
- ///
- /// getTileMap creates a map from a n-dimensional scattering space into an
- /// 2*n-dimensional scattering space. The map describes a rectangular
- /// tiling.
- ///
- /// Example:
- /// scheduleDimensions = 2, parameterDimensions = 1, tileSize = 32
- ///
- /// tileMap := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]:
- /// t0 % 32 = 0 and t0 <= s0 < t0 + 32 and
- /// t1 % 32 = 0 and t1 <= s1 < t1 + 32}
- ///
- /// Before tiling:
- ///
- /// for (i = 0; i < N; i++)
- /// for (j = 0; j < M; j++)
- /// S(i,j)
- ///
- /// After tiling:
- ///
- /// for (t_i = 0; t_i < N; i+=32)
- /// for (t_j = 0; t_j < M; j+=32)
- /// for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0
- /// for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0
- /// S(i,j)
- ///
- static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
- isl_space *SpaceModel, int tileSize = 32);
-
- /// @brief Get the schedule for this band.
- ///
- /// Polly applies transformations like tiling on top of the isl calculated
- /// value. This can influence the number of scheduling dimension. The
- /// number of schedule dimensions is returned in the parameter 'Dimension'.
- static isl_union_map *getScheduleForBand(isl_band *Band, int *Dimensions);
-
- /// @brief Create a map that pre-vectorizes one scheduling dimension.
- ///
- /// getPrevectorMap creates a map that maps each input dimension to the same
- /// output dimension, except for the dimension DimToVectorize.
- /// DimToVectorize is strip mined by 'VectorWidth' and the newly created
- /// point loop of DimToVectorize is moved to the innermost level.
- ///
- /// Example (DimToVectorize=0, ScheduleDimensions=2, VectorWidth=4):
- ///
- /// | Before transformation
- /// |
- /// | A[i,j] -> [i,j]
- /// |
- /// | for (i = 0; i < 128; i++)
- /// | for (j = 0; j < 128; j++)
- /// | A(i,j);
- ///
- /// Prevector map:
- /// [i,j] -> [it,j,ip] : it % 4 = 0 and it <= ip <= it + 3 and i = ip
- ///
- /// | After transformation:
- /// |
- /// | A[i,j] -> [it,j,ip] : it % 4 = 0 and it <= ip <= it + 3 and i = ip
- /// |
- /// | for (it = 0; it < 128; it+=4)
- /// | for (j = 0; j < 128; j++)
- /// | for (ip = max(0,it); ip < min(128, it + 3); ip++)
- /// | A(ip,j);
- ///
- /// The goal of this transformation is to create a trivially vectorizable
- /// loop. This means a parallel loop at the innermost level that has a
- /// constant number of iterations corresponding to the target vector width.
- ///
- /// This transformation creates a loop at the innermost level. The loop has
- /// a constant number of iterations, if the number of loop iterations at
- /// DimToVectorize can be divided by VectorWidth. The default VectorWidth is
- /// currently constant and not yet target specific. This function does not
- /// reason about parallelism.
- static isl_map *getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
- int ScheduleDimensions,
- int VectorWidth = 4);
-
- /// @brief Get the scheduling map for a list of bands.
- ///
- /// Walk recursively the forest of bands to combine the schedules of the
- /// individual bands to the overall schedule. In case tiling is requested,
- /// the individual bands are tiled.
- static isl_union_map *getScheduleForBandList(isl_band_list *BandList);
-
- static isl_union_map *getScheduleMap(isl_schedule *Schedule);
-
- bool doFinalization() {
- isl_schedule_free(LastSchedule);
- LastSchedule = NULL;
- return true;
- }
- };
+public:
+ static char ID;
+ explicit IslScheduleOptimizer() : ScopPass(ID) { LastSchedule = NULL; }
+
+ ~IslScheduleOptimizer() { isl_schedule_free(LastSchedule); }
+
+ virtual bool runOnScop(Scop &S);
+ void printScop(llvm::raw_ostream &OS) const;
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+
+private:
+ isl_schedule *LastSchedule;
+
+ static void extendScattering(Scop &S, unsigned NewDimensions);
+
+ /// @brief Create a map that describes a n-dimensonal tiling.
+ ///
+ /// getTileMap creates a map from a n-dimensional scattering space into an
+ /// 2*n-dimensional scattering space. The map describes a rectangular
+ /// tiling.
+ ///
+ /// Example:
+ /// scheduleDimensions = 2, parameterDimensions = 1, tileSize = 32
+ ///
+ /// tileMap := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]:
+ /// t0 % 32 = 0 and t0 <= s0 < t0 + 32 and
+ /// t1 % 32 = 0 and t1 <= s1 < t1 + 32}
+ ///
+ /// Before tiling:
+ ///
+ /// for (i = 0; i < N; i++)
+ /// for (j = 0; j < M; j++)
+ /// S(i,j)
+ ///
+ /// After tiling:
+ ///
+ /// for (t_i = 0; t_i < N; i+=32)
+ /// for (t_j = 0; t_j < M; j+=32)
+ /// for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0
+ /// for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0
+ /// S(i,j)
+ ///
+ static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
+ isl_space *SpaceModel, int tileSize = 32);
+
+ /// @brief Get the schedule for this band.
+ ///
+ /// Polly applies transformations like tiling on top of the isl calculated
+ /// value. This can influence the number of scheduling dimension. The
+ /// number of schedule dimensions is returned in the parameter 'Dimension'.
+ static isl_union_map *getScheduleForBand(isl_band *Band, int *Dimensions);
+
+ /// @brief Create a map that pre-vectorizes one scheduling dimension.
+ ///
+ /// getPrevectorMap creates a map that maps each input dimension to the same
+ /// output dimension, except for the dimension DimToVectorize.
+ /// DimToVectorize is strip mined by 'VectorWidth' and the newly created
+ /// point loop of DimToVectorize is moved to the innermost level.
+ ///
+ /// Example (DimToVectorize=0, ScheduleDimensions=2, VectorWidth=4):
+ ///
+ /// | Before transformation
+ /// |
+ /// | A[i,j] -> [i,j]
+ /// |
+ /// | for (i = 0; i < 128; i++)
+ /// | for (j = 0; j < 128; j++)
+ /// | A(i,j);
+ ///
+ /// Prevector map:
+ /// [i,j] -> [it,j,ip] : it % 4 = 0 and it <= ip <= it + 3 and i = ip
+ ///
+ /// | After transformation:
+ /// |
+ /// | A[i,j] -> [it,j,ip] : it % 4 = 0 and it <= ip <= it + 3 and i = ip
+ /// |
+ /// | for (it = 0; it < 128; it+=4)
+ /// | for (j = 0; j < 128; j++)
+ /// | for (ip = max(0,it); ip < min(128, it + 3); ip++)
+ /// | A(ip,j);
+ ///
+ /// The goal of this transformation is to create a trivially vectorizable
+ /// loop. This means a parallel loop at the innermost level that has a
+ /// constant number of iterations corresponding to the target vector width.
+ ///
+ /// This transformation creates a loop at the innermost level. The loop has
+ /// a constant number of iterations, if the number of loop iterations at
+ /// DimToVectorize can be divided by VectorWidth. The default VectorWidth is
+ /// currently constant and not yet target specific. This function does not
+ /// reason about parallelism.
+ static isl_map *getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
+ int ScheduleDimensions, int VectorWidth = 4);
+
+ /// @brief Get the scheduling map for a list of bands.
+ ///
+ /// Walk recursively the forest of bands to combine the schedules of the
+ /// individual bands to the overall schedule. In case tiling is requested,
+ /// the individual bands are tiled.
+ static isl_union_map *getScheduleForBandList(isl_band_list *BandList);
+
+ static isl_union_map *getScheduleMap(isl_schedule *Schedule);
+
+ bool doFinalization() {
+ isl_schedule_free(LastSchedule);
+ LastSchedule = NULL;
+ return true;
+ }
+};
}
char IslScheduleOptimizer::ID = 0;
static int getSingleMap(__isl_take isl_map *map, void *user) {
- isl_map **singleMap = (isl_map **) user;
+ isl_map **singleMap = (isl_map **)user;
*singleMap = map;
return 0;
@@ -222,17 +212,14 @@ void IslScheduleOptimizer::extendScatter
for (unsigned i = OldDimensions; i < NewDimensions; i++)
Map = isl_map_fix_si(Map, isl_dim_out, i, 0);
-
Map = isl_map_align_params(Map, S.getParamSpace());
New = isl_map_apply_range(Stmt->getScattering(), Map);
Stmt->setScattering(New);
}
}
-isl_basic_map *IslScheduleOptimizer::getTileMap(isl_ctx *ctx,
- int scheduleDimensions,
- isl_space *SpaceModel,
- int tileSize) {
+isl_basic_map *IslScheduleOptimizer::getTileMap(
+ isl_ctx *ctx, int scheduleDimensions, isl_space *SpaceModel, int tileSize) {
// We construct
//
// tileMap := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]:
@@ -240,8 +227,8 @@ isl_basic_map *IslScheduleOptimizer::get
// s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32}
//
// and project out the auxilary dimensions a0 and a1.
- isl_space *Space = isl_space_alloc(ctx, 0, scheduleDimensions,
- scheduleDimensions * 3);
+ isl_space *Space =
+ isl_space_alloc(ctx, 0, scheduleDimensions, scheduleDimensions * 3);
isl_basic_map *tileMap = isl_basic_map_universe(isl_space_copy(Space));
isl_local_space *LocalSpace = isl_local_space_from_space(Space);
@@ -285,15 +272,14 @@ isl_basic_map *IslScheduleOptimizer::get
// The auxilary dimensions are transformed into existentially quantified ones.
// This reduces the number of visible scattering dimensions and allows Cloog
// to produces better code.
- tileMap = isl_basic_map_project_out(tileMap, isl_dim_out,
- 2 * scheduleDimensions,
- scheduleDimensions);
+ tileMap = isl_basic_map_project_out(
+ tileMap, isl_dim_out, 2 * scheduleDimensions, scheduleDimensions);
isl_local_space_free(LocalSpace);
return tileMap;
}
-isl_union_map *IslScheduleOptimizer::getScheduleForBand(isl_band *Band,
- int *Dimensions) {
+isl_union_map *
+IslScheduleOptimizer::getScheduleForBand(isl_band *Band, int *Dimensions) {
isl_union_map *PartialSchedule;
isl_ctx *ctx;
isl_space *Space;
@@ -321,10 +307,8 @@ isl_union_map *IslScheduleOptimizer::get
return isl_union_map_apply_range(PartialSchedule, TileUMap);
}
-isl_map *IslScheduleOptimizer::getPrevectorMap(isl_ctx *ctx,
- int DimToVectorize,
- int ScheduleDimensions,
- int VectorWidth) {
+isl_map *IslScheduleOptimizer::getPrevectorMap(
+ isl_ctx *ctx, int DimToVectorize, int ScheduleDimensions, int VectorWidth) {
isl_space *Space;
isl_local_space *LocalSpace, *LocalSpaceRange;
isl_set *Modulo;
@@ -335,7 +319,7 @@ isl_map *IslScheduleOptimizer::getPrevec
int TileDimension; /* it */
isl_int VectorWidthMP;
- assert (0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);
+ assert(0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);
Space = isl_space_alloc(ctx, 0, ScheduleDimensions, ScheduleDimensions + 1);
TilingMap = isl_map_universe(isl_space_copy(Space));
@@ -385,8 +369,8 @@ isl_map *IslScheduleOptimizer::getPrevec
return TilingMap;
}
-isl_union_map *IslScheduleOptimizer::getScheduleForBandList(
- isl_band_list *BandList) {
+isl_union_map *
+IslScheduleOptimizer::getScheduleForBandList(isl_band_list *BandList) {
int NumBands;
isl_union_map *Schedule;
isl_ctx *ctx;
@@ -411,24 +395,24 @@ isl_union_map *IslScheduleOptimizer::get
Children = isl_band_get_children(Band);
SuffixSchedule = getScheduleForBandList(Children);
- PartialSchedule = isl_union_map_flat_range_product(PartialSchedule,
- SuffixSchedule);
+ PartialSchedule =
+ isl_union_map_flat_range_product(PartialSchedule, SuffixSchedule);
isl_band_list_free(Children);
} else if (PollyVectorizerChoice != VECTORIZER_NONE) {
- for (int j = 0; j < isl_band_n_member(Band); j++) {
- if (isl_band_member_is_zero_distance(Band, j)) {
+ for (int j = 0; j < isl_band_n_member(Band); j++) {
+ if (isl_band_member_is_zero_distance(Band, j)) {
isl_map *TileMap;
isl_union_map *TileUMap;
- TileMap = getPrevectorMap(ctx, ScheduleDimensions - j - 1,
+ TileMap = getPrevectorMap(ctx, ScheduleDimensions - j - 1,
ScheduleDimensions);
- TileUMap = isl_union_map_from_map(TileMap);
- TileUMap = isl_union_map_align_params(TileUMap,
- isl_space_copy(Space));
- PartialSchedule = isl_union_map_apply_range(PartialSchedule,
- TileUMap);
- break;
- }
+ TileUMap = isl_union_map_from_map(TileMap);
+ TileUMap =
+ isl_union_map_align_params(TileUMap, isl_space_copy(Space));
+ PartialSchedule =
+ isl_union_map_apply_range(PartialSchedule, TileUMap);
+ break;
+ }
}
}
@@ -455,20 +439,20 @@ bool IslScheduleOptimizer::runOnScop(Sco
LastSchedule = NULL;
// Build input data.
- int ValidityKinds = Dependences::TYPE_RAW | Dependences::TYPE_WAR
- | Dependences::TYPE_WAW;
+ int ValidityKinds =
+ Dependences::TYPE_RAW | Dependences::TYPE_WAR | Dependences::TYPE_WAW;
int ProximityKinds;
if (OptimizeDeps == "all")
- ProximityKinds = Dependences::TYPE_RAW | Dependences::TYPE_WAR
- | Dependences::TYPE_WAW;
+ ProximityKinds =
+ Dependences::TYPE_RAW | Dependences::TYPE_WAR | Dependences::TYPE_WAW;
else if (OptimizeDeps == "raw")
ProximityKinds = Dependences::TYPE_RAW;
else {
errs() << "Do not know how to optimize for '" << OptimizeDeps << "'"
- << " Falling back to optimizing all dependences.\n";
- ProximityKinds = Dependences::TYPE_RAW | Dependences::TYPE_WAR
- | Dependences::TYPE_WAW;
+ << " Falling back to optimizing all dependences.\n";
+ ProximityKinds =
+ Dependences::TYPE_RAW | Dependences::TYPE_WAR | Dependences::TYPE_WAW;
}
isl_union_set *Domain = S.getDomains();
@@ -489,8 +473,8 @@ bool IslScheduleOptimizer::runOnScop(Sco
if (SimplifyDeps == "yes") {
Validity = isl_union_map_gist_domain(Validity, isl_union_set_copy(Domain));
Validity = isl_union_map_gist_range(Validity, isl_union_set_copy(Domain));
- Proximity = isl_union_map_gist_domain(Proximity,
- isl_union_set_copy(Domain));
+ Proximity =
+ isl_union_map_gist_domain(Proximity, isl_union_set_copy(Domain));
Proximity = isl_union_map_gist_range(Proximity, isl_union_set_copy(Domain));
} else if (SimplifyDeps != "no") {
errs() << "warning: Option -polly-opt-simplify-deps should either be 'yes' "
@@ -535,7 +519,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
isl_options_set_on_error(S.getIslCtx(), ISL_ON_ERROR_CONTINUE);
isl_schedule *Schedule;
- Schedule = isl_union_set_compute_schedule(Domain, Validity, Proximity);
+ Schedule = isl_union_set_compute_schedule(Domain, Validity, Proximity);
isl_options_set_on_error(S.getIslCtx(), ISL_ON_ERROR_ABORT);
// In cases the scheduler is not able to optimize the code, we just do not
@@ -543,8 +527,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
if (!Schedule)
return false;
- DEBUG(dbgs() << "Schedule := "; isl_schedule_dump(Schedule);
- dbgs() << ";\n");
+ DEBUG(dbgs() << "Schedule := "; isl_schedule_dump(Schedule); dbgs() << ";\n");
isl_union_map *ScheduleMap = getScheduleMap(Schedule);
@@ -553,7 +536,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
isl_set *Domain = Stmt->getDomain();
isl_union_map *StmtBand;
StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(ScheduleMap),
- isl_union_set_from_set(Domain));
+ isl_union_set_from_set(Domain));
isl_map *StmtSchedule;
isl_union_map_foreach_map(StmtBand, getSingleMap, &StmtSchedule);
Stmt->setScattering(StmtSchedule);
@@ -596,13 +579,13 @@ void IslScheduleOptimizer::getAnalysisUs
AU.addRequired<Dependences>();
}
-INITIALIZE_PASS_BEGIN(IslScheduleOptimizer, "polly-opt-isl",
- "Polly - Optimize schedule of SCoP", false, false)
-INITIALIZE_PASS_DEPENDENCY(Dependences)
-INITIALIZE_PASS_DEPENDENCY(ScopInfo)
-INITIALIZE_PASS_END(IslScheduleOptimizer, "polly-opt-isl",
- "Polly - Optimize schedule of SCoP", false, false)
-
-Pass* polly::createIslScheduleOptimizerPass() {
+Pass *polly::createIslScheduleOptimizerPass() {
return new IslScheduleOptimizer();
}
+
+INITIALIZE_PASS_BEGIN(IslScheduleOptimizer, "polly-opt-isl",
+ "Polly - Optimize schedule of SCoP", false, false);
+INITIALIZE_PASS_DEPENDENCY(Dependences);
+INITIALIZE_PASS_DEPENDENCY(ScopInfo);
+INITIALIZE_PASS_END(IslScheduleOptimizer, "polly-opt-isl",
+ "Polly - Optimize schedule of SCoP", false, false)
Modified: polly/trunk/lib/Support/GICHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/GICHelper.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Support/GICHelper.cpp (original)
+++ polly/trunk/lib/Support/GICHelper.cpp Fri Mar 22 20:05:07 2013
@@ -121,4 +121,3 @@ std::string polly::stringFromIslObj(__is
return stringFromIslObjInternal(pwaff, isl_pw_aff_get_ctx,
isl_printer_print_pw_aff);
}
-
Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Fri Mar 22 20:05:07 2013
@@ -437,30 +437,22 @@ private:
};
namespace polly {
- bool hasScalarDepsInsideRegion(const SCEV *Expr, const Region *R) {
- return SCEVInRegionDependences::hasDependences(Expr, R);
- }
-
- bool isAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
- const Value *BaseAddress) {
- if (isa<SCEVCouldNotCompute>(Expr))
+bool hasScalarDepsInsideRegion(const SCEV *Expr, const Region *R) {
+ return SCEVInRegionDependences::hasDependences(Expr, R);
+}
+
+bool isAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
+ const Value *BaseAddress) {
+ if (isa<SCEVCouldNotCompute>(Expr))
return false;
SCEVValidator Validator(R, SE, BaseAddress);
- DEBUG(
- dbgs() << "\n";
- dbgs() << "Expr: " << *Expr << "\n";
- dbgs() << "Region: " << R->getNameStr() << "\n";
- dbgs() << " -> "
- );
+ DEBUG(dbgs() << "\n"; dbgs() << "Expr: " << *Expr << "\n";
+ dbgs() << "Region: " << R->getNameStr() << "\n"; dbgs() << " -> ");
ValidatorResult Result = Validator.visit(Expr);
- DEBUG(
- if (Result.isValid())
- dbgs() << "VALID\n";
- dbgs() << "\n";
- );
+ DEBUG(if (Result.isValid()) dbgs() << "VALID\n"; dbgs() << "\n";);
return Result.isValid();
}
@@ -477,5 +469,3 @@ getParamsInAffineExpr(const Region *R, c
return Result.getParameters();
}
}
-
-
Removed: polly/trunk/test/polybench/utilities/instrument.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/polybench/utilities/instrument.h?rev=177795&view=auto
==============================================================================
--- polly/trunk/test/polybench/utilities/instrument.h (original)
+++ polly/trunk/test/polybench/utilities/instrument.h (removed)
@@ -1,25 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <math.h>
-
-
-#define polybench_start_instruments
-#define polybench_stop_instruments
-#define polybench_print_instruments
-
-#ifdef POLYBENCH_TIME
-# undef polybench_start_instruments
-# undef polybench_stop_instruments
-# undef polybench_print_instruments
-# define polybench_start_instruments polybench_timer_start();
-# define polybench_stop_instruments polybench_timer_stop();
-# define polybench_print_instruments polybench_timer_print();
-#endif
-
-
-extern void polybench_timer_start();
-extern void polybench_timer_stop();
-extern void polybench_timer_print();
Modified: polly/trunk/tools/GPURuntime/GPUJIT.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/tools/GPURuntime/GPUJIT.c?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/tools/GPURuntime/GPUJIT.c (original)
+++ polly/trunk/tools/GPURuntime/GPUJIT.c Fri Mar 22 20:05:07 2013
@@ -1,4 +1,5 @@
-/******************** GPUJIT.cpp - GPUJIT Execution Engine ********************/
+/******************** GPUJIT.cpp - GPUJIT Execution Engine \
+ * ********************/
/* */
/* The LLVM Compiler Infrastructure */
/* */
@@ -53,8 +54,8 @@ static CuMemAllocFcnTy *CuMemAllocFcnPtr
typedef CUresult CUDAAPI CuFuncSetBlockShapeFcnTy(CUfunction, int, int, int);
static CuFuncSetBlockShapeFcnTy *CuFuncSetBlockShapeFcnPtr;
-typedef CUresult CUDAAPI CuParamSetvFcnTy(CUfunction, int, void *,
- unsigned int);
+typedef CUresult CUDAAPI
+CuParamSetvFcnTy(CUfunction, int, void *, unsigned int);
static CuParamSetvFcnTy *CuParamSetvFcnPtr;
typedef CUresult CUDAAPI CuParamSetSizeFcnTy(CUfunction, unsigned int);
@@ -90,13 +91,12 @@ static CuCtxCreateFcnTy *CuCtxCreateFcnP
typedef CUresult CUDAAPI CuDeviceGetFcnTy(CUdevice *, int);
static CuDeviceGetFcnTy *CuDeviceGetFcnPtr;
-typedef CUresult CUDAAPI CuModuleLoadDataExFcnTy(CUmodule *, const void *,
- unsigned int, CUjit_option *,
- void **);
+typedef CUresult CUDAAPI CuModuleLoadDataExFcnTy(
+ CUmodule *, const void *, unsigned int, CUjit_option *, void **);
static CuModuleLoadDataExFcnTy *CuModuleLoadDataExFcnPtr;
-typedef CUresult CUDAAPI CuModuleGetFunctionFcnTy(CUfunction *, CUmodule,
- const char *);
+typedef CUresult CUDAAPI
+CuModuleGetFunctionFcnTy(CUfunction *, CUmodule, const char *);
static CuModuleGetFunctionFcnTy *CuModuleGetFunctionFcnPtr;
typedef CUresult CUDAAPI CuDeviceComputeCapabilityFcnTy(int *, int *, CUdevice);
@@ -109,15 +109,14 @@ static CuDeviceGetNameFcnTy *CuDeviceGet
typedef cudaError_t CUDARTAPI CudaEventCreateFcnTy(cudaEvent_t *);
static CudaEventCreateFcnTy *CudaEventCreateFcnPtr;
-typedef cudaError_t CUDARTAPI CudaEventRecordFcnTy(cudaEvent_t,
- cudaStream_t);
+typedef cudaError_t CUDARTAPI CudaEventRecordFcnTy(cudaEvent_t, cudaStream_t);
static CudaEventRecordFcnTy *CudaEventRecordFcnPtr;
typedef cudaError_t CUDARTAPI CudaEventSynchronizeFcnTy(cudaEvent_t);
static CudaEventSynchronizeFcnTy *CudaEventSynchronizeFcnPtr;
-typedef cudaError_t CUDARTAPI CudaEventElapsedTimeFcnTy(float *, cudaEvent_t,
- cudaEvent_t);
+typedef cudaError_t CUDARTAPI
+CudaEventElapsedTimeFcnTy(float *, cudaEvent_t, cudaEvent_t);
static CudaEventElapsedTimeFcnTy *CudaEventElapsedTimeFcnPtr;
typedef cudaError_t CUDARTAPI CudaEventDestroyFcnTy(cudaEvent_t);
@@ -166,81 +165,77 @@ static int initialDeviceAPIs() {
* of this kind of cast may not be emitted by clang and new versions of gcc
* as it is valid on POSIX 2008.
*/
- CuFuncSetBlockShapeFcnPtr =
- (CuFuncSetBlockShapeFcnTy *) getAPIHandle(HandleCuda,
- "cuFuncSetBlockShape");
+ CuFuncSetBlockShapeFcnPtr = (CuFuncSetBlockShapeFcnTy *)getAPIHandle(
+ HandleCuda, "cuFuncSetBlockShape");
- CuParamSetvFcnPtr = (CuParamSetvFcnTy *) getAPIHandle(HandleCuda,
- "cuParamSetv");
+ CuParamSetvFcnPtr =
+ (CuParamSetvFcnTy *)getAPIHandle(HandleCuda, "cuParamSetv");
- CuParamSetSizeFcnPtr = (CuParamSetSizeFcnTy *) getAPIHandle(HandleCuda,
- "cuParamSetSize");
+ CuParamSetSizeFcnPtr =
+ (CuParamSetSizeFcnTy *)getAPIHandle(HandleCuda, "cuParamSetSize");
- CuLaunchGridFcnPtr = (CuLaunchGridFcnTy *) getAPIHandle(HandleCuda,
- "cuLaunchGrid");
+ CuLaunchGridFcnPtr =
+ (CuLaunchGridFcnTy *)getAPIHandle(HandleCuda, "cuLaunchGrid");
- CuMemAllocFcnPtr = (CuMemAllocFcnTy *) getAPIHandle(HandleCuda,
- "cuMemAlloc_v2");
+ CuMemAllocFcnPtr =
+ (CuMemAllocFcnTy *)getAPIHandle(HandleCuda, "cuMemAlloc_v2");
- CuMemFreeFcnPtr = (CuMemFreeFcnTy *) getAPIHandle(HandleCuda, "cuMemFree_v2");
+ CuMemFreeFcnPtr = (CuMemFreeFcnTy *)getAPIHandle(HandleCuda, "cuMemFree_v2");
- CuMemcpyDtoHFcnPtr = (CuMemcpyDtoHFcnTy *) getAPIHandle(HandleCuda,
- "cuMemcpyDtoH_v2");
+ CuMemcpyDtoHFcnPtr =
+ (CuMemcpyDtoHFcnTy *)getAPIHandle(HandleCuda, "cuMemcpyDtoH_v2");
- CuMemcpyHtoDFcnPtr = (CuMemcpyHtoDFcnTy *) getAPIHandle(HandleCuda,
- "cuMemcpyHtoD_v2");
+ CuMemcpyHtoDFcnPtr =
+ (CuMemcpyHtoDFcnTy *)getAPIHandle(HandleCuda, "cuMemcpyHtoD_v2");
- CuModuleUnloadFcnPtr = (CuModuleUnloadFcnTy *) getAPIHandle(HandleCuda,
- "cuModuleUnload");
+ CuModuleUnloadFcnPtr =
+ (CuModuleUnloadFcnTy *)getAPIHandle(HandleCuda, "cuModuleUnload");
- CuCtxDestroyFcnPtr = (CuCtxDestroyFcnTy *) getAPIHandle(HandleCuda,
- "cuCtxDestroy");
+ CuCtxDestroyFcnPtr =
+ (CuCtxDestroyFcnTy *)getAPIHandle(HandleCuda, "cuCtxDestroy");
- CuInitFcnPtr = (CuInitFcnTy *) getAPIHandle(HandleCuda, "cuInit");
+ CuInitFcnPtr = (CuInitFcnTy *)getAPIHandle(HandleCuda, "cuInit");
- CuDeviceGetCountFcnPtr = (CuDeviceGetCountFcnTy *) getAPIHandle(HandleCuda,
- "cuDeviceGetCount");
+ CuDeviceGetCountFcnPtr =
+ (CuDeviceGetCountFcnTy *)getAPIHandle(HandleCuda, "cuDeviceGetCount");
- CuDeviceGetFcnPtr = (CuDeviceGetFcnTy *) getAPIHandle(HandleCuda,
- "cuDeviceGet");
+ CuDeviceGetFcnPtr =
+ (CuDeviceGetFcnTy *)getAPIHandle(HandleCuda, "cuDeviceGet");
- CuCtxCreateFcnPtr = (CuCtxCreateFcnTy *) getAPIHandle(HandleCuda,
- "cuCtxCreate_v2");
+ CuCtxCreateFcnPtr =
+ (CuCtxCreateFcnTy *)getAPIHandle(HandleCuda, "cuCtxCreate_v2");
CuModuleLoadDataExFcnPtr =
- (CuModuleLoadDataExFcnTy *) getAPIHandle(HandleCuda, "cuModuleLoadDataEx");
+ (CuModuleLoadDataExFcnTy *)getAPIHandle(HandleCuda, "cuModuleLoadDataEx");
- CuModuleGetFunctionFcnPtr =
- (CuModuleGetFunctionFcnTy *)getAPIHandle(HandleCuda, "cuModuleGetFunction");
+ CuModuleGetFunctionFcnPtr = (CuModuleGetFunctionFcnTy *)getAPIHandle(
+ HandleCuda, "cuModuleGetFunction");
CuDeviceComputeCapabilityFcnPtr =
- (CuDeviceComputeCapabilityFcnTy *)getAPIHandle(HandleCuda,
- "cuDeviceComputeCapability");
+ (CuDeviceComputeCapabilityFcnTy *)getAPIHandle(
+ HandleCuda, "cuDeviceComputeCapability");
CuDeviceGetNameFcnPtr =
- (CuDeviceGetNameFcnTy *) getAPIHandle(HandleCuda, "cuDeviceGetName");
+ (CuDeviceGetNameFcnTy *)getAPIHandle(HandleCuda, "cuDeviceGetName");
/* Get function pointer to CUDA Runtime APIs. */
CudaEventCreateFcnPtr =
- (CudaEventCreateFcnTy *) getAPIHandle(HandleCudaRT, "cudaEventCreate");
+ (CudaEventCreateFcnTy *)getAPIHandle(HandleCudaRT, "cudaEventCreate");
CudaEventRecordFcnPtr =
- (CudaEventRecordFcnTy *) getAPIHandle(HandleCudaRT, "cudaEventRecord");
+ (CudaEventRecordFcnTy *)getAPIHandle(HandleCudaRT, "cudaEventRecord");
- CudaEventSynchronizeFcnPtr =
- (CudaEventSynchronizeFcnTy *) getAPIHandle(HandleCudaRT,
- "cudaEventSynchronize");
-
- CudaEventElapsedTimeFcnPtr =
- (CudaEventElapsedTimeFcnTy *) getAPIHandle(HandleCudaRT,
- "cudaEventElapsedTime");
+ CudaEventSynchronizeFcnPtr = (CudaEventSynchronizeFcnTy *)getAPIHandle(
+ HandleCudaRT, "cudaEventSynchronize");
+
+ CudaEventElapsedTimeFcnPtr = (CudaEventElapsedTimeFcnTy *)getAPIHandle(
+ HandleCudaRT, "cudaEventElapsedTime");
CudaEventDestroyFcnPtr =
- (CudaEventDestroyFcnTy *) getAPIHandle(HandleCudaRT, "cudaEventDestroy");
+ (CudaEventDestroyFcnTy *)getAPIHandle(HandleCudaRT, "cudaEventDestroy");
- CudaThreadSynchronizeFcnPtr =
- (CudaThreadSynchronizeFcnTy *) getAPIHandle(HandleCudaRT,
- "cudaThreadSynchronize");
+ CudaThreadSynchronizeFcnPtr = (CudaThreadSynchronizeFcnTy *)getAPIHandle(
+ HandleCudaRT, "cudaThreadSynchronize");
return 1;
}
@@ -269,7 +264,7 @@ void polly_initDevice(PollyGPUContext **
}
/* We select the 1st device as default. */
- *Device = malloc(sizeof(PollyGPUDevice));
+ *Device = malloc(sizeof(PollyGPUDevice));
if (*Device == 0) {
fprintf(stdout, "Allocate memory for Polly GPU device failed.\n");
exit(-1);
@@ -297,8 +292,8 @@ void polly_getPTXModule(void *PTXBuffer,
exit(-1);
}
- if (CuModuleLoadDataExFcnPtr(&((*Module)->Cuda), PTXBuffer, 0, 0, 0)
- != CUDA_SUCCESS) {
+ if (CuModuleLoadDataExFcnPtr(&((*Module)->Cuda), PTXBuffer, 0, 0, 0) !=
+ CUDA_SUCCESS) {
fprintf(stdout, "Loading ptx assembly text failed.\n");
exit(-1);
}
@@ -313,8 +308,8 @@ void polly_getPTXKernelEntry(const char
}
/* Locate the kernel entry point. */
- if(CuModuleGetFunctionFcnPtr(&((*Kernel)->Cuda), Module->Cuda, KernelName)
- != CUDA_SUCCESS) {
+ if (CuModuleGetFunctionFcnPtr(&((*Kernel)->Cuda), Module->Cuda, KernelName) !=
+ CUDA_SUCCESS) {
fprintf(stdout, "Loading kernel function failed.\n");
exit(-1);
}
@@ -354,9 +349,8 @@ void polly_stopTimerByCudaEvent(PollyGPU
free(Stop);
}
-void polly_allocateMemoryForHostAndDevice(void **HostData,
- PollyGPUDevicePtr **DevData,
- int MemSize) {
+void polly_allocateMemoryForHostAndDevice(
+ void **HostData, PollyGPUDevicePtr **DevData, int MemSize) {
if ((*HostData = (int *)malloc(MemSize)) == 0) {
fprintf(stdout, "Could not allocate host memory.\n");
exit(-1);
@@ -378,7 +372,7 @@ void polly_copyFromHostToDevice(PollyGPU
void polly_copyFromDeviceToHost(void *HostData, PollyGPUDevicePtr *DevData,
int MemSize) {
- if(CuMemcpyDtoHFcnPtr(HostData, DevData->Cuda, MemSize) != CUDA_SUCCESS) {
+ if (CuMemcpyDtoHFcnPtr(HostData, DevData->Cuda, MemSize) != CUDA_SUCCESS) {
fprintf(stdout, "Copying results from device to host memory failed.\n");
exit(-1);
}
@@ -405,10 +399,9 @@ void polly_launchKernel(PollyGPUFunction
fprintf(stdout, "CUDA kernel launched.\n");
}
-void polly_cleanupGPGPUResources(void *HostData, PollyGPUDevicePtr *DevData,
- PollyGPUModule *Module,
- PollyGPUContext *Context,
- PollyGPUFunction *Kernel) {
+void polly_cleanupGPGPUResources(
+ void *HostData, PollyGPUDevicePtr *DevData, PollyGPUModule *Module,
+ PollyGPUContext *Context, PollyGPUFunction *Kernel) {
if (HostData) {
free(HostData);
HostData = 0;
Modified: polly/trunk/tools/GPURuntime/GPUJIT.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/tools/GPURuntime/GPUJIT.h?rev=177796&r1=177795&r2=177796&view=diff
==============================================================================
--- polly/trunk/tools/GPURuntime/GPUJIT.h (original)
+++ polly/trunk/tools/GPURuntime/GPUJIT.h Fri Mar 22 20:05:07 2013
@@ -92,15 +92,13 @@ void polly_copyFromHostToDevice(PollyGPU
int MemSize);
void polly_copyFromDeviceToHost(void *HostData, PollyGPUDevicePtr *DevData,
int MemSize);
-void polly_allocateMemoryForHostAndDevice(void **HostData,
- PollyGPUDevicePtr **DevData,
- int MemSize);
+void polly_allocateMemoryForHostAndDevice(
+ void **HostData, PollyGPUDevicePtr **DevData, int MemSize);
void polly_setKernelParameters(PollyGPUFunction *Kernel, int BlockWidth,
int BlockHeight, PollyGPUDevicePtr *DevData);
void polly_launchKernel(PollyGPUFunction *Kernel, int GridWidth,
int GridHeight);
-void polly_cleanupGPGPUResources(void *HostData, PollyGPUDevicePtr *DevData,
- PollyGPUModule *Module,
- PollyGPUContext *Context,
- PollyGPUFunction *Kernel);
+void polly_cleanupGPGPUResources(
+ void *HostData, PollyGPUDevicePtr *DevData, PollyGPUModule *Module,
+ PollyGPUContext *Context, PollyGPUFunction *Kernel);
#endif /* GPUJIT_H_ */
More information about the llvm-commits
mailing list