summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen
diff options
context:
space:
mode:
authorSebastian Pop <spop@codeaurora.org>2012-12-18 07:46:06 +0000
committerSebastian Pop <spop@codeaurora.org>2012-12-18 07:46:06 +0000
commita00a0291155b2e9668475b0c7cb4ca4bcd28a951 (patch)
tree5cfb8c431e2b2f1aef84f9f4bad9cd9d9ab37484 /polly/lib/CodeGen
parentbad01549b6c0c2c3a9acbca22a9c9dae3b32654a (diff)
downloadbcm5719-llvm-a00a0291155b2e9668475b0c7cb4ca4bcd28a951.tar.gz
bcm5719-llvm-a00a0291155b2e9668475b0c7cb4ca4bcd28a951.zip
change interface for isStride
isStride now takes a partial schedule as input. Patch from Tobias Grosser <tobias@grosser.es>. llvm-svn: 170419
Diffstat (limited to 'polly/lib/CodeGen')
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp20
-rw-r--r--polly/lib/CodeGen/CodeGeneration.cpp17
-rw-r--r--polly/lib/CodeGen/IslAst.cpp2
3 files changed, 28 insertions, 11 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index e8109bdd1fe..1e5341a36e9 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -562,12 +562,14 @@ void BlockGenerator::copyBB(ValueMapT &GlobalMap) {
}
VectorBlockGenerator::VectorBlockGenerator(IRBuilder<> &B,
- VectorValueMapT &GlobalMaps, ScopStmt &Stmt, __isl_keep isl_set *Domain,
- Pass *P) : BlockGenerator(B, Stmt, P), GlobalMaps(GlobalMaps),
- Domain(Domain) {
- assert(GlobalMaps.size() > 1 && "Only one vector lane found");
- assert(Domain && "No statement domain provided");
- }
+ VectorValueMapT &GlobalMaps,
+ ScopStmt &Stmt,
+ __isl_keep isl_map *Schedule,
+ Pass *P)
+ : BlockGenerator(B, Stmt, P), GlobalMaps(GlobalMaps), Schedule(Schedule) {
+ assert(GlobalMaps.size() > 1 && "Only one vector lane found");
+ assert(Schedule && "No statement domain provided");
+}
Value *VectorBlockGenerator::getVectorValue(const Value *Old,
ValueMapT &VectorMap,
@@ -675,9 +677,9 @@ void VectorBlockGenerator::generateLoad(const LoadInst *Load,
MemoryAccess &Access = Statement.getAccessFor(Load);
Value *NewLoad;
- if (Access.isStrideZero(isl_set_copy(Domain)))
+ if (Access.isStrideZero(isl_map_copy(Schedule)))
NewLoad = generateStrideZeroLoad(Load, ScalarMaps[0]);
- else if (Access.isStrideOne(isl_set_copy(Domain)))
+ else if (Access.isStrideOne(isl_map_copy(Schedule)))
NewLoad = generateStrideOneLoad(Load, ScalarMaps[0]);
else
NewLoad = generateUnknownStrideLoad(Load, ScalarMaps);
@@ -726,7 +728,7 @@ void VectorBlockGenerator::copyStore(const StoreInst *Store,
Value *Vector = getVectorValue(Store->getValueOperand(), VectorMap,
ScalarMaps);
- if (Access.isStrideOne(isl_set_copy(Domain))) {
+ if (Access.isStrideOne(isl_map_copy(Schedule))) {
Type *VectorPtrType = getVectorPtrTy(Pointer, VectorWidth);
Value *NewPointer = getNewValue(Pointer, ScalarMaps[0], GlobalMaps[0]);
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 064c828df79..60302cb123f 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -394,6 +394,19 @@ void ClastStmtCodeGen::codegenSubstitutions(const clast_stmt *Assignment,
}
}
+// Takes the cloog specific domain and translates it into a map Statement ->
+// PartialSchedule, where the PartialSchedule contains all the dimensions that
+// have been code generated up to this point.
+static __isl_give isl_map *extractPartialSchedule(ScopStmt *Statement,
+ isl_set *Domain) {
+ isl_map *Schedule = Statement->getScattering();
+ int ScheduledDimensions = isl_set_dim(Domain, isl_dim_set);
+ int UnscheduledDimensions = isl_map_dim(Schedule, isl_dim_out) - ScheduledDimensions;
+
+ return isl_map_project_out(Schedule, isl_dim_out, ScheduledDimensions,
+ UnscheduledDimensions);
+}
+
void ClastStmtCodeGen::codegen(const clast_user_stmt *u,
std::vector<Value*> *IVS , const char *iterator,
isl_set *Domain) {
@@ -422,7 +435,9 @@ void ClastStmtCodeGen::codegen(const clast_user_stmt *u,
}
}
- VectorBlockGenerator::generate(Builder, *Statement, VectorMap, Domain, P);
+ isl_map *Schedule = extractPartialSchedule(Statement, Domain);
+ VectorBlockGenerator::generate(Builder, *Statement, VectorMap, Schedule, P);
+ isl_map_free(Schedule);
}
void ClastStmtCodeGen::codegen(const clast_block *b) {
diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp
index 5d16fda1612..d3d65dce4ff 100644
--- a/polly/lib/CodeGen/IslAst.cpp
+++ b/polly/lib/CodeGen/IslAst.cpp
@@ -246,7 +246,7 @@ static int containsLoops(__isl_take isl_ast_node *Node, void *User) {
isl_ast_node_free(Node);
return 0;
case isl_ast_node_block: {
- isl_ast_node_list *List = isl_ast_node_block_get_children(Node);
+ isl_ast_node_list *List = isl_ast_node_block_get_children(Node);
int Res = isl_ast_node_list_foreach(List, &containsLoops, NULL);
isl_ast_node_list_free(List);
isl_ast_node_free(Node);
OpenPOWER on IntegriCloud