diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-03-02 13:41:53 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-03-02 13:41:53 +0000 |
commit | bbf308456183bf541fe337e99521dfa0efa0fafc (patch) | |
tree | 491c7f396644c920cb6618bb39094d62d3dfeab6 /polly/lib/CodeGen/IslCodeGeneration.cpp | |
parent | 6100f61bcefb75305ec98610d29472e41a4d5aaa (diff) | |
download | bcm5719-llvm-bbf308456183bf541fe337e99521dfa0efa0fafc.tar.gz bcm5719-llvm-bbf308456183bf541fe337e99521dfa0efa0fafc.zip |
[FIX] Make parallel codegen aware of region statements
llvm-svn: 230959
Diffstat (limited to 'polly/lib/CodeGen/IslCodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index fde674d78b1..b4d23a13641 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -312,17 +312,9 @@ struct FindValuesUser { SetVector<const SCEV *> &SCEVs; }; -/// Extract the values and SCEVs needed to generate code for a ScopStmt. -/// -/// This function extracts a ScopStmt from a given isl_set and computes the -/// Values this statement depends on as well as a set of SCEV expressions that -/// need to be synthesized when generating code for this statment. -static int findValuesInStmt(isl_set *Set, void *UserPtr) { - isl_id *Id = isl_set_get_tuple_id(Set); - struct FindValuesUser &User = *static_cast<struct FindValuesUser *>(UserPtr); - const ScopStmt *Stmt = static_cast<const ScopStmt *>(isl_id_get_user(Id)); - const BasicBlock *BB = Stmt->getBasicBlock(); - +/// @brief Extract the values and SCEVs needed to generate code for a block. +static int findValuesInBlock(struct FindValuesUser &User, const ScopStmt *Stmt, + const BasicBlock *BB) { // Check all the operands of instructions in the basic block. for (const Instruction &Inst : *BB) { for (Value *SrcVal : Inst.operands()) { @@ -340,6 +332,28 @@ static int findValuesInStmt(isl_set *Set, void *UserPtr) { User.Values.insert(SrcVal); } } + return 0; +} + +/// Extract the values and SCEVs needed to generate code for a ScopStmt. +/// +/// This function extracts a ScopStmt from a given isl_set and computes the +/// Values this statement depends on as well as a set of SCEV expressions that +/// need to be synthesized when generating code for this statment. +static int findValuesInStmt(isl_set *Set, void *UserPtr) { + isl_id *Id = isl_set_get_tuple_id(Set); + struct FindValuesUser &User = *static_cast<struct FindValuesUser *>(UserPtr); + const ScopStmt *Stmt = static_cast<const ScopStmt *>(isl_id_get_user(Id)); + + if (Stmt->isBlockStmt()) + findValuesInBlock(User, Stmt, Stmt->getBasicBlock()); + else { + assert(Stmt->isRegionStmt() && + "Stmt was neither block nor region statement"); + for (const BasicBlock *BB : Stmt->getRegion()->blocks()) + findValuesInBlock(User, Stmt, BB); + } + isl_id_free(Id); isl_set_free(Set); return 0; |