#include "polly/ScheduleTreeTransform.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLTools.h"
#include "polly/Support/ScopHelper.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Transforms/Utils/UnrollLoop.h"
#include "polly/Support/PollyDebug.h"
#define DEBUG_TYPE …
usingnamespacepolly;
usingnamespacellvm;
namespace {
static isl::schedule_node_band
applyBandMemberAttributes(isl::schedule_node_band Target, int TargetIdx,
const isl::schedule_node_band &Source,
int SourceIdx) { … }
template <typename CbTy>
static isl::schedule rebuildBand(isl::schedule_node_band OldBand,
isl::schedule Body, CbTy IncludeCb) { … }
template <typename Derived, typename... Args>
struct ScheduleTreeRewriter
: RecursiveScheduleTreeVisitor<Derived, isl::schedule, Args...> { … };
struct IdentityRewriter : ScheduleTreeRewriter<IdentityRewriter> { … };
struct ExtensionNodeRewriter final
: ScheduleTreeRewriter<ExtensionNodeRewriter, const isl::union_set &,
isl::union_map &> { … };
struct CollectASTBuildOptions final
: RecursiveScheduleTreeVisitor<CollectASTBuildOptions> { … };
struct ApplyASTBuildOptions final : ScheduleNodeRewriter<ApplyASTBuildOptions> { … };
static bool containsExtensionNode(isl::schedule Schedule) { … }
static MDNode *findOptionalNodeOperand(MDNode *LoopMD, StringRef Name) { … }
static bool isMark(const isl::schedule_node &Node) { … }
static bool isBand(const isl::schedule_node &Node) { … }
#ifndef NDEBUG
static bool isBandWithSingleLoop(const isl::schedule_node &Node) {
return isBand(Node) && isl_schedule_node_band_n_member(Node.get()) == 1;
}
#endif
static bool isLeaf(const isl::schedule_node &Node) { … }
static isl::id createGeneratedLoopAttr(isl::ctx Ctx, MDNode *FollowupLoopMD) { … }
static isl::schedule_node moveToBandMark(isl::schedule_node BandOrMark) { … }
static isl::schedule_node removeMark(isl::schedule_node MarkOrBand,
BandAttr *&Attr) { … }
static isl::schedule_node removeMark(isl::schedule_node MarkOrBand) { … }
static isl::schedule_node insertMark(isl::schedule_node Band, isl::id Mark) { … }
static isl::basic_set isDivisibleBySet(isl::ctx &Ctx, long Factor,
long Offset) { … }
static isl::set addExtentConstraints(isl::set Set, int VectorWidth) { … }
class BandCollapseRewriter final
: public ScheduleTreeRewriter<BandCollapseRewriter> { … };
static isl::schedule collapseBands(isl::schedule Sched) { … }
static void collectPotentiallyFusableBands(
isl::schedule_node Node,
SmallVectorImpl<std::pair<isl::schedule_node, isl::schedule_node>>
&ScheduleBands,
const isl::schedule_node &DirectChild) { … }
static isl::union_map remainingDepsFromPartialSchedule(isl::union_map PartSched,
isl::union_map Deps) { … }
static isl::union_map remainigDepsFromSequence(ArrayRef<isl::union_set> Domains,
isl::union_map Deps) { … }
static bool canFuseOutermost(const isl::schedule_node_band &LHS,
const isl::schedule_node_band &RHS,
const isl::union_map &Deps) { … }
static isl::schedule tryGreedyFuse(isl::schedule_node_band LHS,
isl::schedule_node_band RHS,
const isl::union_map &Deps) { … }
static isl::schedule tryGreedyFuse(isl::schedule_node LHS,
isl::schedule_node RHS,
const isl::union_map &Deps) { … }
class GreedyFusionRewriter final
: public ScheduleTreeRewriter<GreedyFusionRewriter, isl::union_map> { … };
}
bool polly::isBandMark(const isl::schedule_node &Node) { … }
BandAttr *polly::getBandAttr(isl::schedule_node MarkOrBand) { … }
isl::schedule polly::hoistExtensionNodes(isl::schedule Sched) { … }
isl::schedule polly::applyFullUnroll(isl::schedule_node BandToUnroll) { … }
isl::schedule polly::applyPartialUnroll(isl::schedule_node BandToUnroll,
int Factor) { … }
isl::set polly::getPartialTilePrefixes(isl::set ScheduleRange,
int VectorWidth) { … }
isl::union_set polly::getIsolateOptions(isl::set IsolateDomain,
unsigned OutDimsNum) { … }
isl::union_set polly::getDimOptions(isl::ctx Ctx, const char *Option) { … }
isl::schedule_node polly::tileNode(isl::schedule_node Node,
const char *Identifier,
ArrayRef<int> TileSizes,
int DefaultTileSize) { … }
isl::schedule_node polly::applyRegisterTiling(isl::schedule_node Node,
ArrayRef<int> TileSizes,
int DefaultTileSize) { … }
static void
collectFissionableStmts(isl::schedule_node Node,
SmallVectorImpl<isl::schedule_node> &ScheduleStmts) { … }
isl::schedule polly::applyMaxFission(isl::schedule_node BandToFission) { … }
isl::schedule polly::applyGreedyFusion(isl::schedule Sched,
const isl::union_map &Deps) { … }