#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLTools.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/Support/Debug.h"
#include "isl/aff.h"
#include "isl/ctx.h"
#include "isl/flow.h"
#include "isl/map.h"
#include "isl/schedule.h"
#include "isl/set.h"
#include "isl/union_map.h"
#include "isl/union_set.h"
usingnamespacepolly;
usingnamespacellvm;
#include "polly/Support/PollyDebug.h"
#define DEBUG_TYPE …
static cl::opt<int> OptComputeOut(
"polly-dependences-computeout",
cl::desc("Bound the dependence analysis by a maximal amount of "
"computational steps (0 means no bound)"),
cl::Hidden, cl::init(500000), cl::cat(PollyCategory));
static cl::opt<bool>
LegalityCheckDisabled("disable-polly-legality",
cl::desc("Disable polly legality check"), cl::Hidden,
cl::cat(PollyCategory));
static cl::opt<bool>
UseReductions("polly-dependences-use-reductions",
cl::desc("Exploit reductions in dependence analysis"),
cl::Hidden, cl::init(true), cl::cat(PollyCategory));
enum AnalysisType { … };
static cl::opt<enum AnalysisType> OptAnalysisType(
"polly-dependences-analysis-type",
cl::desc("The kind of dependence analysis to use"),
cl::values(clEnumValN(VALUE_BASED_ANALYSIS, "value-based",
"Exact dependences without transitive dependences"),
clEnumValN(MEMORY_BASED_ANALYSIS, "memory-based",
"Overapproximation of dependences")),
cl::Hidden, cl::init(VALUE_BASED_ANALYSIS), cl::cat(PollyCategory));
static cl::opt<Dependences::AnalysisLevel> OptAnalysisLevel(
"polly-dependences-analysis-level",
cl::desc("The level of dependence analysis"),
cl::values(clEnumValN(Dependences::AL_Statement, "statement-wise",
"Statement-level analysis"),
clEnumValN(Dependences::AL_Reference, "reference-wise",
"Memory reference level analysis that distinguish"
" accessed references in the same statement"),
clEnumValN(Dependences::AL_Access, "access-wise",
"Memory reference level analysis that distinguish"
" access instructions in the same statement")),
cl::Hidden, cl::init(Dependences::AL_Statement), cl::cat(PollyCategory));
static __isl_give isl_map *tag(__isl_take isl_map *Relation,
__isl_take isl_id *TagId) { … }
static __isl_give isl_map *tag(__isl_take isl_map *Relation, MemoryAccess *MA,
Dependences::AnalysisLevel TagLevel) { … }
static void collectInfo(Scop &S, isl_union_map *&Read,
isl_union_map *&MustWrite, isl_union_map *&MayWrite,
isl_union_map *&ReductionTagMap,
isl_union_set *&TaggedStmtDomain,
Dependences::AnalysisLevel Level) { … }
static void fixSetToZero(isl::set Zero, isl::union_set *User) { … }
void Dependences::addPrivatizationDependences() { … }
static __isl_give isl_union_flow *buildFlow(__isl_keep isl_union_map *Snk,
__isl_keep isl_union_map *Src,
__isl_keep isl_union_map *MaySrc,
__isl_keep isl_union_map *Kill,
__isl_keep isl_schedule *Schedule) { … }
void Dependences::calculateDependences(Scop &S) { … }
bool Dependences::isValidSchedule(Scop &S, isl::schedule NewSched) const { … }
bool Dependences::isValidSchedule(
Scop &S, const StatementToIslMapTy &NewSchedule) const { … }
bool Dependences::isParallel(__isl_keep isl_union_map *Schedule,
__isl_take isl_union_map *Deps,
__isl_give isl_pw_aff **MinDistancePtr) const { … }
static void printDependencyMap(raw_ostream &OS, __isl_keep isl_union_map *DM) { … }
void Dependences::print(raw_ostream &OS) const { … }
void Dependences::dump() const { … }
void Dependences::releaseMemory() { … }
isl::union_map Dependences::getDependences(int Kinds) const { … }
bool Dependences::hasValidDependences() const { … }
__isl_give isl_map *
Dependences::getReductionDependences(MemoryAccess *MA) const { … }
void Dependences::setReductionDependences(MemoryAccess *MA,
__isl_take isl_map *D) { … }
const Dependences &
DependenceAnalysis::Result::getDependences(Dependences::AnalysisLevel Level) { … }
const Dependences &DependenceAnalysis::Result::recomputeDependences(
Dependences::AnalysisLevel Level) { … }
void DependenceAnalysis::Result::abandonDependences() { … }
DependenceAnalysis::Result
DependenceAnalysis::run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR) { … }
AnalysisKey DependenceAnalysis::Key;
PreservedAnalyses
DependenceInfoPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR,
SPMUpdater &U) { … }
const Dependences &
DependenceInfo::getDependences(Dependences::AnalysisLevel Level) { … }
const Dependences &
DependenceInfo::recomputeDependences(Dependences::AnalysisLevel Level) { … }
void DependenceInfo::abandonDependences() { … }
bool DependenceInfo::runOnScop(Scop &ScopVar) { … }
void polly::DependenceInfo::printScop(raw_ostream &OS, Scop &S) const { … }
void DependenceInfo::getAnalysisUsage(AnalysisUsage &AU) const { … }
char DependenceInfo::ID = …;
Pass *polly::createDependenceInfoPass() { … }
INITIALIZE_PASS_BEGIN(DependenceInfo, "polly-dependences",
"Polly - Calculate dependences", false, false);
INITIALIZE_PASS_DEPENDENCY(ScopInfoRegionPass);
INITIALIZE_PASS_END(DependenceInfo, "polly-dependences",
"Polly - Calculate dependences", false, false)
namespace {
class DependenceInfoPrinterLegacyPass final : public ScopPass { … };
char DependenceInfoPrinterLegacyPass::ID = …;
}
Pass *polly::createDependenceInfoPrinterLegacyPass(raw_ostream &OS) { … }
INITIALIZE_PASS_BEGIN(DependenceInfoPrinterLegacyPass,
"polly-print-dependences", "Polly - Print dependences",
false, false);
INITIALIZE_PASS_DEPENDENCY(DependenceInfo);
INITIALIZE_PASS_END(DependenceInfoPrinterLegacyPass, "polly-print-dependences",
"Polly - Print dependences", false, false)
const Dependences &
DependenceInfoWrapperPass::getDependences(Scop *S,
Dependences::AnalysisLevel Level) { … }
const Dependences &DependenceInfoWrapperPass::recomputeDependences(
Scop *S, Dependences::AnalysisLevel Level) { … }
bool DependenceInfoWrapperPass::runOnFunction(Function &F) { … }
void DependenceInfoWrapperPass::print(raw_ostream &OS, const Module *M) const { … }
void DependenceInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { … }
char DependenceInfoWrapperPass::ID = …;
Pass *polly::createDependenceInfoWrapperPassPass() { … }
INITIALIZE_PASS_BEGIN(
DependenceInfoWrapperPass, "polly-function-dependences",
"Polly - Calculate dependences for all the SCoPs of a function", false,
false)
INITIALIZE_PASS_DEPENDENCY(ScopInfoWrapperPass);
INITIALIZE_PASS_END(
DependenceInfoWrapperPass, "polly-function-dependences",
"Polly - Calculate dependences for all the SCoPs of a function", false,
false)
namespace {
class DependenceInfoPrinterLegacyFunctionPass final : public FunctionPass { … };
char DependenceInfoPrinterLegacyFunctionPass::ID = …;
}
Pass *polly::createDependenceInfoPrinterLegacyFunctionPass(raw_ostream &OS) { … }
INITIALIZE_PASS_BEGIN(
DependenceInfoPrinterLegacyFunctionPass, "polly-print-function-dependences",
"Polly - Print dependences for all the SCoPs of a function", false, false);
INITIALIZE_PASS_DEPENDENCY(DependenceInfoWrapperPass);
INITIALIZE_PASS_END(DependenceInfoPrinterLegacyFunctionPass,
"polly-print-function-dependences",
"Polly - Print dependences for all the SCoPs of a function",
false, false)