forked from OSchip/llvm-project
parent
a24d84beb9
commit
4ff1c3983d
|
@ -48,7 +48,7 @@ class MemoryAccess;
|
||||||
/// query only specific parts.
|
/// query only specific parts.
|
||||||
struct Dependences {
|
struct Dependences {
|
||||||
// Granularities of the current dependence analysis
|
// Granularities of the current dependence analysis
|
||||||
enum AnalyisLevel {
|
enum AnalysisLevel {
|
||||||
AL_Statement = 0,
|
AL_Statement = 0,
|
||||||
// Distinguish accessed memory references in the same statement
|
// Distinguish accessed memory references in the same statement
|
||||||
AL_Reference,
|
AL_Reference,
|
||||||
|
@ -142,7 +142,7 @@ struct Dependences {
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
/// Return the granularity of this dependence analysis.
|
/// Return the granularity of this dependence analysis.
|
||||||
AnalyisLevel getDependenceLevel() { return Level; }
|
AnalysisLevel getDependenceLevel() { return Level; }
|
||||||
|
|
||||||
/// Allow the DependenceInfo access to private members and methods.
|
/// Allow the DependenceInfo access to private members and methods.
|
||||||
///
|
///
|
||||||
|
@ -157,7 +157,7 @@ struct Dependences {
|
||||||
private:
|
private:
|
||||||
/// Create an empty dependences struct.
|
/// Create an empty dependences struct.
|
||||||
explicit Dependences(const std::shared_ptr<isl_ctx> &IslCtx,
|
explicit Dependences(const std::shared_ptr<isl_ctx> &IslCtx,
|
||||||
AnalyisLevel Level)
|
AnalysisLevel Level)
|
||||||
: RAW(nullptr), WAR(nullptr), WAW(nullptr), RED(nullptr), TC_RED(nullptr),
|
: RAW(nullptr), WAR(nullptr), WAW(nullptr), RED(nullptr), TC_RED(nullptr),
|
||||||
IslCtx(IslCtx), Level(Level) {}
|
IslCtx(IslCtx), Level(Level) {}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ private:
|
||||||
std::shared_ptr<isl_ctx> IslCtx;
|
std::shared_ptr<isl_ctx> IslCtx;
|
||||||
|
|
||||||
/// Granularity of this dependence analysis.
|
/// Granularity of this dependence analysis.
|
||||||
const AnalyisLevel Level;
|
const AnalysisLevel Level;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DependenceInfo : public ScopPass {
|
class DependenceInfo : public ScopPass {
|
||||||
|
@ -209,10 +209,10 @@ public:
|
||||||
///
|
///
|
||||||
/// @return The dependence analysis result
|
/// @return The dependence analysis result
|
||||||
///
|
///
|
||||||
const Dependences &getDependences(Dependences::AnalyisLevel Level);
|
const Dependences &getDependences(Dependences::AnalysisLevel Level);
|
||||||
|
|
||||||
/// Recompute dependences from schedule and memory accesses.
|
/// Recompute dependences from schedule and memory accesses.
|
||||||
const Dependences &recomputeDependences(Dependences::AnalyisLevel Level);
|
const Dependences &recomputeDependences(Dependences::AnalysisLevel Level);
|
||||||
|
|
||||||
/// Compute the dependence information for the SCoP @p S.
|
/// Compute the dependence information for the SCoP @p S.
|
||||||
bool runOnScop(Scop &S) override;
|
bool runOnScop(Scop &S) override;
|
||||||
|
@ -251,11 +251,11 @@ public:
|
||||||
///
|
///
|
||||||
/// @return The dependence analysis result
|
/// @return The dependence analysis result
|
||||||
///
|
///
|
||||||
const Dependences &getDependences(Scop *S, Dependences::AnalyisLevel Level);
|
const Dependences &getDependences(Scop *S, Dependences::AnalysisLevel Level);
|
||||||
|
|
||||||
/// Recompute dependences from schedule and memory accesses.
|
/// Recompute dependences from schedule and memory accesses.
|
||||||
const Dependences &recomputeDependences(Scop *S,
|
const Dependences &recomputeDependences(Scop *S,
|
||||||
Dependences::AnalyisLevel Level);
|
Dependences::AnalysisLevel Level);
|
||||||
|
|
||||||
/// Compute the dependence information on-the-fly for the function.
|
/// Compute the dependence information on-the-fly for the function.
|
||||||
bool runOnFunction(Function &F) override;
|
bool runOnFunction(Function &F) override;
|
||||||
|
|
|
@ -69,7 +69,7 @@ static cl::opt<enum AnalysisType> OptAnalysisType(
|
||||||
cl::Hidden, cl::init(VALUE_BASED_ANALYSIS), cl::ZeroOrMore,
|
cl::Hidden, cl::init(VALUE_BASED_ANALYSIS), cl::ZeroOrMore,
|
||||||
cl::cat(PollyCategory));
|
cl::cat(PollyCategory));
|
||||||
|
|
||||||
static cl::opt<Dependences::AnalyisLevel> OptAnalysisLevel(
|
static cl::opt<Dependences::AnalysisLevel> OptAnalysisLevel(
|
||||||
"polly-dependences-analysis-level",
|
"polly-dependences-analysis-level",
|
||||||
cl::desc("The level of dependence analysis"),
|
cl::desc("The level of dependence analysis"),
|
||||||
cl::values(clEnumValN(Dependences::AL_Statement, "statement-wise",
|
cl::values(clEnumValN(Dependences::AL_Statement, "statement-wise",
|
||||||
|
@ -99,7 +99,7 @@ static __isl_give isl_map *tag(__isl_take isl_map *Relation,
|
||||||
/// Tag the @p Relation domain with either MA->getArrayId() or
|
/// Tag the @p Relation domain with either MA->getArrayId() or
|
||||||
/// MA->getId() based on @p TagLevel
|
/// MA->getId() based on @p TagLevel
|
||||||
static __isl_give isl_map *tag(__isl_take isl_map *Relation, MemoryAccess *MA,
|
static __isl_give isl_map *tag(__isl_take isl_map *Relation, MemoryAccess *MA,
|
||||||
Dependences::AnalyisLevel TagLevel) {
|
Dependences::AnalysisLevel TagLevel) {
|
||||||
if (TagLevel == Dependences::AL_Reference)
|
if (TagLevel == Dependences::AL_Reference)
|
||||||
return tag(Relation, MA->getArrayId());
|
return tag(Relation, MA->getArrayId());
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ static void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write,
|
||||||
isl_union_map **MayWrite,
|
isl_union_map **MayWrite,
|
||||||
isl_union_map **AccessSchedule,
|
isl_union_map **AccessSchedule,
|
||||||
isl_union_map **StmtSchedule,
|
isl_union_map **StmtSchedule,
|
||||||
Dependences::AnalyisLevel Level) {
|
Dependences::AnalysisLevel Level) {
|
||||||
isl_space *Space = S.getParamSpace();
|
isl_space *Space = S.getParamSpace();
|
||||||
*Read = isl_union_map_empty(isl_space_copy(Space));
|
*Read = isl_union_map_empty(isl_space_copy(Space));
|
||||||
*Write = isl_union_map_empty(isl_space_copy(Space));
|
*Write = isl_union_map_empty(isl_space_copy(Space));
|
||||||
|
@ -773,7 +773,7 @@ void Dependences::setReductionDependences(MemoryAccess *MA, isl_map *D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Dependences &
|
const Dependences &
|
||||||
DependenceInfo::getDependences(Dependences::AnalyisLevel Level) {
|
DependenceInfo::getDependences(Dependences::AnalysisLevel Level) {
|
||||||
if (Dependences *d = D[Level].get())
|
if (Dependences *d = D[Level].get())
|
||||||
return *d;
|
return *d;
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ DependenceInfo::getDependences(Dependences::AnalyisLevel Level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Dependences &
|
const Dependences &
|
||||||
DependenceInfo::recomputeDependences(Dependences::AnalyisLevel Level) {
|
DependenceInfo::recomputeDependences(Dependences::AnalysisLevel Level) {
|
||||||
D[Level].reset(new Dependences(S->getSharedIslCtx(), Level));
|
D[Level].reset(new Dependences(S->getSharedIslCtx(), Level));
|
||||||
D[Level]->calculateDependences(*S);
|
D[Level]->calculateDependences(*S);
|
||||||
return *D[Level];
|
return *D[Level];
|
||||||
|
@ -824,7 +824,7 @@ INITIALIZE_PASS_END(DependenceInfo, "polly-dependences",
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
const Dependences &
|
const Dependences &
|
||||||
DependenceInfoWrapperPass::getDependences(Scop *S,
|
DependenceInfoWrapperPass::getDependences(Scop *S,
|
||||||
Dependences::AnalyisLevel Level) {
|
Dependences::AnalysisLevel Level) {
|
||||||
auto It = ScopToDepsMap.find(S);
|
auto It = ScopToDepsMap.find(S);
|
||||||
if (It != ScopToDepsMap.end())
|
if (It != ScopToDepsMap.end())
|
||||||
if (It->second) {
|
if (It->second) {
|
||||||
|
@ -835,7 +835,7 @@ DependenceInfoWrapperPass::getDependences(Scop *S,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Dependences &DependenceInfoWrapperPass::recomputeDependences(
|
const Dependences &DependenceInfoWrapperPass::recomputeDependences(
|
||||||
Scop *S, Dependences::AnalyisLevel Level) {
|
Scop *S, Dependences::AnalysisLevel Level) {
|
||||||
std::unique_ptr<Dependences> D(new Dependences(S->getSharedIslCtx(), Level));
|
std::unique_ptr<Dependences> D(new Dependences(S->getSharedIslCtx(), Level));
|
||||||
D->calculateDependences(*S);
|
D->calculateDependences(*S);
|
||||||
auto Inserted = ScopToDepsMap.insert(std::make_pair(S, std::move(D)));
|
auto Inserted = ScopToDepsMap.insert(std::make_pair(S, std::move(D)));
|
||||||
|
|
Loading…
Reference in New Issue