forked from OSchip/llvm-project
ScopInfo: Use separate function to build context
llvm-svn: 141253
This commit is contained in:
parent
3748705fff
commit
0e27e24751
|
@ -20,6 +20,8 @@
|
|||
#ifndef POLLY_SCOP_INFO_H
|
||||
#define POLLY_SCOP_INFO_H
|
||||
|
||||
#include "polly/ScopDetection.h"
|
||||
|
||||
#include "llvm/Analysis/RegionPass.h"
|
||||
|
||||
#include "isl/ctx.h"
|
||||
|
@ -39,7 +41,6 @@ namespace llvm {
|
|||
struct isl_map;
|
||||
struct isl_basic_map;
|
||||
struct isl_set;
|
||||
struct isl_ctx;
|
||||
struct isl_space;
|
||||
struct isl_constraint;
|
||||
|
||||
|
@ -418,6 +419,12 @@ class Scop {
|
|||
/// @return True if the basic block is trivial, otherwise false.
|
||||
static bool isTrivialBB(BasicBlock *BB, TempScop &tempScop);
|
||||
|
||||
/// @brief Build the Context of the Scop.
|
||||
///
|
||||
/// @param IslCtx The isl context to use.
|
||||
/// @param ParamSet The list of all parameters in the SCoP.
|
||||
void buildContext(isl_ctx *IslCtx, ParamSetType *ParamSet);
|
||||
|
||||
/// Build the Scop and Statement with precalculate scop information.
|
||||
void buildScop(TempScop &TempScop, const Region &CurRegion,
|
||||
// Loops in Scop containing CurRegion
|
||||
|
|
|
@ -869,22 +869,18 @@ void ScopStmt::dump() const { print(dbgs()); }
|
|||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// Scop class implement
|
||||
Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
|
||||
isl_ctx *ctx)
|
||||
: SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
|
||||
MaxLoopDepth(tempScop.getMaxLoopDepth()) {
|
||||
ParamSetType &Params = tempScop.getParamSet();
|
||||
Parameters.insert(Parameters.begin(), Params.begin(), Params.end());
|
||||
|
||||
isl_space *Space = isl_space_set_alloc(ctx, getNumParams(), 0);
|
||||
void Scop::buildContext(isl_ctx *IslCtx, ParamSetType *ParamSet) {
|
||||
isl_space *Space = isl_space_params_alloc(IslCtx, ParamSet->size());
|
||||
|
||||
int i = 0;
|
||||
for (ParamSetType::iterator PI = Params.begin(), PE = Params.end();
|
||||
for (ParamSetType::iterator PI = ParamSet->begin(), PE = ParamSet->end();
|
||||
PI != PE; ++PI) {
|
||||
const SCEV *scev = *PI;
|
||||
isl_id *id = isl_id_alloc(ctx,
|
||||
("p" + convertInt(i)).c_str(),
|
||||
(void *) scev);
|
||||
const SCEV *Parameter = *PI;
|
||||
Parameters.push_back(Parameter);
|
||||
std::string ParameterName = "p" + convertInt(i);
|
||||
isl_id *id = isl_id_alloc(IslCtx, ParameterName.c_str(),
|
||||
(void *) Parameter);
|
||||
Space = isl_space_set_dim_id(Space, isl_dim_param, i, id);
|
||||
i++;
|
||||
}
|
||||
|
@ -892,6 +888,13 @@ Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
|
|||
// TODO: Insert relations between parameters.
|
||||
// TODO: Insert constraints on parameters.
|
||||
Context = isl_set_universe (Space);
|
||||
}
|
||||
|
||||
Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
|
||||
isl_ctx *Context)
|
||||
: SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
|
||||
MaxLoopDepth(tempScop.getMaxLoopDepth()) {
|
||||
buildContext(Context, &tempScop.getParamSet());
|
||||
|
||||
SmallVector<Loop*, 8> NestLoops;
|
||||
SmallVector<unsigned, 8> Scatter;
|
||||
|
|
|
@ -47,7 +47,7 @@ bb2: ; preds = %bb, %entry
|
|||
}
|
||||
|
||||
; CHECK: Context:
|
||||
; CHECK: [p0] -> { [] }
|
||||
; CHECK: [p0] -> { : }
|
||||
; CHECK: Statements {
|
||||
; CHECK: Stmt_bb_nph
|
||||
; CHECK: Domain :=
|
||||
|
|
Loading…
Reference in New Issue