Changeset View
Changeset View
Standalone View
Standalone View
lib/CodeGen/IslAst.cpp
Show All 19 Lines | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "polly/CodeGen/CodeGeneration.h" | #include "polly/CodeGen/CodeGeneration.h" | ||||
#include "polly/CodeGen/IslAst.h" | #include "polly/CodeGen/IslAst.h" | ||||
#include "polly/Dependences.h" | #include "polly/Dependences.h" | ||||
#include "polly/LinkAllPasses.h" | #include "polly/LinkAllPasses.h" | ||||
#include "polly/Options.h" | #include "polly/Options.h" | ||||
#include "polly/ScopInfo.h" | #include "polly/ScopInfo.h" | ||||
#include "polly/Support/GICHelper.h" | |||||
#include "llvm/Support/Debug.h" | #include "llvm/Support/Debug.h" | ||||
#include "isl/union_map.h" | #include "isl/union_map.h" | ||||
#include "isl/list.h" | #include "isl/list.h" | ||||
#include "isl/ast_build.h" | #include "isl/ast_build.h" | ||||
#include "isl/set.h" | #include "isl/set.h" | ||||
#include "isl/map.h" | #include "isl/map.h" | ||||
#include "isl/aff.h" | #include "isl/aff.h" | ||||
▲ Show 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | IslAstInfo::getBrokenReductions(__isl_keep isl_ast_node *Node) { | ||||
return Payload ? &Payload->BrokenReductions : nullptr; | return Payload ? &Payload->BrokenReductions : nullptr; | ||||
} | } | ||||
isl_ast_build *IslAstInfo::getBuild(__isl_keep isl_ast_node *Node) { | isl_ast_build *IslAstInfo::getBuild(__isl_keep isl_ast_node *Node) { | ||||
IslAstUserPayload *Payload = getNodePayload(Node); | IslAstUserPayload *Payload = getNodePayload(Node); | ||||
return Payload ? Payload->Build : nullptr; | return Payload ? Payload->Build : nullptr; | ||||
} | } | ||||
isl_pw_aff *IslAstInfo::getNumberOfIterations(isl_ast_node *For) { | |||||
isl_union_map *Schedule = IslAstInfo::getSchedule(For); | |||||
return Schedule ? getNumberOfIterationsForSchedule(Schedule) : nullptr; | |||||
} | |||||
int IslAstInfo::getNumberOfIterationsAsInt(isl_ast_node *For) { | |||||
isl_pw_aff *NumItPAff = getNumberOfIterations(For); | |||||
if (!NumItPAff || !isl_pw_aff_is_cst(NumItPAff) || | |||||
isl_pw_aff_n_piece(NumItPAff) != 1) { | |||||
isl_pw_aff_free(NumItPAff); | |||||
return -1; | |||||
} | |||||
isl_aff *NumItAff = isl_aff_from_pw_aff(NumItPAff); | |||||
assert(isl_aff_is_cst(NumItAff) && "Assumed affine function to be constant"); | |||||
isl_val *NumItVal = isl_aff_get_constant_val(NumItAff); | |||||
isl_aff_free(NumItAff); | |||||
int NumItInt = isl_val_get_num_si(NumItVal); | |||||
isl_val_free(NumItVal); | |||||
return NumItInt; | |||||
} | |||||
void IslAstInfo::printScop(raw_ostream &OS) const { | void IslAstInfo::printScop(raw_ostream &OS) const { | ||||
isl_ast_print_options *Options; | isl_ast_print_options *Options; | ||||
isl_ast_node *RootNode = getAst(); | isl_ast_node *RootNode = getAst(); | ||||
isl_ast_expr *RunCondition = getRunCondition(); | isl_ast_expr *RunCondition = getRunCondition(); | ||||
char *RtCStr, *AstStr; | char *RtCStr, *AstStr; | ||||
Scop &S = getCurScop(); | Scop &S = getCurScop(); | ||||
Options = isl_ast_print_options_alloc(S.getIslCtx()); | Options = isl_ast_print_options_alloc(S.getIslCtx()); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |