diff options
author | Li Feng <nemokingdom@gmail.com> | 2009-11-25 05:24:43 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-11-25 05:24:43 +0000 |
commit | a7ed27aca8d66e927c33e0338818210ffa866828 (patch) | |
tree | e63e0093ba560368a701634c0bcca4eef54db483 | |
parent | 8e6ef139122f2f2209b7cde869b36de3f68dc82f (diff) | |
download | gcc-a7ed27aca8d66e927c33e0338818210ffa866828.zip gcc-a7ed27aca8d66e927c33e0338818210ffa866828.tar.gz gcc-a7ed27aca8d66e927c33e0338818210ffa866828.tar.bz2 |
graphite-clast-to-gimple.c (get_stmtfor_depth): Removed.
2009-10-20 Li Feng <nemokingdom@gmail.com>
* graphite-clast-to-gimple.c (get_stmtfor_depth): Removed.
(translate_clast): Pass an extra parameter LEVEL.
Call get_scattering_level.
* graphite-clast-to-gimple.h (get_scattering_level): New.
From-SVN: r154625
-rw-r--r-- | gcc/ChangeLog.graphite | 7 | ||||
-rw-r--r-- | gcc/graphite-clast-to-gimple.c | 44 | ||||
-rw-r--r-- | gcc/graphite-clast-to-gimple.h | 11 |
3 files changed, 30 insertions, 32 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index a4f2ed0..733d35b 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,10 @@ +2009-10-20 Li Feng <nemokingdom@gmail.com> + + * graphite-clast-to-gimple.c (get_stmtfor_depth): Removed. + (translate_clast): Pass an extra parameter LEVEL. + Call get_scattering_level. + * graphite-clast-to-gimple.h (get_scattering_level): New. + 2009-10-22 Sebastian Pop <sebastian.pop@amd.com> * cfgloop.c (alloc_loop): Initialize loop->single_iv. diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 693e61c..05d3e2f 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -558,27 +558,6 @@ mark_bb_with_pbb (poly_bb_p pbb, basic_block bb, htab_t bb_pbb_mapping) *x = new_bb_pbb_def (bb, pbb); } -/* Returns the scattering dimension for STMTFOR. - - FIXME: This is a hackish solution to locate the scattering - dimension in newly created loops. Here the hackish solush - assume that the stmt_for->iterator is always something like: - scat_1 , scat_3 etc., where after "scat_" is loop level in - scattering dimension. -*/ - -static int get_stmtfor_depth (struct clast_for *stmtfor) -{ - const char * iterator = stmtfor->iterator; - const char * depth; - - depth = strchr (iterator, '_'); - if (!strncmp (iterator, "scat_", 5)) - return atoi (depth+1); - - gcc_unreachable(); -} - /* Translates a CLAST statement STMT to GCC representation in the context of a SESE. @@ -593,14 +572,15 @@ static edge translate_clast (sese region, struct loop *context_loop, struct clast_stmt *stmt, edge next_e, htab_t rename_map, VEC (tree, heap) **newivs, - htab_t newivs_index, htab_t bb_pbb_mapping) + htab_t newivs_index, htab_t bb_pbb_mapping, int level) { if (!stmt) return next_e; if (CLAST_STMT_IS_A (stmt, stmt_root)) return translate_clast (region, context_loop, stmt->next, next_e, - rename_map, newivs, newivs_index, bb_pbb_mapping); + rename_map, newivs, newivs_index, + bb_pbb_mapping, level); if (CLAST_STMT_IS_A (stmt, stmt_user)) { @@ -624,7 +604,7 @@ translate_clast (sese region, struct loop *context_loop, graphite_verify (); return translate_clast (region, context_loop, stmt->next, next_e, rename_map, newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, level); } if (CLAST_STMT_IS_A (stmt, stmt_for)) @@ -639,7 +619,7 @@ translate_clast (sese region, struct loop *context_loop, loop->aux = XNEW (int); /* Pass scattering level information of the new loop by LOOP->AUX. */ - *((int *)(loop->aux)) = get_stmtfor_depth (stmtfor); + *((int *)(loop->aux)) = get_scattering_level (level); /* Create a basic block for loop close phi nodes. */ last_e = single_succ_edge (split_edge (last_e)); @@ -648,7 +628,7 @@ translate_clast (sese region, struct loop *context_loop, next_e = translate_clast (region, loop, ((struct clast_for *) stmt)->body, single_succ_edge (loop->header), rename_map, newivs, - newivs_index, bb_pbb_mapping); + newivs_index, bb_pbb_mapping, level + 1); redirect_edge_succ_nodup (next_e, after); set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src); @@ -660,7 +640,7 @@ translate_clast (sese region, struct loop *context_loop, graphite_verify (); return translate_clast (region, context_loop, stmt->next, last_e, rename_map, newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, level); } if (CLAST_STMT_IS_A (stmt, stmt_guard)) @@ -679,7 +659,7 @@ translate_clast (sese region, struct loop *context_loop, next_e = translate_clast (region, context_loop, ((struct clast_guard *) stmt)->then, true_e, rename_map, newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, level); insert_guard_phis (last_e->src, exit_true_e, exit_false_e, before_guard, rename_map); @@ -689,7 +669,7 @@ translate_clast (sese region, struct loop *context_loop, return translate_clast (region, context_loop, stmt->next, last_e, rename_map, newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, level); } if (CLAST_STMT_IS_A (stmt, stmt_block)) @@ -697,12 +677,12 @@ translate_clast (sese region, struct loop *context_loop, next_e = translate_clast (region, context_loop, ((struct clast_block *) stmt)->body, next_e, rename_map, newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, level); recompute_all_dominators (); graphite_verify (); return translate_clast (region, context_loop, stmt->next, next_e, rename_map, newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, level); } gcc_unreachable (); @@ -1157,7 +1137,7 @@ gloog (scop_p scop, htab_t bb_pbb_mapping) new_scop_exit_edge = translate_clast (region, context_loop, pc.stmt, if_region->true_region->entry, rename_map, &newivs, newivs_index, - bb_pbb_mapping); + bb_pbb_mapping, 1); sese_reset_aux_in_loops (region); graphite_verify (); sese_adjust_liveout_phis (region, rename_map, diff --git a/gcc/graphite-clast-to-gimple.h b/gcc/graphite-clast-to-gimple.h index 3f25872..cbbf875 100644 --- a/gcc/graphite-clast-to-gimple.h +++ b/gcc/graphite-clast-to-gimple.h @@ -61,5 +61,16 @@ eq_bb_pbb_map (const void *bb_pbb1, const void *bb_pbb2) return (bp1->bb->index == bp2->bb->index); } +/* Returns the scattering dimension for STMTFOR. + + The relationship between dimension in scattering matrix + and the DEPTH of the loop is: + DIMENSION = 2*DEPTH - 1 +*/ + +static inline int get_scattering_level (int depth) +{ + return 2 * depth - 1; +} #endif |