13#ifndef POLLY_SCHEDULETREETRANSFORM_H
14#define POLLY_SCHEDULETREETRANSFORM_H
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/Support/ErrorHandling.h"
27template <
typename Derived,
typename RetTy = void,
typename... Args>
29 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
31 return *
static_cast<const Derived *
>(
this);
40 std::forward<Args>(args)...);
44 std::forward<Args>(args)...);
48 std::forward<Args>(args)...);
52 std::forward<Args>(args)...);
56 std::forward<Args>(args)...);
60 std::forward<Args>(args)...);
68 std::forward<Args>(args)...);
70 llvm_unreachable(
"unimplemented schedule node type");
76 std::forward<Args>(args)...);
80 return getDerived().visitSingleChild(std::move(Band),
81 std::forward<Args>(args)...);
85 return getDerived().visitMultiChild(std::move(Sequence),
86 std::forward<Args>(args)...);
90 return getDerived().visitMultiChild(std::move(Set),
91 std::forward<Args>(args)...);
95 return getDerived().visitNode(std::move(
Leaf), std::forward<Args>(args)...);
99 return getDerived().visitSingleChild(std::move(Mark),
100 std::forward<Args>(args)...);
104 return getDerived().visitSingleChild(std::move(Extension),
105 std::forward<Args>(args)...);
109 return getDerived().visitSingleChild(std::move(Filter),
110 std::forward<Args>(args)...);
114 return getDerived().visitNode(std::move(Node), std::forward<Args>(args)...);
118 return getDerived().visitNode(std::move(Node), std::forward<Args>(args)...);
122 llvm_unreachable(
"Unimplemented other");
127template <
typename Derived,
typename RetTy = void,
typename... Args>
133 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
135 return *
static_cast<const Derived *
>(
this);
146 return getBase().
visit(Node, std::forward<Args>(args)...);
162template <
typename Derived,
typename... Args>
166 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
168 return *
static_cast<const Derived *
>(
this);
181 It =
getDerived().visit(It, std::forward<Args>(args)...);
264 llvm::ArrayRef<int> TileSizes,
int DefaultTileSize);
273 llvm::ArrayRef<int> TileSizes,
274 int DefaultTileSize);
boolean has_next_sibling() const
isl::schedule_node child(int pos) const
boolean has_children() const
isl::schedule_node next_sibling() const
class size n_children() const
isl::schedule_node parent() const
isl::schedule_node first_child() const
__isl_keep isl_schedule_node * get() const
isl::schedule_node get_root() const
enum isl_schedule_node_type isl_schedule_node_get_type(__isl_keep isl_schedule_node *node)
isl::schedule_node applyRegisterTiling(isl::schedule_node Node, llvm::ArrayRef< int > TileSizes, int DefaultTileSize)
Tile a schedule node and unroll point loops.
isl::schedule applyGreedyFusion(isl::schedule Sched, const isl::union_map &Deps)
Apply greedy fusion.
llvm::iota_range< unsigned > rangeIslSize(unsigned Begin, isl::size End)
Check that End is valid and return an iterator from Begin to End.
BandAttr * getBandAttr(isl::schedule_node MarkOrBand)
Extract the BandAttr from a band's wrapping marker.
bool isBandMark(const isl::schedule_node &Node)
Is this node the marker for its parent band?
isl::schedule applyMaxFission(isl::schedule_node BandToFission)
Loop-distribute the band BandToFission as much as possible.
isl::union_set getIsolateOptions(isl::set IsolateDomain, unsigned OutDimsNum)
Create an isl::union_set, which describes the isolate option based on IsolateDomain.
isl::schedule applyPartialUnroll(isl::schedule_node BandToUnroll, int Factor)
Replace the AST band BandToUnroll by a partially unrolled equivalent.
isl::schedule_node tileNode(isl::schedule_node Node, const char *Identifier, llvm::ArrayRef< int > TileSizes, int DefaultTileSize)
Tile a schedule node.
isl::union_set getDimOptions(isl::ctx Ctx, const char *Option)
Create an isl::union_set, which describes the specified option for the dimension of the current node.
isl::schedule hoistExtensionNodes(isl::schedule Sched)
Hoist all domains from extension into the root domain node, such that there are no more extension nod...
isl::set getPartialTilePrefixes(isl::set ScheduleRange, int VectorWidth)
Build the desired set of partial tile prefixes.
isl::schedule applyFullUnroll(isl::schedule_node BandToUnroll)
Replace the AST band BandToUnroll by a sequence of all its iterations.
__isl_export isl_size isl_schedule_node_n_children(__isl_keep isl_schedule_node *node)
@ isl_schedule_node_filter
@ isl_schedule_node_domain
@ isl_schedule_node_extension
@ isl_schedule_node_sequence
Recursively visit all nodes of a schedule tree.
RetTy visitNode(isl::schedule_node Node, Args... args)
By default, recursively visit the child nodes.
RetTy visit(isl::schedule Schedule, Args... args)
When visiting an entire schedule tree, start at its root node.
const BaseTy & getBase() const
RetTy visit(isl::schedule_node Node, Args... args)
const Derived & getDerived() const
Recursively visit all nodes of a schedule tree while allowing changes.
const Derived & getDerived() const
isl::schedule_node visitChildren(isl::schedule_node Node, Args... args)
isl::schedule_node visitNode(isl::schedule_node Node, Args... args)
This class defines a simple visitor class that may be used for various schedule tree analysis purpose...
RetTy visitExtension(isl::schedule_node_extension Extension, Args... args)
RetTy visitMark(isl::schedule_node_mark Mark, Args... args)
RetTy visitSequence(isl::schedule_node_sequence Sequence, Args... args)
RetTy visitSingleChild(isl::schedule_node Node, Args... args)
RetTy visitSet(isl::schedule_node_set Set, Args... args)
const Derived & getDerived() const
RetTy visitMultiChild(isl::schedule_node Node, Args... args)
RetTy visitBand(isl::schedule_node_band Band, Args... args)
RetTy visitDomain(isl::schedule_node_domain Domain, Args... args)
RetTy visitFilter(isl::schedule_node_filter Filter, Args... args)
RetTy visitNode(isl::schedule_node Node, Args... args)
RetTy visitLeaf(isl::schedule_node_leaf Leaf, Args... args)
RetTy visit(isl::schedule_node Node, Args... args)
static TupleKindPtr Domain("Domain")
static TupleKindPtr Leaf("Leaf")