summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/CodeGeneration.cpp
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2012-05-22 08:46:07 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2012-05-22 08:46:07 +0000
commite192b23f5e2815576fba2a120fa587abff240f37 (patch)
treeb372a1764b6d505f1055cf530d2ddee69f00d6d5 /polly/lib/CodeGen/CodeGeneration.cpp
parent9c946f3e2d932bc9a6eb3e849093af9eb3eed28b (diff)
downloadbcm5719-llvm-e192b23f5e2815576fba2a120fa587abff240f37.tar.gz
bcm5719-llvm-e192b23f5e2815576fba2a120fa587abff240f37.zip
Move isParallelFor into CodeGeneration
This removes another include of CLooG header files. llvm-svn: 157242
Diffstat (limited to 'polly/lib/CodeGen/CodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/CodeGeneration.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 9d39ec2ff0a..6476dcd03a4 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -283,6 +283,16 @@ private:
/// statement.
void codegenForOpenMP(const clast_for *f);
+ /// @brief Check if a loop is parallel
+ ///
+ /// Detect if a clast_for loop can be executed in parallel.
+ ///
+ /// @param f The clast for loop to check.
+ ///
+ /// @return bool Returns true if the incoming clast_for statement can
+ /// execute in parallel.
+ bool isParallelFor(const clast_for *For);
+
bool isInnermostLoop(const clast_for *f);
/// @brief Get the number of loop iterations for this loop.
@@ -608,9 +618,19 @@ void ClastStmtCodeGen::codegenForVector(const clast_for *F) {
ClastVars.erase(F->iterator);
}
+
+bool ClastStmtCodeGen::isParallelFor(const clast_for *f) {
+ isl_set *Domain = isl_set_from_cloog_domain(f->domain);
+ assert(Domain && "Cannot access domain of loop");
+
+ Dependences &D = P->getAnalysis<Dependences>();
+
+ return D.isParallelDimension(isl_set_copy(Domain), isl_set_n_dim(Domain));
+}
+
void ClastStmtCodeGen::codegen(const clast_for *f) {
bool Vector = PollyVectorizerChoice != VECTORIZER_NONE;
- if ((Vector || OpenMP) && P->getAnalysis<Dependences>().isParallelFor(f)) {
+ if ((Vector || OpenMP) && isParallelFor(f)) {
if (Vector && isInnermostLoop(f) && (-1 != getNumberOfIterations(f))
&& (getNumberOfIterations(f) <= 16)) {
codegenForVector(f);
OpenPOWER on IntegriCloud