forked from OSchip/llvm-project
IslAst: Expose run-time check generation as individual function
This allows to construct run-time checks for a scop without having to generate a full AST. This is currently not taken advantage of in Polly itself, but external users may benefit from this feature. llvm-svn: 262009
This commit is contained in:
parent
470734b512
commit
64ca00c344
|
@ -56,6 +56,15 @@ public:
|
|||
/// @brief Get the run-time conditions for the Scop.
|
||||
__isl_give isl_ast_expr *getRunCondition();
|
||||
|
||||
/// @brief Build run-time condition for scop.
|
||||
///
|
||||
/// @param S The scop to build the condition for.
|
||||
/// @param Build The isl_build object to use to build the condition.
|
||||
///
|
||||
/// @returns An ast expression that describes the necessary run-time check.
|
||||
static isl_ast_expr *buildRunCondition(Scop *S,
|
||||
__isl_keep isl_ast_build *Build);
|
||||
|
||||
private:
|
||||
Scop *S;
|
||||
isl_ast_node *Root;
|
||||
|
@ -64,8 +73,6 @@ private:
|
|||
|
||||
IslAst(Scop *Scop);
|
||||
void init(const Dependences &D);
|
||||
|
||||
void buildRunCondition(__isl_keep isl_ast_build *Build);
|
||||
};
|
||||
|
||||
class IslAstInfo : public ScopPass {
|
||||
|
|
|
@ -329,7 +329,10 @@ buildCondition(__isl_keep isl_ast_build *Build, const Scop::MinMaxAccessTy *It0,
|
|||
return NonAliasGroup;
|
||||
}
|
||||
|
||||
void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
|
||||
__isl_give isl_ast_expr *
|
||||
IslAst::buildRunCondition(Scop *S, __isl_keep isl_ast_build *Build) {
|
||||
isl_ast_expr *RunCondition;
|
||||
|
||||
// The conditions that need to be checked at run-time for this scop are
|
||||
// available as an isl_set in the runtime check context from which we can
|
||||
// directly derive a run-time condition.
|
||||
|
@ -355,6 +358,8 @@ void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
|
|||
RunCondition, buildCondition(Build, RWAccIt0, &ROAccIt));
|
||||
}
|
||||
}
|
||||
|
||||
return RunCondition;
|
||||
}
|
||||
|
||||
/// @brief Simple cost analysis for a given SCoP
|
||||
|
@ -418,7 +423,7 @@ void IslAst::init(const Dependences &D) {
|
|||
&BuildInfo);
|
||||
}
|
||||
|
||||
buildRunCondition(Build);
|
||||
RunCondition = buildRunCondition(S, Build);
|
||||
|
||||
Root = isl_ast_build_node_from_schedule(Build, S->getScheduleTree());
|
||||
|
||||
|
|
Loading…
Reference in New Issue