This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[graphite] build access matrices
- From: "Sebastian Pop" <sebastian dot pop at inria dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Jan 2007 15:06:43 +0100
- Subject: [graphite] build access matrices
Hi,
here is the patch that initializes the list of access matrices per basic block.
The next step is the code generation from the polyhedral representation using
cloog. This next step will bring in some config changes for checking for
the polylib and the cloog libs.
The patch also includes a cleanup of the scev and datadeps passes to avoid
the dumping of all the debugging info when using -fdump-tree-*-all.
We probably need a similar patch for trunk, such that the dump output
of other passes depending on scev don't include all this unneeded debugging
information.
Sebastian
* tree-dump.c (dump_option_value_in): Add TDF_DEBUG.
* tree-pass.h (TDF_DEBUG, debug_p): New.
* tree-scalar-evolution.c (set_scalar_evolution, get_scalar_evolution,
get_scalar_evolution, add_to_evolution, set_nb_iterations_in_loop,
get_loop_exit_condition, analyze_evolution_in_loop,
analyze_initial_condition, analyze_scalar_evolution,
instantiate_parameters, number_of_latch_executions): Use debug_p.
* tree-chrec.c (chrec_apply): Use debug_p.
* tree-data-ref.c: Include graphite.h.
(dump_data_reference): Print also the access matrix.
(analyze_array, analyze_indirect_ref, init_data_ref,
analyze_offset_expr, address_analysis, object_analysis,
create_data_ref, finalize_ddr_dependent,
non_affine_dependence_relation, analyze_ziv_subscript,
analyze_siv_subscript_cst_affine,
compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine,
can_use_analyze_subscript_affine_affine, analyze_siv_subscript,
analyze_miv_subscript, analyze_overlapping_iterations,
build_classic_dist_vector, subscript_dependence_tester,
compute_affine_dependence, analyze_all_data_dependences): Use debug_p.
(build_access_matrix_with_af): No longer static.
* tree-data-ref.h (scop_p): ... declaration here.
(data_reference.scop): New field.
(DR_SCOP, DR_ACCESS_MATRIX): New.
(build_access_matrix_with_af, dr_num_subscripts): Declared.
* graphite.c (print_graphite_bb): Call dump_data_references.
(print_scop): Use scop_nb_loops and scop_dim_domain.
(test_for_scop_bound): Use debug_p.
(scan_tree_for_params): Use scop_nb_loops, scop_nb_loops and
scop_nb_params.
(scop_loop_index): Moved...
(scop_record_loop): New.
(build_scop_loop_nests): Use scop_record_loop.
(build_scop_domain): Use scop_dim_domain.
(build_access_matrix): Implemented.
(build_scop_canonical_schedules): Use scop_nb_loops.
(build_graphite_bb): Initialize GBB_SCOP.
* graphite.h (scop_p): Moved...
(graphite_bb.scop): New field.
(graphite_bb.iteration_domain, GBB_DOMAIN, scop.nb_params,
scop.nb_loops, scop.dim_domain, SCOP_NB_LOOPS, SCOP_NB_PARAMS,
SCOP_DIM_DOMAIN, SCOP_STMTS): Removed.
(scop_nb_params, scop_nb_loops, scop_dim_domain, gbb_dim_domain,
scop_loop_index): New.
* Makefile.in (tree-data-ref.o): Depends on graphite.h.
Index: tree-dump.c
===================================================================
--- tree-dump.c (revision 120479)
+++ tree-dump.c (working copy)
@@ -790,8 +790,9 @@ static const struct dump_option_value_in
{"uid", TDF_UID},
{"stmtaddr", TDF_STMTADDR},
{"memsyms", TDF_MEMSYMS},
+ {"debug", TDF_DEBUG},
{"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA
- | TDF_STMTADDR | TDF_GRAPH)},
+ | TDF_STMTADDR | TDF_GRAPH | TDF_DEBUG)},
{NULL, 0}
};
Index: tree-pass.h
===================================================================
--- tree-pass.h (revision 120479)
+++ tree-pass.h (working copy)
@@ -70,6 +70,7 @@ enum tree_dump_index
#define TDF_GRAPH (1 << 13) /* a graph dump is being emitted */
#define TDF_MEMSYMS (1 << 14) /* display memory symbols in expr.
Implies TDF_VOPS. */
+#define TDF_DEBUG (1 << 15) /* Pass debugging output. */
extern char *get_dump_file_name (enum tree_dump_index);
extern int dump_enabled_p (enum tree_dump_index);
@@ -85,6 +86,15 @@ extern FILE *dump_file;
extern int dump_flags;
extern const char *dump_file_name;
+/* Return true when the dump file is initialized and in debug
+ mode. */
+
+static inline bool
+debug_p (void)
+{
+ return (dump_file && (dump_flags & TDF_DEBUG));
+}
+
/* Return the dump_file_info for the given phase. */
extern struct dump_file_info *get_dump_file_info (enum tree_dump_index);
Index: tree-scalar-evolution.c
===================================================================
--- tree-scalar-evolution.c (revision 120479)
+++ tree-scalar-evolution.c (working copy)
@@ -569,7 +569,7 @@ set_scalar_evolution (tree scalar, tree
if (dump_file)
{
- if (dump_flags & TDF_DETAILS)
+ if (debug_p ())
{
fprintf (dump_file, "(set_scalar_evolution \n");
fprintf (dump_file, " (scalar = ");
@@ -594,7 +594,7 @@ get_scalar_evolution (tree scalar)
if (dump_file)
{
- if (dump_flags & TDF_DETAILS)
+ if (debug_p ())
{
fprintf (dump_file, "(get_scalar_evolution \n");
fprintf (dump_file, " (scalar = ");
@@ -621,7 +621,7 @@ get_scalar_evolution (tree scalar)
break;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (scalar_evolution = ");
print_generic_expr (dump_file, res, 0);
@@ -849,7 +849,7 @@ add_to_evolution (unsigned loop_nb, tree
/* This should not happen. */
return chrec_dont_know;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(add_to_evolution \n");
fprintf (dump_file, " (loop_nb = %d)\n", loop_nb);
@@ -867,7 +867,7 @@ add_to_evolution (unsigned loop_nb, tree
res = add_to_evolution_1 (loop_nb, chrec_before, to_add, at_stmt);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (res = ");
print_generic_expr (dump_file, res, 0);
@@ -883,7 +883,7 @@ static inline tree
set_nb_iterations_in_loop (struct loop *loop,
tree res)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (set_nb_iterations_in_loop = ");
print_generic_expr (dump_file, res, 0);
@@ -943,7 +943,7 @@ get_loop_exit_condition (struct loop *lo
tree res = NULL_TREE;
edge exit_edge = single_exit (loop);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(get_loop_exit_condition \n ");
if (exit_edge)
@@ -955,7 +955,7 @@ get_loop_exit_condition (struct loop *lo
res = expr;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
print_generic_expr (dump_file, res, 0);
fprintf (dump_file, ")\n");
@@ -1408,7 +1408,7 @@ analyze_evolution_in_loop (tree loop_phi
struct loop *loop = loop_containing_stmt (loop_phi_node);
basic_block bb;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(analyze_evolution_in_loop \n");
fprintf (dump_file, " (loop_phi_node = ");
@@ -1452,7 +1452,7 @@ analyze_evolution_in_loop (tree loop_phi
evolution_function = chrec_merge (evolution_function, ev_fn);
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (evolution_function = ");
print_generic_expr (dump_file, evolution_function, 0);
@@ -1476,7 +1476,7 @@ analyze_initial_condition (tree loop_phi
tree init_cond = chrec_not_analyzed_yet;
struct loop *loop = bb_for_stmt (loop_phi_node)->loop_father;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(analyze_initial_condition \n");
fprintf (dump_file, " (loop_phi_node = \n");
@@ -1513,7 +1513,7 @@ analyze_initial_condition (tree loop_phi
if (init_cond == chrec_not_analyzed_yet)
init_cond = chrec_dont_know;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (init_cond = ");
print_generic_expr (dump_file, init_cond, 0);
@@ -1973,7 +1973,7 @@ analyze_scalar_evolution (struct loop *l
{
tree res;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(analyze_scalar_evolution \n");
fprintf (dump_file, " (loop_nb = %d)\n", loop->num);
@@ -1987,7 +1987,7 @@ analyze_scalar_evolution (struct loop *l
if (TREE_CODE (var) == SSA_NAME && res == chrec_dont_know)
res = var;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
return res;
@@ -2408,7 +2408,7 @@ instantiate_parameters (struct loop *loo
tree res;
htab_t cache = htab_create (10, hash_scev_info, eq_scev_info, del_scev_info);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(instantiate_parameters \n");
fprintf (dump_file, " (loop_nb = %d)\n", loop->num);
@@ -2420,7 +2420,7 @@ instantiate_parameters (struct loop *loo
res = instantiate_parameters_1 (loop, chrec, INSERT_SUPERLOOP_CHRECS, cache,
0);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (res = ");
print_generic_expr (dump_file, res, 0);
@@ -2480,7 +2480,7 @@ number_of_latch_executions (struct loop
return res;
res = chrec_dont_know;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(number_of_iterations_in_loop\n");
exit = single_exit (loop);
Index: tree-chrec.c
===================================================================
--- tree-chrec.c (revision 120479)
+++ tree-chrec.c (working copy)
@@ -546,7 +546,7 @@ chrec_apply (unsigned var,
|| chrec_contains_symbols_defined_in_loop (chrec, var))
return chrec_dont_know;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(chrec_apply \n");
if (TREE_CODE (x) == INTEGER_CST && SCALAR_FLOAT_TYPE_P (type))
@@ -571,7 +571,7 @@ chrec_apply (unsigned var,
else
res = chrec_dont_know;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (varying_loop = %d\n", var);
fprintf (dump_file, ")\n (chrec = ");
Index: tree-data-ref.c
===================================================================
--- tree-data-ref.c (revision 120479)
+++ tree-data-ref.c (working copy)
@@ -92,6 +92,7 @@ Software Foundation, 51 Franklin Street,
#include "tree-chrec.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
+#include "graphite.h"
#include "tree-pass.h"
#include "langhooks.h"
@@ -623,6 +624,17 @@ dump_data_reference (FILE *outf,
fprintf (outf, " Access function %d: ", i);
print_generic_stmt (outf, DR_ACCESS_FN (dr, i), 0);
}
+
+ if (DR_SCOP (dr))
+ {
+ lambda_vector v;
+
+ fprintf (outf, " access matrix: \n");
+
+ for (i = 0; VEC_iterate (lambda_vector, DR_ACCESS_MATRIX (dr), i, v); i++)
+ print_lambda_vector (outf, v, scop_dim_domain (DR_SCOP (dr)));
+ }
+
fprintf (outf, ")\n");
}
@@ -935,7 +947,7 @@ analyze_array (tree stmt, tree ref, bool
struct data_reference *res;
VEC(tree,heap) *acc_fns;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(analyze_array \n");
fprintf (dump_file, " (ref = ");
@@ -961,7 +973,7 @@ analyze_array (tree stmt, tree ref, bool
DR_MEMTAG (res) = NULL_TREE;
DR_PTR_INFO (res) = NULL;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
return res;
@@ -989,7 +1001,7 @@ analyze_indirect_ref (tree stmt, tree re
STRIP_NOPS (init);
if (access_fn == chrec_dont_know || !init || init == chrec_dont_know)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nBad access function of ptr: ");
print_generic_expr (dump_file, ref, TDF_SLIM);
@@ -998,7 +1010,7 @@ analyze_indirect_ref (tree stmt, tree re
return NULL;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nAccess function of ptr: ");
print_generic_expr (dump_file, access_fn, TDF_SLIM);
@@ -1007,7 +1019,7 @@ analyze_indirect_ref (tree stmt, tree re
if (!expr_invariant_in_loop_p (loop, init))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "\ninitial condition is not loop invariant.\n");
}
else
@@ -1023,12 +1035,12 @@ analyze_indirect_ref (tree stmt, tree re
if (TREE_CODE (evolution) == INTEGER_CST)
step = fold_convert (ssizetype, evolution);
else
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "\nnon constant step for ptr access.\n");
}
}
else
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "\nunknown evolution of ptr.\n");
}
return init_data_ref (stmt, ref, NULL_TREE, access_fn, is_read, base_address,
@@ -1056,7 +1068,7 @@ init_data_ref (tree stmt,
struct data_reference *res;
VEC(tree,heap) *acc_fns;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(init_data_ref \n");
fprintf (dump_file, " (ref = ");
@@ -1082,7 +1094,7 @@ init_data_ref (tree stmt,
DR_MEMTAG (res) = memtag;
DR_PTR_INFO (res) = ptr_info;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
return res;
@@ -1224,7 +1236,7 @@ analyze_offset_expr (tree expr,
if (!BINARY_CLASS_P (expr))
{
/* We expect to get binary expressions (PLUS/MINUS and MULT). */
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nNot binary expression ");
print_generic_expr (dump_file, expr, TDF_SLIM);
@@ -1388,7 +1400,7 @@ address_analysis (tree expr, tree stmt,
address. */
if ((base_addr0 && base_addr1) || (!base_addr0 && !base_addr1))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file,
"\neither more than one address or no addresses in expr ");
@@ -1434,7 +1446,7 @@ address_analysis (tree expr, tree stmt,
case SSA_NAME:
if (!POINTER_TYPE_P (TREE_TYPE (expr)))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nnot pointer SSA_NAME ");
print_generic_expr (dump_file, expr, TDF_SLIM);
@@ -1547,7 +1559,7 @@ object_analysis (tree memref, tree stmt,
comp_ref = memref;
else
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\ndata-ref of unsupported type ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1563,7 +1575,7 @@ object_analysis (tree memref, tree stmt,
&pmode, &punsignedp, &pvolatilep, false);
if (!base)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nfailed to get inner ref for ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1578,7 +1590,7 @@ object_analysis (tree memref, tree stmt,
&object_misalign, &object_aligned_to,
&object_step))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nfailed to compute offset or step for ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1593,7 +1605,7 @@ object_analysis (tree memref, tree stmt,
/* Check that there is no remainder in bits. */
if (pbitpos%BITS_PER_UNIT)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "\nbit offset alignment.\n");
return NULL_TREE;
}
@@ -1618,7 +1630,7 @@ object_analysis (tree memref, tree stmt,
*dr = analyze_array (stmt, TREE_OPERAND (comp_ref, 0), is_read);
if (DR_NUM_DIMENSIONS (*dr) != 1)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\n multidimensional component ref ");
print_generic_expr (dump_file, comp_ref, TDF_SLIM);
@@ -1629,7 +1641,7 @@ object_analysis (tree memref, tree stmt,
}
else
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nunhandled decl ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1668,7 +1680,7 @@ object_analysis (tree memref, tree stmt,
ptr_dr = analyze_indirect_ref (stmt, memref, is_read);
if (!ptr_dr)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nfailed to create dr for ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1683,7 +1695,7 @@ object_analysis (tree memref, tree stmt,
if (!ptr_init || !ptr_step || !POINTER_TYPE_P (TREE_TYPE (ptr_init)))
{
*dr = (*dr) ? *dr : ptr_dr;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nbad pointer access ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1694,7 +1706,7 @@ object_analysis (tree memref, tree stmt,
if (integer_zerop (ptr_step) && !(*dr))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "\nptr is loop invariant.\n");
*dr = ptr_dr;
return NULL_TREE;
@@ -1716,7 +1728,7 @@ object_analysis (tree memref, tree stmt,
&address_aligned_to, &address_step);
if (!base_address)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nfailed to analyze address ");
print_generic_expr (dump_file, ptr_init, TDF_SLIM);
@@ -1737,7 +1749,7 @@ object_analysis (tree memref, tree stmt,
*memtag = TREE_OPERAND (base_address, 0);
break;
default:
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\nno memtag for ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1751,7 +1763,7 @@ object_analysis (tree memref, tree stmt,
if (!base_address)
{
/* MEMREF cannot be analyzed. */
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\ndata-ref of unsupported type ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1878,7 +1890,7 @@ create_data_ref (tree memref, tree stmt,
&ptr_info, &subvars);
if (!dr || !base_address)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "\ncreate_data_ref: failed to create a dr for ");
print_generic_expr (dump_file, memref, TDF_SLIM);
@@ -1965,7 +1977,7 @@ create_data_ref (tree memref, tree stmt,
VEC_replace (tree, DR_ACCESS_FNS (dr), 0, access_fn);
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
struct ptr_info_def *pi = DR_PTR_INFO (dr);
@@ -2158,7 +2170,7 @@ static inline void
finalize_ddr_dependent (struct data_dependence_relation *ddr,
tree chrec)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(dependence classified: ");
print_generic_expr (dump_file, chrec, 0);
@@ -2175,7 +2187,7 @@ finalize_ddr_dependent (struct data_depe
static inline void
non_affine_dependence_relation (struct data_dependence_relation *ddr)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(Dependence relation cannot be represented by distance vector.) \n");
DDR_AFFINE_P (ddr) = false;
@@ -2250,7 +2262,7 @@ analyze_ziv_subscript (tree chrec_a,
tree difference;
dependence_stats.num_ziv++;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(analyze_ziv_subscript \n");
chrec_a = chrec_convert (integer_type_node, chrec_a, NULL_TREE);
@@ -2282,7 +2294,7 @@ analyze_ziv_subscript (tree chrec_a,
default:
/* We're not sure whether the indexes overlap. For the moment,
conservatively answer "don't know". */
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "ziv test failed: difference is non-integer.\n");
*overlaps_a = chrec_dont_know;
@@ -2292,7 +2304,7 @@ analyze_ziv_subscript (tree chrec_a,
break;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
}
@@ -2344,7 +2356,7 @@ analyze_siv_subscript_cst_affine (tree c
if (!chrec_is_positive (initial_condition (difference), &value0))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "siv test failed: chrec is not positive.\n");
dependence_stats.num_siv_unimplemented++;
@@ -2359,7 +2371,7 @@ analyze_siv_subscript_cst_affine (tree c
{
if (!chrec_is_positive (CHREC_RIGHT (chrec_b), &value1))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "siv test failed: chrec not positive.\n");
*overlaps_a = chrec_dont_know;
@@ -2440,7 +2452,7 @@ analyze_siv_subscript_cst_affine (tree c
{
if (!chrec_is_positive (CHREC_RIGHT (chrec_b), &value2))
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "siv test failed: chrec not positive.\n");
*overlaps_a = chrec_dont_know;
@@ -2615,7 +2627,7 @@ compute_overlap_steps_for_affine_1_2 (tr
if (numiter_x == NULL_TREE || numiter_y == NULL_TREE
|| numiter_z == NULL_TREE)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "overlap steps test failed: no iteration counts.\n");
*overlaps_a = chrec_dont_know;
@@ -2740,7 +2752,7 @@ analyze_subscript_affine_affine (tree ch
*last_conflicts = chrec_dont_know;
return;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(analyze_subscript_affine_affine \n");
/* For determining the initial intersection, we have to solve a
@@ -2786,7 +2798,7 @@ analyze_subscript_affine_affine (tree ch
numiter_b = get_number_of_iters_for_loop (CHREC_VARIABLE (chrec_b));
if (numiter_a == NULL_TREE || numiter_b == NULL_TREE)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: missing iteration counts.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -2816,7 +2828,7 @@ analyze_subscript_affine_affine (tree ch
else
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: too many variables.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -2894,7 +2906,7 @@ analyze_subscript_affine_affine (tree ch
if (numiter_a == NULL_TREE || numiter_b == NULL_TREE)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: missing iteration counts.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -2975,7 +2987,7 @@ analyze_subscript_affine_affine (tree ch
{
/* FIXME: For the moment, the upper bound of the
iteration domain for j is not checked. */
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: unimplemented.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -2987,7 +2999,7 @@ analyze_subscript_affine_affine (tree ch
{
/* FIXME: For the moment, the upper bound of the
iteration domain for i is not checked. */
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: unimplemented.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -2997,7 +3009,7 @@ analyze_subscript_affine_affine (tree ch
}
else
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: unimplemented.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -3007,7 +3019,7 @@ analyze_subscript_affine_affine (tree ch
else
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "affine-affine test failed: unimplemented.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -3015,7 +3027,7 @@ analyze_subscript_affine_affine (tree ch
}
end_analyze_subs_aa:
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (overlaps_a = ");
print_generic_expr (dump_file, *overlaps_a, 0);
@@ -3058,7 +3070,7 @@ can_use_analyze_subscript_affine_affine
if (!evolution_function_is_constant_p (diff))
return false;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "can_use_subscript_aff_aff_for_symbolic \n");
*chrec_a = build_polynomial_chrec (CHREC_VARIABLE (*chrec_a),
@@ -3086,7 +3098,7 @@ analyze_siv_subscript (tree chrec_a,
{
dependence_stats.num_siv++;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(analyze_siv_subscript \n");
if (evolution_function_is_constant_p (chrec_a)
@@ -3144,7 +3156,7 @@ analyze_siv_subscript (tree chrec_a,
else
{
siv_subscript_dontknow:;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "siv test failed: unimplemented.\n");
*overlaps_a = chrec_dont_know;
*overlaps_b = chrec_dont_know;
@@ -3152,7 +3164,7 @@ analyze_siv_subscript (tree chrec_a,
dependence_stats.num_siv_unimplemented++;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
}
@@ -3213,7 +3225,7 @@ analyze_miv_subscript (tree chrec_a,
bool divide_p = true;
tree difference;
dependence_stats.num_miv++;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(analyze_miv_subscript \n");
chrec_a = chrec_convert (integer_type_node, chrec_a, NULL_TREE);
@@ -3282,7 +3294,7 @@ analyze_miv_subscript (tree chrec_a,
else
{
/* When the analysis is too difficult, answer "don't know". */
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "analyze_miv_subscript test failed: unimplemented.\n");
*overlaps_a = chrec_dont_know;
@@ -3291,7 +3303,7 @@ analyze_miv_subscript (tree chrec_a,
dependence_stats.num_miv_unimplemented++;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
}
@@ -3314,7 +3326,7 @@ analyze_overlapping_iterations (tree chr
{
dependence_stats.num_subscript_tests++;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(analyze_overlapping_iterations \n");
fprintf (dump_file, " (chrec_a = ");
@@ -3373,7 +3385,7 @@ analyze_overlapping_iterations (tree chr
overlap_iterations_a, overlap_iterations_b,
last_conflicts);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, " (overlap_iterations_a = ");
print_generic_expr (dump_file, *overlap_iterations_a, 0);
@@ -3740,7 +3752,7 @@ build_classic_dist_vector (struct data_d
DDR_NB_LOOPS (ddr), 0));
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
unsigned i;
@@ -3848,7 +3860,7 @@ static void
subscript_dependence_tester (struct data_dependence_relation *ddr)
{
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "(subscript_dependence_tester \n");
if (subscript_dependence_tester_1 (ddr, DDR_A (ddr), DDR_B (ddr)))
@@ -3858,7 +3870,7 @@ subscript_dependence_tester (struct data
if (build_classic_dist_vector (ddr))
build_classic_dir_vector (ddr);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
}
@@ -3895,7 +3907,7 @@ compute_affine_dependence (struct data_d
struct data_reference *dra = DDR_A (ddr);
struct data_reference *drb = DDR_B (ddr);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "(compute_affine_dependence\n");
fprintf (dump_file, " (stmt_a = \n");
@@ -3921,7 +3933,7 @@ compute_affine_dependence (struct data_d
{
dependence_stats.num_dependence_undetermined++;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
{
fprintf (dump_file, "Data ref a:\n");
dump_data_reference (dump_file, dra);
@@ -3933,7 +3945,7 @@ compute_affine_dependence (struct data_d
}
}
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, ")\n");
}
@@ -4145,10 +4157,11 @@ find_data_references_in_loop (struct loo
}
/* Initializes an equation CY of the access matrix using the
- information for a subscript from ACCESS_FUN. Returns true when the
- operation succeeded. */
+ information for a subscript from ACCESS_FUN, relatively to the loop
+ indexes from LOOP_NEST and parameter indexes from PARAMS. Returns
+ true when the operation succeeded. */
-static bool
+bool
build_access_matrix_with_af (tree access_fun, lambda_vector cy,
VEC (loop_p, heap) *loop_nest,
VEC (tree, heap) *params)
@@ -4160,7 +4173,7 @@ build_access_matrix_with_af (tree access
tree left = CHREC_LEFT (access_fun);
tree right = CHREC_RIGHT (access_fun);
int var = CHREC_VARIABLE (access_fun);
- unsigned i, var_idx;
+ unsigned var_idx;
struct loop *loopi;
if (TREE_CODE (right) != INTEGER_CST)
@@ -4173,19 +4186,9 @@ build_access_matrix_with_af (tree access
if (loopi->num == var)
break;
- if (loopi->num == var)
- cy[var_idx] = int_cst_value (right);
- else
- {
- tree param;
-
- /* This is potentially a parameter. */
- for (i = 0; VEC_iterate (tree, params, i, param);
- i++, var_idx++)
- if (loopi->num == var)
- break;
-
- }
+ gcc_assert (loopi && loopi->num == var);
+
+ cy[var_idx] = int_cst_value (right);
switch (TREE_CODE (left))
{
@@ -4388,7 +4391,7 @@ analyze_all_data_dependences (struct loo
dump_data_dependence_relations (dump_file, dependence_relations);
fprintf (dump_file, "\n\n");
- if (dump_flags & TDF_DETAILS)
+ if (debug_p ())
dump_dist_dir_vectors (dump_file, dependence_relations);
if (dump_flags & TDF_STATS)
Index: tree-data-ref.h
===================================================================
--- tree-data-ref.h (revision 120479)
+++ tree-data-ref.h (working copy)
@@ -69,6 +69,8 @@ enum data_ref_type {
POINTER_REF_TYPE
};
+typedef struct scop *scop_p;
+
struct data_reference
{
/* A pointer to the statement that contains this DR. */
@@ -140,7 +142,9 @@ struct data_reference
function for a subscript. First elements correspond to the
leftmost indices, ie. for a[i][j] the first vector corresponds to
the subscript in "i". The elements of a vector are relative to
- the loop nest in which the data reference is considered.
+ the loop nests in which the data reference is considered,
+ i.e. the vector is relative to the SCoP that provides the context
+ in which this data reference occurs.
For example, in
@@ -148,7 +152,7 @@ struct data_reference
| loop_2
| a[i+3][2*j+n-1]
- if "i" varies in loop_1 and "j" varies in loop_2, the access
+ if "i" varies in loop_1 and "j" varies in loop_2, the access
matrix with respect to the loop nest {loop_1, loop_2} is:
| loop_1 loop_2 param_n cst
@@ -163,12 +167,15 @@ struct data_reference
| 2 0 1 -1
*/
VEC (lambda_vector, heap) *access_matrix;
+ scop_p scop;
};
typedef struct data_reference *data_reference_p;
DEF_VEC_P(data_reference_p);
DEF_VEC_ALLOC_P (data_reference_p, heap);
+#define DR_SCOP(DR) (DR)->scop
+#define DR_ACCESS_MATRIX(DR) (DR)->access_matrix
#define DR_STMT(DR) (DR)->stmt
#define DR_REF(DR) (DR)->ref
#define DR_BASE_OBJECT(DR) (DR)->object_info.base_object
@@ -365,6 +372,10 @@ extern void free_data_refs (VEC (data_re
extern struct data_reference *analyze_array (tree, tree, bool);
extern struct data_reference *create_data_ref (tree, tree, bool);
extern bool find_data_references_in_stmt (tree, VEC (data_reference_p, heap) **);
+extern bool build_access_matrix_with_af (tree, lambda_vector,
+ VEC (loop_p, heap) *,
+ VEC (tree, heap) *);
+extern unsigned dr_num_subscripts (data_reference_p);
/* Return the index of the variable VAR in the LOOP_NEST array. */
Index: graphite.c
===================================================================
--- graphite.c (revision 120479)
+++ graphite.c (working copy)
@@ -52,7 +52,10 @@ VEC (scop_p, heap) *current_scops;
void
print_graphite_bb (FILE *file, graphite_bb_p gb, int indent, int verbosity)
{
- print_loop_ir_bb (file, GBB_BB (gb), indent, verbosity);
+ fprintf (file, "\nGBB (\n");
+ print_loop_ir_bb (file, GBB_BB (gb), indent+2, verbosity);
+ dump_data_references (file, GBB_DATA_REFS (gb));
+ fprintf (file, ")\n");
}
/* Print SCOP to FILE. */
@@ -67,12 +70,12 @@ print_scop (FILE *file, scop_p scop, int
scop->entry->index, scop->exit->index);
fprintf (file, " (static schedule: ");
- print_lambda_vector (file, SCOP_STATIC_SCHEDULE (scop), SCOP_NB_LOOPS (scop));
+ print_lambda_vector (file, SCOP_STATIC_SCHEDULE (scop), scop_nb_loops (scop));
fprintf (file, " )\n");
fprintf (file, " (domain: \n");
for (i = 0; VEC_iterate (lambda_vector, SCOP_DOMAIN (scop), i, v); i++)
- print_lambda_vector (file, v, SCOP_DIM_DOMAIN (scop));
+ print_lambda_vector (file, v, scop_dim_domain (scop));
fprintf (file, " )\n");
if (scop->bbs)
@@ -339,7 +342,7 @@ test_for_scop_bound (struct dom_walk_dat
if (bb == ENTRY_BLOCK_PTR)
return;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "down bb_%d\n", bb->index);
/* Exiting the loop containing the open scop ends the scop. */
@@ -352,7 +355,7 @@ test_for_scop_bound (struct dom_walk_dat
down_open_scop = XNEW (struct scop);
down_open_scop->entry = bb;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "dom bound bb_%d\n\n", bb->index);
return;
@@ -367,7 +370,7 @@ test_for_scop_bound (struct dom_walk_dat
down_open_scop = XNEW (struct scop);
down_open_scop->entry = bb;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (debug_p ())
fprintf (dump_file, "difficult bound bb_%d\n\n", bb->index);
return;
@@ -451,11 +454,11 @@ scan_tree_for_params (scop_p scop, tree
break;
case SSA_NAME:
- ineq[SCOP_NB_LOOPS (scop) + param_index (expr, scop)] = k;
+ ineq[scop_nb_loops (scop) + param_index (expr, scop)] = k;
break;
case INTEGER_CST:
- ineq[SCOP_NB_LOOPS (scop) + SCOP_NB_PARAMS (scop)] = int_cst_value (expr);
+ ineq[scop_nb_loops (scop) + scop_nb_params (scop)] = int_cst_value (expr);
break;
case NOP_EXPR:
@@ -469,20 +472,19 @@ scan_tree_for_params (scop_p scop, tree
}
}
-/* Returns the index of LOOP in the domain matrix for the SCOP. */
+/* Record LOOP as occuring in SCOP. */
-static int
-scop_loop_index (scop_p scop, struct loop *loop)
+static inline void
+scop_record_loop (scop_p scop, struct loop *loop)
{
unsigned i;
struct loop *l;
for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, l); i++)
if (l == loop)
- return i;
+ return;
VEC_safe_push (loop_p, heap, SCOP_LOOP_NEST (scop), loop);
- return VEC_length (loop_p, SCOP_LOOP_NEST (scop)) - 1;
}
/* Build the loop nest around basic block BB. */
@@ -496,9 +498,7 @@ build_scop_loop_nests (scop_p scop)
SCOP_LOOP_NEST (scop) = VEC_alloc (loop_p, heap, 3);
for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- scop_loop_index (scop, GBB_BB (gb)->loop_father);
-
- SCOP_NB_LOOPS (scop) = VEC_length (loop_p, SCOP_LOOP_NEST (scop));
+ scop_record_loop (scop, GBB_BB (gb)->loop_father);
}
/* Build the current domain matrix: the loops belonging to the current
@@ -510,14 +510,13 @@ build_scop_domain (scop_p scop)
unsigned i;
struct loop *loop;
- SCOP_DIM_DOMAIN (scop) = SCOP_NB_LOOPS (scop) + SCOP_NB_PARAMS (scop) + 1;
- SCOP_DOMAIN (scop) = VEC_alloc (lambda_vector, heap, SCOP_DIM_DOMAIN (scop));
+ SCOP_DOMAIN (scop) = VEC_alloc (lambda_vector, heap, scop_dim_domain (scop));
for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, loop); i++)
{
tree nb_iters = number_of_latch_executions (loop);
- lambda_vector ineq_low = lambda_vector_new (SCOP_DIM_DOMAIN (scop));
- lambda_vector ineq_up = lambda_vector_new (SCOP_DIM_DOMAIN (scop));
+ lambda_vector ineq_low = lambda_vector_new (scop_dim_domain (scop));
+ lambda_vector ineq_up = lambda_vector_new (scop_dim_domain (scop));
if (chrec_contains_undetermined (nb_iters))
continue;
@@ -532,7 +531,7 @@ build_scop_domain (scop_p scop)
/* loop_i <= nb_iters */
ineq_up[i] = -1;
- ineq_up[SCOP_DIM_DOMAIN (scop) - 1] = nbi;
+ ineq_up[scop_dim_domain (scop) - 1] = nbi;
VEC_safe_push (lambda_vector, heap, SCOP_DOMAIN (scop), ineq_up);
}
@@ -595,25 +594,31 @@ idx_record_params (tree base, tree *idx,
}
/* Initialize the access matrix in the data reference REF with respect
- to the loop nesting LOOP_NEST. */
+ to the loop nesting LOOP_NEST. Return true when the operation
+ succeeded. */
-static void
-build_access_matrix (data_reference_p ref ATTRIBUTE_UNUSED, graphite_bb_p bb ATTRIBUTE_UNUSED)
+static bool
+build_access_matrix (data_reference_p ref, graphite_bb_p gb)
{
+ unsigned i;
-#if 0
- for (i = 0; i < DDR_NUM_SUBSCRIPTS (ref); i++)
- {
- lambda_vector v = lambda_vector_new (VEC_length (loop_p, loop_nest));
- bool res = build_access_matrix_with_af (DR_ACCESS_FN (ref, i), v,
- loop_nest, params);
- if (res == false)
- {
- ref->affine = false;
- break;
- }
+ DR_SCOP (ref) = GBB_SCOP (gb);
+ DR_ACCESS_MATRIX (ref) = VEC_alloc (lambda_vector, heap,
+ DR_NUM_DIMENSIONS (ref));
+
+ for (i = 0; i < DR_NUM_DIMENSIONS (ref); i++)
+ {
+ lambda_vector v = lambda_vector_new (gbb_dim_domain (gb));
+ bool res = build_access_matrix_with_af (DR_ACCESS_FN (ref, i), v,
+ SCOP_LOOP_NEST (GBB_SCOP (gb)),
+ SCOP_PARAMS (GBB_SCOP (gb)));
+ if (!res)
+ return false;
+
+ VEC_safe_push (lambda_vector, heap, DR_ACCESS_MATRIX (ref), v);
}
-#endif
+
+ return true;
}
/* Build a schedule for each basic-block in the SCOP. */
@@ -651,16 +656,16 @@ build_scop_canonical_schedules (scop_p s
unsigned i;
graphite_bb_p gb;
- SCOP_STATIC_SCHEDULE (scop) = lambda_vector_new (SCOP_NB_LOOPS (scop) + 1);
+ SCOP_STATIC_SCHEDULE (scop) = lambda_vector_new (scop_nb_loops (scop) + 1);
for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
{
basic_block bb = GBB_BB (gb);
SCOP_STATIC_SCHEDULE (scop)[scop_loop_index (scop, bb->loop_father)] += 1;
- GBB_STATIC_SCHEDULE (gb) = lambda_vector_new (SCOP_NB_LOOPS (scop));
+ GBB_STATIC_SCHEDULE (gb) = lambda_vector_new (scop_nb_loops (scop));
lambda_vector_copy (SCOP_STATIC_SCHEDULE (scop), GBB_STATIC_SCHEDULE (gb),
- SCOP_NB_LOOPS (scop) + 1);
+ scop_nb_loops (scop) + 1);
}
}
@@ -681,6 +686,7 @@ build_graphite_bb (struct dom_walk_data
/* Build the new representation for the basic block. */
gb = XNEW (struct graphite_bb);
GBB_BB (gb) = bb;
+ GBB_SCOP (gb) = scop;
/* Store the GRAPHITE representation of the current BB. */
VEC_safe_push (graphite_bb_p, heap, scop->bbs, gb);
@@ -766,8 +772,6 @@ build_scop_params (scop_p scop)
init_walk_dominator_tree (&walk_data);
walk_dominator_tree (&walk_data, scop->entry);
fini_walk_dominator_tree (&walk_data);
-
- SCOP_NB_PARAMS (scop) = VEC_length (tree, SCOP_PARAMS (scop));
}
/* Find the right transform for the SCOP. */
@@ -784,7 +788,6 @@ find_transform (scop_p scop ATTRIBUTE_UN
static void
gloog (scop_p scop ATTRIBUTE_UNUSED)
{
-
}
Index: graphite.h
===================================================================
--- graphite.h (revision 120479)
+++ graphite.h (working copy)
@@ -25,23 +25,21 @@ typedef struct graphite_bb *graphite_bb_
DEF_VEC_P(graphite_bb_p);
DEF_VEC_ALLOC_P (graphite_bb_p, heap);
-typedef struct scop *scop_p;
DEF_VEC_P(scop_p);
DEF_VEC_ALLOC_P (scop_p, heap);
struct graphite_bb
{
basic_block bb;
+ scop_p scop;
lambda_vector static_schedule;
- VEC (lambda_vector, heap) *iteration_domain;
VEC (data_reference_p, heap) *data_refs;
};
#define GBB_BB(GBB) GBB->bb
#define GBB_SCOP(GBB) GBB->scop
#define GBB_STATIC_SCHEDULE(GBB) GBB->static_schedule
-#define GBB_DOMAIN(GBB) GBB->iteration_domain
#define GBB_DATA_REFS(GBB) GBB->data_refs
@@ -60,14 +58,11 @@ struct scop
lambda_vector static_schedule;
/* Parameters used within the SCOP. */
- int nb_params;
VEC (tree, heap) *params;
/* Loops contained in the scop. */
- int nb_loops;
VEC (loop_p, heap) *loop_nest;
- int dim_domain;
VEC (lambda_vector, heap) *iteration_domain;
};
@@ -76,14 +71,59 @@ struct scop
#define SCOP_EXIT(S) S->exit
#define SCOP_STATIC_SCHEDULE(S) S->static_schedule
#define SCOP_LOOP_NEST(S) S->loop_nest
-#define SCOP_NB_LOOPS(S) S->nb_loops
#define SCOP_PARAMS(S) S->params
-#define SCOP_NB_PARAMS(S) S->nb_params
-#define SCOP_DIM_DOMAIN(S) S->dim_domain
+
#define SCOP_DOMAIN(S) S->iteration_domain
extern void debug_scop (scop_p, int);
extern void debug_scops (int);
extern void print_graphite_bb (FILE *, graphite_bb_p, int, int);
-#define SCOP_STMTS(S) (S)->stmts
+/* Return the number of parameters used in SCOP. */
+
+static inline int
+scop_nb_params (scop_p scop)
+{
+ return VEC_length (tree, SCOP_PARAMS (scop));
+}
+
+/* Return the number of loops contained in SCOP. */
+
+static inline int
+scop_nb_loops (scop_p scop)
+{
+ return VEC_length (loop_p, SCOP_LOOP_NEST (scop));
+}
+
+/* Return the dimension of the domains for SCOP. */
+
+static inline int
+scop_dim_domain (scop_p scop)
+{
+ return scop_nb_loops (scop) + scop_nb_params (scop) + 1;
+}
+
+/* Return the dimension of the domains for GB. */
+
+static inline int
+gbb_dim_domain (graphite_bb_p gb)
+{
+ return scop_dim_domain (GBB_SCOP (gb));
+}
+
+/* Returns the index of LOOP in the domain matrix for the SCOP. */
+
+static inline int
+scop_loop_index (scop_p scop, struct loop *loop)
+{
+ unsigned i;
+ struct loop *l;
+
+ for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, l); i++)
+ if (l == loop)
+ return i;
+
+ gcc_unreachable ();
+ return -1;
+}
+
Index: Makefile.in
===================================================================
--- Makefile.in (revision 120479)
+++ Makefile.in (working copy)
@@ -2068,7 +2068,7 @@ tree-scalar-evolution.o: tree-scalar-evo
tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
- $(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h langhooks.h
+ $(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h langhooks.h graphite.h
graphite.o: graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) domwalk.h \