summaryrefslogtreecommitdiffstats
path: root/polly
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-10-09 23:40:24 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-10-09 23:40:24 +0000
commitf363ed9804e72982b673ff36ef1f1450a1774ba1 (patch)
tree2db8ed5c589dafd3e09d62cc14c8337aa55e7b4d /polly
parent14e773500e036de57ed0ca4af6fddc1f8b6767d8 (diff)
downloadbcm5719-llvm-f363ed9804e72982b673ff36ef1f1450a1774ba1.tar.gz
bcm5719-llvm-f363ed9804e72982b673ff36ef1f1450a1774ba1.zip
[NFC] Move helper functions to ScopHelper
Helper functions in the BlockGenerators.h/cpp introduce dependences from the frontend to the backend of Polly. As they are used in ScopDetection, ScopInfo, etc. we move them to the ScopHelper file. llvm-svn: 249919
Diffstat (limited to 'polly')
-rw-r--r--polly/include/polly/CodeGen/BlockGenerators.h20
-rw-r--r--polly/include/polly/Support/ScopHelper.h20
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp1
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp1
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp40
-rw-r--r--polly/lib/Support/ScopHelper.cpp42
-rw-r--r--polly/lib/Transform/CodePreparation.cpp1
-rw-r--r--polly/lib/Transform/IndependentBlocks.cpp1
8 files changed, 62 insertions, 64 deletions
diff --git a/polly/include/polly/CodeGen/BlockGenerators.h b/polly/include/polly/CodeGen/BlockGenerators.h
index 52de37e827f..b1c89203ac9 100644
--- a/polly/include/polly/CodeGen/BlockGenerators.h
+++ b/polly/include/polly/CodeGen/BlockGenerators.h
@@ -37,26 +37,6 @@ class ScopStmt;
class MemoryAccess;
class IslExprBuilder;
-/// @brief Check whether a value an be synthesized by the code generator.
-///
-/// Some value will be recalculated only from information that is code generated
-/// from the polyhedral representation. For such instructions we do not need to
-/// ensure that their operands are available during code generation.
-///
-/// @param V The value to check.
-/// @param LI The LoopInfo analysis.
-/// @param SE The scalar evolution database.
-/// @param R The region out of which SSA names are parameters.
-/// @return If the instruction I can be regenerated from its
-/// scalar evolution representation, return true,
-/// otherwise return false.
-bool canSynthesize(const llvm::Value *V, const llvm::LoopInfo *LI,
- llvm::ScalarEvolution *SE, const llvm::Region *R);
-
-/// @brief Return true iff @p V is an intrinsic that we ignore during code
-/// generation.
-bool isIgnoredIntrinsic(const llvm::Value *V);
-
/// @brief Generate a new basic block for a polyhedral statement.
class BlockGenerator {
public:
diff --git a/polly/include/polly/Support/ScopHelper.h b/polly/include/polly/Support/ScopHelper.h
index c358022a51b..1ff049838e7 100644
--- a/polly/include/polly/Support/ScopHelper.h
+++ b/polly/include/polly/Support/ScopHelper.h
@@ -155,5 +155,25 @@ llvm::Value *getConditionFromTerminator(llvm::TerminatorInst *TI);
/// @return True if @p LInst can be hoisted in @p R.
bool isHoistableLoad(llvm::LoadInst *LInst, llvm::Region &R, llvm::LoopInfo &LI,
llvm::ScalarEvolution &SE);
+
+/// @brief Return true iff @p V is an intrinsic that we ignore during code
+/// generation.
+bool isIgnoredIntrinsic(const llvm::Value *V);
+
+/// @brief Check whether a value an be synthesized by the code generator.
+///
+/// Some value will be recalculated only from information that is code generated
+/// from the polyhedral representation. For such instructions we do not need to
+/// ensure that their operands are available during code generation.
+///
+/// @param V The value to check.
+/// @param LI The LoopInfo analysis.
+/// @param SE The scalar evolution database.
+/// @param R The region out of which SSA names are parameters.
+/// @return If the instruction I can be regenerated from its
+/// scalar evolution representation, return true,
+/// otherwise return false.
+bool canSynthesize(const llvm::Value *V, const llvm::LoopInfo *LI,
+ llvm::ScalarEvolution *SE, const llvm::Region *R);
}
#endif
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index e2fcaf09dcd..01d4a663659 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -44,7 +44,6 @@
//
//===----------------------------------------------------------------------===//
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 33dce5c6787..ef52bd34a1c 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -18,7 +18,6 @@
//===----------------------------------------------------------------------===//
#include "polly/LinkAllPasses.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 91433070418..adb6168e61b 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -48,46 +48,6 @@ static cl::opt<bool> DebugPrinting(
cl::desc("Add printf calls that show the values loaded/stored."),
cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
-bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI,
- ScalarEvolution *SE, const Region *R) {
- if (!V || !SE->isSCEVable(V->getType()))
- return false;
-
- if (const SCEV *Scev = SE->getSCEV(const_cast<Value *>(V)))
- if (!isa<SCEVCouldNotCompute>(Scev))
- if (!hasScalarDepsInsideRegion(Scev, R))
- return true;
-
- return false;
-}
-
-bool polly::isIgnoredIntrinsic(const Value *V) {
- if (auto *IT = dyn_cast<IntrinsicInst>(V)) {
- switch (IT->getIntrinsicID()) {
- // Lifetime markers are supported/ignored.
- case llvm::Intrinsic::lifetime_start:
- case llvm::Intrinsic::lifetime_end:
- // Invariant markers are supported/ignored.
- case llvm::Intrinsic::invariant_start:
- case llvm::Intrinsic::invariant_end:
- // Some misc annotations are supported/ignored.
- case llvm::Intrinsic::var_annotation:
- case llvm::Intrinsic::ptr_annotation:
- case llvm::Intrinsic::annotation:
- case llvm::Intrinsic::donothing:
- case llvm::Intrinsic::assume:
- case llvm::Intrinsic::expect:
- // Some debug info intrisics are supported/ignored.
- case llvm::Intrinsic::dbg_value:
- case llvm::Intrinsic::dbg_declare:
- return true;
- default:
- break;
- }
- }
- return false;
-}
-
BlockGenerator::BlockGenerator(PollyIRBuilder &B, LoopInfo &LI,
ScalarEvolution &SE, DominatorTree &DT,
ScalarAllocaMapTy &ScalarMap,
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp
index 022f427ecc8..b17ffdc91a4 100644
--- a/polly/lib/Support/ScopHelper.cpp
+++ b/polly/lib/Support/ScopHelper.cpp
@@ -14,12 +14,14 @@
#include "polly/Support/ScopHelper.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
+#include "polly/Support/SCEVValidator.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/IR/CFG.h"
+#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -401,3 +403,43 @@ bool polly::isHoistableLoad(LoadInst *LInst, Region &R, LoopInfo &LI,
return true;
}
+
+bool polly::isIgnoredIntrinsic(const Value *V) {
+ if (auto *IT = dyn_cast<IntrinsicInst>(V)) {
+ switch (IT->getIntrinsicID()) {
+ // Lifetime markers are supported/ignored.
+ case llvm::Intrinsic::lifetime_start:
+ case llvm::Intrinsic::lifetime_end:
+ // Invariant markers are supported/ignored.
+ case llvm::Intrinsic::invariant_start:
+ case llvm::Intrinsic::invariant_end:
+ // Some misc annotations are supported/ignored.
+ case llvm::Intrinsic::var_annotation:
+ case llvm::Intrinsic::ptr_annotation:
+ case llvm::Intrinsic::annotation:
+ case llvm::Intrinsic::donothing:
+ case llvm::Intrinsic::assume:
+ case llvm::Intrinsic::expect:
+ // Some debug info intrisics are supported/ignored.
+ case llvm::Intrinsic::dbg_value:
+ case llvm::Intrinsic::dbg_declare:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
+bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI,
+ ScalarEvolution *SE, const Region *R) {
+ if (!V || !SE->isSCEVable(V->getType()))
+ return false;
+
+ if (const SCEV *Scev = SE->getSCEV(const_cast<Value *>(V)))
+ if (!isa<SCEVCouldNotCompute>(Scev))
+ if (!hasScalarDepsInsideRegion(Scev, R))
+ return true;
+
+ return false;
+}
diff --git a/polly/lib/Transform/CodePreparation.cpp b/polly/lib/Transform/CodePreparation.cpp
index c76e076c94f..bebaab147d4 100644
--- a/polly/lib/Transform/CodePreparation.cpp
+++ b/polly/lib/Transform/CodePreparation.cpp
@@ -17,7 +17,6 @@
//===----------------------------------------------------------------------===//
#include "polly/LinkAllPasses.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/ScopDetection.h"
#include "polly/Support/ScopHelper.h"
#include "llvm/Analysis/DominanceFrontier.h"
diff --git a/polly/lib/Transform/IndependentBlocks.cpp b/polly/lib/Transform/IndependentBlocks.cpp
index 4908b8a875d..1daf9ed9f04 100644
--- a/polly/lib/Transform/IndependentBlocks.cpp
+++ b/polly/lib/Transform/IndependentBlocks.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
//
#include "polly/LinkAllPasses.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/Support/ScopHelper.h"
OpenPOWER on IntegriCloud