+2015-10-21 Aditya Kumar <aditya.k7@samsung.com>
+
+ * graphite-poly.h (struct dr_info): Added invalid_alias_set number.
+ (operator=): Removed.
+ (dr_info): Make alias_set number the last argument with default value of invalid_alias_set.
+ * graphite-sese-to-poly.c (build_scop_drs): Update constructor of dr_info.
+ (rewrite_reductions_out_of_ssa): Iterate only through the basic blocks which are inside region.
+ (rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
+ * sese.h (struct sese_l): Removed assignment operator.
+ (split_region_for_bb): Removed dead code.
+
2015-10-21 Aditya Kumar <aditya.k7@samsung.com>
* graphite-poly.h (struct dr_info): Removed conversion constructor.
struct dr_info
{
+ enum {
+ invalid_alias_set = -1
+ };
/* The data reference. */
data_reference_p dr;
- /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph. -1
- is an invalid alias set. */
- int alias_set;
-
/* The polyhedral BB containing this DR. */
poly_bb_p pbb;
+ /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph.
+ -1 is an invalid alias set. */
+ int alias_set;
+
/* Construct a DR_INFO from a data reference DR, an ALIAS_SET, and a PBB. */
- dr_info (data_reference_p dr, int alias_set, poly_bb_p pbb)
- : dr (dr), alias_set (alias_set), pbb (pbb) {}
-
- /* Assignment operator, to be able to iterate over a vec of these objects. */
- const dr_info &
- operator= (const dr_info &p)
- {
- dr = p.dr;
- alias_set = p.alias_set;
- pbb = p.pbb;
- return *this;
- }
+ dr_info (data_reference_p dr, poly_bb_p pbb,
+ int alias_set = invalid_alias_set)
+ : dr (dr), pbb (pbb), alias_set (alias_set) {}
};
/* A SCOP is a Static Control Part of the program, simple enough to be
FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
if (pbb)
FOR_EACH_VEC_ELT (GBB_DATA_REFS (PBB_BLACK_BOX (pbb)), j, dr)
- scop->drs.safe_push (dr_info (dr, -1, pbb));
+ scop->drs.safe_push (dr_info (dr, pbb));
build_alias_set (scop);
static void
rewrite_reductions_out_of_ssa (scop_p scop)
{
+ int i;
basic_block bb;
- sese_l region = scop->scop_info->region;
-
- FOR_EACH_BB_FN (bb, cfun)
- if (bb_in_sese_p (bb, region))
- for (gphi_iterator psi = gsi_start_phis (bb); !gsi_end_p (psi);)
- {
- gphi *phi = psi.phi ();
+ FOR_EACH_VEC_ELT (scop->scop_info->bbs, i, bb)
+ for (gphi_iterator psi = gsi_start_phis (bb); !gsi_end_p (psi);)
+ {
+ gphi *phi = psi.phi ();
- if (virtual_operand_p (gimple_phi_result (phi)))
- {
- gsi_next (&psi);
- continue;
- }
+ if (virtual_operand_p (gimple_phi_result (phi)))
+ {
+ gsi_next (&psi);
+ continue;
+ }
- if (gimple_phi_num_args (phi) > 1
- && degenerate_phi_result (phi))
- rewrite_degenerate_phi (&psi);
+ if (gimple_phi_num_args (phi) > 1
+ && degenerate_phi_result (phi))
+ rewrite_degenerate_phi (&psi);
- else if (scalar_close_phi_node_p (phi))
- rewrite_close_phi_out_of_ssa (scop, &psi);
+ else if (scalar_close_phi_node_p (phi))
+ rewrite_close_phi_out_of_ssa (scop, &psi);
- else if (reduction_phi_p (region, &psi))
- rewrite_phi_out_of_ssa (scop, &psi);
- }
+ else if (reduction_phi_p (scop->scop_info->region, &psi))
+ rewrite_phi_out_of_ssa (scop, &psi);
+ }
update_ssa (TODO_update_ssa);
#ifdef ENABLE_CHECKING
static void
rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop)
{
- basic_block bb;
gimple_stmt_iterator psi;
sese_l region = scop->scop_info->region;
bool changed = false;
/* Create an extra empty BB after the scop. */
split_edge (region.exit);
- FOR_EACH_BB_FN (bb, cfun)
- if (bb_in_sese_p (bb, region))
- for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
- changed |= rewrite_cross_bb_scalar_deps (scop, &psi);
+ int i;
+ basic_block bb;
+ FOR_EACH_VEC_ELT (scop->scop_info->bbs, i, bb)
+ for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
+ changed |= rewrite_cross_bb_scalar_deps (scop, &psi);
if (changed)
{
operator bool () const { return entry && exit; }
- const sese_l &
- operator= (const sese_l &s)
- {
- entry = s.entry;
- exit = s.exit;
- return *this;
- }
-
edge entry;
edge exit;
};
return depth;
}
-/* Splits BB to make a single entry single exit region. */
-
-static inline sese_info_p
-split_region_for_bb (basic_block bb)
-{
- edge entry, exit;
-
- if (single_pred_p (bb))
- entry = single_pred_edge (bb);
- else
- {
- entry = split_block_after_labels (bb);
- bb = single_succ (bb);
- }
-
- if (single_succ_p (bb))
- exit = single_succ_edge (bb);
- else
- {
- gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gsi_prev (&gsi);
- exit = split_block (bb, gsi_stmt (gsi));
- }
-
- return new_sese_info (entry, exit);
-}
-
-\f
-
/* A single entry single exit specialized for conditions. */
typedef struct ifsese_s {