#include "polly/CodeGen/IslAst.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "isl/aff.h"
#include "isl/ast.h"
#include "isl/ast_build.h"
#include "isl/id.h"
#include "isl/isl-noexceptions.h"
#include "isl/printer.h"
#include "isl/schedule.h"
#include "isl/set.h"
#include "isl/union_map.h"
#include "isl/val.h"
#include <cassert>
#include <cstdlib>
#include "polly/Support/PollyDebug.h"
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacepolly;
IslAstUserPayload;
static cl::opt<bool>
PollyParallel("polly-parallel",
cl::desc("Generate thread parallel code (isl codegen only)"),
cl::cat(PollyCategory));
static cl::opt<bool> PrintAccesses("polly-ast-print-accesses",
cl::desc("Print memory access functions"),
cl::cat(PollyCategory));
static cl::opt<bool> PollyParallelForce(
"polly-parallel-force",
cl::desc(
"Force generation of thread parallel code ignoring any cost model"),
cl::cat(PollyCategory));
static cl::opt<bool> UseContext("polly-ast-use-context",
cl::desc("Use context"), cl::Hidden,
cl::init(true), cl::cat(PollyCategory));
static cl::opt<bool> DetectParallel("polly-ast-detect-parallel",
cl::desc("Detect parallelism"), cl::Hidden,
cl::cat(PollyCategory));
STATISTIC(ScopsProcessed, "Number of SCoPs processed");
STATISTIC(ScopsBeneficial, "Number of beneficial SCoPs");
STATISTIC(BeneficialAffineLoops, "Number of beneficial affine loops");
STATISTIC(BeneficialBoxedLoops, "Number of beneficial boxed loops");
STATISTIC(NumForLoops, "Number of for-loops");
STATISTIC(NumParallel, "Number of parallel for-loops");
STATISTIC(NumInnermostParallel, "Number of innermost parallel for-loops");
STATISTIC(NumOutermostParallel, "Number of outermost parallel for-loops");
STATISTIC(NumReductionParallel, "Number of reduction-parallel for-loops");
STATISTIC(NumExecutedInParallel, "Number of for-loops executed in parallel");
STATISTIC(NumIfConditions, "Number of if-conditions");
namespace polly {
struct AstBuildUserInfo { … };
}
static void freeIslAstUserPayload(void *Ptr) { … }
static isl_printer *printLine(__isl_take isl_printer *Printer,
const std::string &str,
__isl_keep isl_pw_aff *PWA = nullptr) { … }
static const std::string getBrokenReductionsStr(const isl::ast_node &Node) { … }
static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
__isl_take isl_ast_print_options *Options,
__isl_keep isl_ast_node *Node, void *) { … }
static bool astScheduleDimIsParallel(const isl::ast_build &Build,
const Dependences *D,
IslAstUserPayload *NodeInfo) { … }
static __isl_give isl_id *astBuildBeforeFor(__isl_keep isl_ast_build *Build,
void *User) { … }
static __isl_give isl_ast_node *
astBuildAfterFor(__isl_take isl_ast_node *Node, __isl_keep isl_ast_build *Build,
void *User) { … }
static isl_stat astBuildBeforeMark(__isl_keep isl_id *MarkId,
__isl_keep isl_ast_build *Build,
void *User) { … }
static __isl_give isl_ast_node *
astBuildAfterMark(__isl_take isl_ast_node *Node,
__isl_keep isl_ast_build *Build, void *User) { … }
static __isl_give isl_ast_node *AtEachDomain(__isl_take isl_ast_node *Node,
__isl_keep isl_ast_build *Build,
void *User) { … }
static isl::ast_expr buildCondition(Scop &S, isl::ast_build Build,
const Scop::MinMaxAccessTy *It0,
const Scop::MinMaxAccessTy *It1) { … }
isl::ast_expr IslAst::buildRunCondition(Scop &S, const isl::ast_build &Build) { … }
static bool benefitsFromPolly(Scop &Scop, bool PerformParallelTest) { … }
static void walkAstForStatistics(const isl::ast_node &Ast) { … }
IslAst::IslAst(Scop &Scop) : … { … }
IslAst::IslAst(IslAst &&O)
: … { … }
void IslAst::init(const Dependences &D) { … }
IslAst IslAst::create(Scop &Scop, const Dependences &D) { … }
isl::ast_node IslAst::getAst() { … }
isl::ast_expr IslAst::getRunCondition() { … }
isl::ast_node IslAstInfo::getAst() { … }
isl::ast_expr IslAstInfo::getRunCondition() { … }
IslAstUserPayload *IslAstInfo::getNodePayload(const isl::ast_node &Node) { … }
bool IslAstInfo::isInnermost(const isl::ast_node &Node) { … }
bool IslAstInfo::isParallel(const isl::ast_node &Node) { … }
bool IslAstInfo::isInnermostParallel(const isl::ast_node &Node) { … }
bool IslAstInfo::isOutermostParallel(const isl::ast_node &Node) { … }
bool IslAstInfo::isReductionParallel(const isl::ast_node &Node) { … }
bool IslAstInfo::isExecutedInParallel(const isl::ast_node &Node) { … }
isl::union_map IslAstInfo::getSchedule(const isl::ast_node &Node) { … }
isl::pw_aff
IslAstInfo::getMinimalDependenceDistance(const isl::ast_node &Node) { … }
IslAstInfo::MemoryAccessSet *
IslAstInfo::getBrokenReductions(const isl::ast_node &Node) { … }
isl::ast_build IslAstInfo::getBuild(const isl::ast_node &Node) { … }
static std::unique_ptr<IslAstInfo> runIslAst(
Scop &Scop,
function_ref<const Dependences &(Dependences::AnalysisLevel)> GetDeps) { … }
IslAstInfo IslAstAnalysis::run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR) { … }
static __isl_give isl_printer *cbPrintUser(__isl_take isl_printer *P,
__isl_take isl_ast_print_options *O,
__isl_keep isl_ast_node *Node,
void *User) { … }
void IslAstInfo::print(raw_ostream &OS) { … }
AnalysisKey IslAstAnalysis::Key;
PreservedAnalyses IslAstPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR,
SPMUpdater &U) { … }
void IslAstInfoWrapperPass::releaseMemory() { … }
bool IslAstInfoWrapperPass::runOnScop(Scop &Scop) { … }
void IslAstInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { … }
void IslAstInfoWrapperPass::printScop(raw_ostream &OS, Scop &S) const { … }
char IslAstInfoWrapperPass::ID = …;
Pass *polly::createIslAstInfoWrapperPassPass() { … }
INITIALIZE_PASS_BEGIN(IslAstInfoWrapperPass, "polly-ast",
"Polly - Generate an AST of the SCoP (isl)", false,
false);
INITIALIZE_PASS_DEPENDENCY(ScopInfoRegionPass);
INITIALIZE_PASS_DEPENDENCY(DependenceInfo);
INITIALIZE_PASS_END(IslAstInfoWrapperPass, "polly-ast",
"Polly - Generate an AST from the SCoP (isl)", false, false)
namespace {
class IslAstInfoPrinterLegacyPass final : public ScopPass { … };
char IslAstInfoPrinterLegacyPass::ID = …;
}
Pass *polly::createIslAstInfoPrinterLegacyPass(raw_ostream &OS) { … }
INITIALIZE_PASS_BEGIN(IslAstInfoPrinterLegacyPass, "polly-print-ast",
"Polly - Print the AST from a SCoP (isl)", false, false);
INITIALIZE_PASS_DEPENDENCY(IslAstInfoWrapperPass);
INITIALIZE_PASS_END(IslAstInfoPrinterLegacyPass, "polly-print-ast",
"Polly - Print the AST from a SCoP (isl)", false, false)