This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lno] don't use access functions
- From: Sebastian Pop <sebastian dot pop at cri dot ensmp dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 6 Jul 2004 21:12:37 +0200
- Subject: [lno] don't use access functions
Hi,
As discussed earlier, it is considered bad practice to use functions
instead of directly accessing the fields of a struct. This patch
inlines all these access functions.
Bootstrapped on i686.
Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.209
diff -d -u -p -r1.1.2.209 ChangeLog.lno
--- ChangeLog.lno 4 Jul 2004 10:58:54 -0000 1.1.2.209
+++ ChangeLog.lno 6 Jul 2004 19:12:54 -0000
@@ -1,3 +1,16 @@
+2004-07-06 Sebastian Pop <pop@cri.ensmp.fr>
+
+ * basic-block.h (edge_source, edge_destination): Removed.
+ * cfgloop.c (superloop_at_depth): Fix comment.
+ * cfgloop.h (loop_from_num, outer_loop, inner_loop, next_loop,
+ loop_num, loop_depth, loop_header, loop_nb_iterations,
+ loop_num_exits, loop_exit_edges, loop_exit_edge): Removed.
+ * lambda-code.c, tree-cfg.c, tree-data-ref.c, tree-dg.c,
+ tree-elim-check.c, tree-scalar-evolution.c, tree-ssa-dom.c,
+ tree-ssa-loop-ivcanon.c, tree-vectorizer.c: Inline removed functions.
+ * tree-data-ref.c: Rewrite some comments.
+ * tree-flow-inline.h (loop_of_stmt): Renamed loop_containing_stmt.
+
2004-07-04 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c (vect_create_data_ref, vect_init_vector):
@@ -642,7 +655,7 @@
(can_count_iv_in_wider_type): Pass the additional info to
can_count_iv_in_wider_type_bound.
(can_count_iv_in_wider_type_bound): Use the additional info.
- * trre.h (lower_bound_in_type, upper_bound_in_type): Declare.
+ * tree.h (lower_bound_in_type, upper_bound_in_type): Declare.
* config/i386/i386.c (legitimate_constant_p): Do not allow
integer - symbol.
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.153.2.39.2.10
diff -d -u -p -r1.153.2.39.2.10 basic-block.h
--- basic-block.h 14 Jun 2004 01:57:38 -0000 1.153.2.39.2.10
+++ basic-block.h 6 Jul 2004 19:12:54 -0000
@@ -178,22 +178,6 @@ typedef struct edge_def *edge;
#define EDGE_COMPLEX (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
-/* Returns the block at the beginning of the edge. */
-
-static inline struct basic_block_def *
-edge_source (edge e)
-{
- return e->src;
-}
-
-/* Returns the block at the end of the edge. */
-
-static inline struct basic_block_def *
-edge_destination (edge e)
-{
- return e->dest;
-}
-
/* Counter summary from the last set of coverage counts read by
profile.c. */
extern const struct gcov_ctr_summary *profile_info;
Index: cfgloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.c,v
retrieving revision 1.14.2.12.2.5
diff -d -u -p -r1.14.2.12.2.5 cfgloop.c
--- cfgloop.c 14 May 2004 02:29:44 -0000 1.14.2.12.2.5
+++ cfgloop.c 6 Jul 2004 19:12:54 -0000
@@ -101,7 +101,8 @@ flow_loop_nested_p (const struct loop *o
&& loop->pred[outer->depth] == outer;
}
-/* Returns superloop of LOOP at given DEPTH. */
+/* Returns the loop such that LOOP is nested DEPTH (indexed from zero)
+ loops within LOOP. */
struct loop *
superloop_at_depth (struct loop *loop, unsigned depth)
Index: cfgloop.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.h,v
retrieving revision 1.2.4.9.2.19
diff -d -u -p -r1.2.4.9.2.19 cfgloop.h
--- cfgloop.h 22 Jun 2004 14:12:21 -0000 1.2.4.9.2.19
+++ cfgloop.h 6 Jul 2004 19:12:54 -0000
@@ -452,105 +452,4 @@ extern void unroll_and_peel_loops (struc
extern void doloop_optimize_loops (struct loops *);
extern void move_loop_invariants (struct loops *);
-static inline struct loop *loop_from_num (struct loops *, unsigned);
-static inline struct loop *outer_loop (struct loop *);
-static inline struct loop *inner_loop (struct loop *);
-static inline struct loop *next_loop (struct loop *);
-static inline unsigned loop_num (struct loop *);
-static inline unsigned loop_depth (struct loop *);
-static inline basic_block loop_header (struct loop *);
-static inline tree loop_nb_iterations (struct loop *);
-static inline unsigned loop_num_exits (struct loop *);
-static inline edge *loop_exit_edges (struct loop *);
-static inline edge loop_exit_edge (struct loop *, unsigned);
-
-static inline struct loop *
-loop_from_num (struct loops *loops,
- unsigned num)
-{
- return loops->parray[num];
-}
-
-/* Returns the outer loop. */
-
-static inline struct loop *
-outer_loop (struct loop *loop)
-{
- return loop->outer;
-}
-
-/* Returns the inner loop. */
-
-static inline struct loop *
-inner_loop (struct loop *loop)
-{
- return loop->inner;
-}
-
-/* Returns the next loop. */
-
-static inline struct loop *
-next_loop (struct loop *loop)
-{
- return loop->next;
-}
-
-/* Returns the number of a loop. */
-
-static inline unsigned
-loop_num (struct loop *loop)
-{
- return loop->num;
-}
-
-/* Returns the depth of a loop. */
-
-static inline unsigned
-loop_depth (struct loop *loop)
-{
- return loop->depth;
-}
-
-/* Returns the header basic block of the loop. */
-
-static inline basic_block
-loop_header (struct loop *loop)
-{
- return loop->header;
-}
-
-/* Returns the number of iterations in the loop. Use
- number_of_iterations_in_loop () instead of accessing directly this
- field. */
-
-static inline tree
-loop_nb_iterations (struct loop *loop)
-{
- return loop->nb_iterations;
-}
-
-/* Returns the number of exit edges of the loop. */
-
-static inline unsigned
-loop_num_exits (struct loop *loop)
-{
- return loop->num_exits;
-}
-
-/* Returns the exit edges of the loop. */
-
-static inline edge *
-loop_exit_edges (struct loop *loop)
-{
- return loop->exit_edges;
-}
-
-/* Returns the n-th exit edge of the loop. */
-
-static inline edge
-loop_exit_edge (struct loop *loop, unsigned n)
-{
- return loop->exit_edges[n];
-}
-
#endif /* GCC_CFGLOOP_H */
Index: lambda-code.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/lambda-code.c,v
retrieving revision 1.1.2.13
diff -d -u -p -r1.1.2.13 lambda-code.c
--- lambda-code.c 28 Jun 2004 19:59:58 -0000 1.1.2.13
+++ lambda-code.c 6 Jul 2004 19:12:54 -0000
@@ -1189,7 +1189,7 @@ gcc_loop_to_lambda_loop (struct loop *lo
return NULL;
}
- step = evolution_part_in_loop_num (access_fn, loop_num (loop));
+ step = evolution_part_in_loop_num (access_fn, loop->num);
if (!step || step == chrec_dont_know)
{
if (dump_file && (dump_flags & TDF_DETAILS))
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 1.1.4.244.2.20
diff -d -u -p -r1.1.4.244.2.20 tree-cfg.c
--- tree-cfg.c 17 Jun 2004 18:25:11 -0000 1.1.4.244.2.20
+++ tree-cfg.c 6 Jul 2004 19:12:54 -0000
@@ -4413,10 +4413,10 @@ print_loop (FILE *file, struct loop *loo
/* Print the loop's header. */
fprintf (file, "%s(loop (num %d)", s_indent, loop->num);
- if (loop_nb_iterations (loop))
+ if (loop->nb_iterations)
{
fprintf (file, " (nb_iterations ");
- print_generic_expr (file, loop_nb_iterations (loop), 0);
+ print_generic_expr (file, loop->nb_iterations, 0);
fprintf (file, ")");
}
Index: tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-data-ref.c,v
retrieving revision 1.1.2.24
diff -d -u -p -r1.1.2.24 tree-data-ref.c
--- tree-data-ref.c 28 Jun 2004 16:00:10 -0000 1.1.2.24
+++ tree-data-ref.c 6 Jul 2004 19:12:54 -0000
@@ -19,13 +19,9 @@ along with GCC; see the file COPYING. I
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* This pass walks the whole program searching for array references.
- The array accesses are recorded in DATA_REFERENCE nodes. Since the
- information in the DATA_REFERENCE nodes is too precise, the
- dependence testers abstract this information into classic
- representations: distance vectors, direction vectors, affine
- dependence functions, ... Both the precise and more abstract
- informations are then exposed to the other passes.
+/* This pass walks a given loop structure searching for array
+ references. The information about the array accesses is recorded
+ in DATA_REFERENCE structures.
The basic test for determining the dependences is:
given two access functions chrec1 and chrec2 to a same array, and
@@ -48,7 +44,6 @@ Software Foundation, 59 Temple Place - S
- polyhedron dependence
or with the chains of recurrences based representation,
-
- to define a knowledge base for storing the data dependeces
information,
@@ -57,23 +52,20 @@ Software Foundation, 59 Temple Place - S
Definitions:
- - What is a subscript? Given two array accesses a subscript is the
- tuple composed of the access functions for a given dimension.
- Example: Given A[f1][f2][f3] and B[g1][g2][g3], there are three
- subscripts: (f1, g1), (f2, g2), (f3, g3).
-
- - Vertical and horizontal couplings. In some of the comments of
- this analysis, I refer to the overlapping elements of a subscript
- as the vertical coupling, in opposition to the horizontal coupling
- that refers to the coupling between subscripts.
+ - subscript: given two array accesses a subscript is the tuple
+ composed of the access functions for a given dimension. Example:
+ Given A[f1][f2][f3] and B[g1][g2][g3], there are three subscripts:
+ (f1, g1), (f2, g2), (f3, g3).
References:
- - "Advanced Compilation for High Performance Computing" by Randy Allen
- and Ken Kennedy.
+ - "Advanced Compilation for High Performance Computing" by Randy
+ Allen and Ken Kennedy.
+ http://citeseer.ist.psu.edu/goff91practical.html
- "Loop Transformations for Restructuring Compilers - The Foundations"
by Utpal Banerjee.
+
*/
@@ -489,7 +481,7 @@ analyze_array (tree stmt, tree ref, bool
DR_REF (res) = ref;
VARRAY_TREE_INIT (DR_ACCESS_FNS (res), 3, "access_fns");
DR_BASE_NAME (res) = analyze_array_indexes
- (loop_of_stmt (stmt), DR_ACCESS_FNS (res), ref);
+ (loop_containing_stmt (stmt), DR_ACCESS_FNS (res), ref);
DR_IS_READ (res) = is_read;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1439,36 +1431,36 @@ build_classic_dist_vector (struct data_d
struct data_reference *a = DDR_A (res);
struct data_reference *b = DDR_B (res);
int lca_nb;
- loop_a = loop_of_stmt (DR_STMT (a));
- loop_b = loop_of_stmt (DR_STMT (b));
+ loop_a = loop_containing_stmt (DR_STMT (a));
+ loop_b = loop_containing_stmt (DR_STMT (b));
/* Get the common ancestor loop. */
lca = find_common_loop (loop_a, loop_b);
- lca_nb = loop_num (lca);
+ lca_nb = lca->num;
lca_nb -= first_loop;
if (lca_nb < 0 || lca_nb >= nb_loops)
abort ();
- /* For each outer_loop where init_v is not set, the accesses are
+ /* For each outer loop where init_v is not set, the accesses are
in dependence of distance 1 in the loop. */
if (lca != loop_a
&& lca != loop_b
&& init_v[lca_nb] == 0)
dist_v[lca_nb] = 1;
- lca = outer_loop (lca);
+ lca = lca->outer;
if (lca)
{
- lca_nb = loop_num (lca) - first_loop;
- while (loop_depth (lca) != 0)
+ lca_nb = lca->num - first_loop;
+ while (lca->depth != 0)
{
if (lca_nb < 0 || lca_nb >= nb_loops)
abort ();
if (init_v[lca_nb] == 0)
dist_v[lca_nb] = 1;
- lca = outer_loop (lca);
- lca_nb = loop_num (lca) - first_loop;
+ lca = lca->outer;
+ lca_nb = lca->num - first_loop;
}
}
@@ -1566,34 +1558,34 @@ build_classic_dir_vector (struct data_de
struct data_reference *a = DDR_A (res);
struct data_reference *b = DDR_B (res);
int lca_nb;
- loop_a = loop_of_stmt (DR_STMT (a));
- loop_b = loop_of_stmt (DR_STMT (b));
+ loop_a = loop_containing_stmt (DR_STMT (a));
+ loop_b = loop_containing_stmt (DR_STMT (b));
/* Get the common ancestor loop. */
lca = find_common_loop (loop_a, loop_b);
- lca_nb = loop_num (lca) - first_loop;
+ lca_nb = lca->num - first_loop;
if (lca_nb < 0 || lca_nb >= nb_loops)
abort ();
- /* For each outer_loop where init_v is not set, the accesses are
+ /* For each outer loop where init_v is not set, the accesses are
in dependence of distance 1 in the loop. */
if (lca != loop_a
&& lca != loop_b
&& init_v[lca_nb] == 0)
dir_v[lca_nb] = dir_positive;
- lca = outer_loop (lca);
+ lca = lca->outer;
if (lca)
{
- lca_nb = loop_num (lca) - first_loop;
- while (loop_depth (lca) != 0)
+ lca_nb = lca->num - first_loop;
+ while (lca->depth != 0)
{
if (lca_nb < 0 || lca_nb >= nb_loops)
abort ();
if (init_v[lca_nb] == 0)
dir_v[lca_nb] = dir_positive;
- lca = outer_loop (lca);
- lca_nb = loop_num (lca) - first_loop;
+ lca = lca->outer;
+ lca_nb = lca->num - first_loop;
}
}
@@ -1821,7 +1813,7 @@ analyze_all_data_dependences (struct loo
"dependence_relations");
/* Compute DDs on the whole function. */
- compute_data_dependences_for_loop (loops->num, loop_from_num (loops, 0),
+ compute_data_dependences_for_loop (loops->num, loops->parray[0],
&datarefs, &dependence_relations,
&classic_dist, &classic_dir);
Index: tree-dg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dg.c,v
retrieving revision 1.1.2.12
diff -d -u -p -r1.1.2.12 tree-dg.c
--- tree-dg.c 22 Jun 2004 16:03:44 -0000 1.1.2.12
+++ tree-dg.c 6 Jul 2004 19:12:54 -0000
@@ -99,7 +99,7 @@ void dg_create_graph (struct loops *loop
/* Analyze data references and dependence relations using scev. */
- compute_data_dependences_for_loop (loops->num, loop_from_num (loops, 0),
+ compute_data_dependences_for_loop (loops->num, loops->parray[0],
&datarefs, &dependence_relations,
&classic_dist, &classic_dir);
Index: tree-elim-check.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-elim-check.c,v
retrieving revision 1.1.2.11
diff -d -u -p -r1.1.2.11 tree-elim-check.c
--- tree-elim-check.c 22 Jun 2004 16:03:44 -0000 1.1.2.11
+++ tree-elim-check.c 6 Jul 2004 19:12:54 -0000
@@ -347,7 +347,7 @@ try_eliminate_check (tree cond)
bool value;
tree test, opnd0, opnd1;
tree chrec0, chrec1;
- struct loop *loop = loop_of_stmt (cond);
+ struct loop *loop = loop_containing_stmt (cond);
tree nb_iters = number_of_iterations_in_loop (loop);
enum tree_code code;
@@ -433,8 +433,8 @@ scan_all_loops_r (struct loop *loop)
return;
/* Recurse on the inner loops, then on the next (sibling) loops. */
- scan_all_loops_r (inner_loop (loop));
- scan_all_loops_r (next_loop (loop));
+ scan_all_loops_r (loop->inner);
+ scan_all_loops_r (loop->next);
flow_loop_scan (loop, LOOP_EXIT_EDGES);
}
@@ -469,8 +469,8 @@ eliminate_redundant_checks (void)
/* Don't try to prove anything about the loop exit
conditions: avoid the block that contains the condition
that guards the exit of the loop. */
- if (!loop_exit_edges (loop)
- || edge_source (loop_exit_edge (loop, 0)) == bb)
+ if (!loop->exit_edges
+ || loop->exit_edges[0]->src == bb)
continue;
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 1.1.2.64.2.10
diff -d -u -p -r1.1.2.64.2.10 tree-flow-inline.h
--- tree-flow-inline.h 17 Jun 2004 18:25:11 -0000 1.1.2.64.2.10
+++ tree-flow-inline.h 6 Jul 2004 19:12:54 -0000
@@ -697,7 +697,7 @@ bsi_stmt_ptr (block_stmt_iterator i)
/* Returns the loop of the statement STMT. */
static inline struct loop *
-loop_of_stmt (tree stmt)
+loop_containing_stmt (tree stmt)
{
basic_block bb = bb_for_stmt (stmt);
if (!bb)
Index: tree-scalar-evolution.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-scalar-evolution.c,v
retrieving revision 1.1.2.64
diff -d -u -p -r1.1.2.64 tree-scalar-evolution.c
--- tree-scalar-evolution.c 28 Jun 2004 04:47:46 -0000 1.1.2.64
+++ tree-scalar-evolution.c 6 Jul 2004 19:12:54 -0000
@@ -28,7 +28,21 @@ Software Foundation, 59 Temple Place - S
the notion of versions of a variable, as it was the case for the
previous implementations of the scalar evolution algorithm, but
it assumes that each defined name is unique.
-
+
+ The notation used in this file is called "chains of recurrences",
+ and has been proposed by Eugene Zima, Robert Van Engelen, and
+ others for describing induction variables in programs. For example
+ "b -> {0, +, 2}_1" means that the scalar variable "b" is equal to 0
+ when entering in the loop_1 and has a step 2 in this loop, in other
+ words "for (b = 0; b < N; b+=2);". Note that the coefficients of
+ this chain of recurrence (or chrec [shrek]) can contain the name of
+ other variables, in which case they are called parametric chrecs.
+ For example, "b -> {a, +, 2}_1" means that the initial value of "b"
+ is the value of "a". In most of the cases these parametric chrecs
+ are fully instantiated before their use because symbolic names can
+ hide some difficult cases such as self-references described later
+ (see the Fibonacci example).
+
A short sketch of the algorithm is:
Given a scalar variable to be analyzed, follow the SSA edge to
@@ -351,7 +365,7 @@ count_ev_in_wider_type (tree type, tree
base = CHREC_LEFT (chrec);
step = CHREC_RIGHT (chrec);
- loop = loop_from_num (current_loops, CHREC_VARIABLE (chrec));
+ loop = current_loops->parray[CHREC_VARIABLE (chrec)];
/* TODO -- if we knew the statement at that the conversion occurs,
we could pass it to can_count_iv_in_wider_type and get a better
@@ -388,8 +402,8 @@ chrec_contains_symbols_defined_in_loop (
if (TREE_CODE (chrec) == SSA_NAME)
{
tree def = SSA_NAME_DEF_STMT (chrec);
- struct loop *def_loop = loop_of_stmt (def);
- struct loop *loop = loop_from_num (current_loops, loop_nb);
+ struct loop *def_loop = loop_containing_stmt (def);
+ struct loop *loop = current_loops->parray[loop_nb];
if (def_loop == NULL)
return false;
@@ -436,7 +450,7 @@ loop_phi_node_p (tree phi)
property: "all the loop-phi-nodes of a loop are contained in the
loop's header basic block". */
- return loop_of_stmt (phi)->header == bb_for_stmt (phi);
+ return loop_containing_stmt (phi)->header == bb_for_stmt (phi);
}
/* Compute the scalar evolution for EVOLUTION_FN after crossing LOOP.
@@ -484,10 +498,10 @@ compute_overall_effect_of_inner_loop (st
else if (TREE_CODE (evolution_fn) == POLYNOMIAL_CHREC)
{
- if (CHREC_VARIABLE (evolution_fn) >= loop_num (loop))
+ if (CHREC_VARIABLE (evolution_fn) >= (unsigned) loop->num)
{
struct loop *inner_loop =
- loop_from_num (current_loops, CHREC_VARIABLE (evolution_fn));
+ current_loops->parray[CHREC_VARIABLE (evolution_fn)];
tree nb_iter = number_of_iterations_in_loop (inner_loop);
if (nb_iter == chrec_dont_know)
@@ -556,12 +570,12 @@ chrec_is_positive (tree chrec, bool *val
/* Otherwise the chrec is under the form: "{-197, +, 2}_1",
and the proof consists in showing that the sign never
changes during the execution of the loop, from 0 to
- loop_nb_iterations (). */
+ loop->nb_iterations. */
if (!evolution_function_is_affine_p (chrec))
return false;
nb_iter = number_of_iterations_in_loop
- (loop_from_num (current_loops, CHREC_VARIABLE (chrec)));
+ (current_loops->parray[CHREC_VARIABLE (chrec)]);
if (chrec_contains_undetermined (nb_iter))
return false;
@@ -672,7 +686,13 @@ get_scalar_evolution (tree scalar)
return res;
}
-/* When CHREC_BEFORE has an evolution part in LOOP_NB, add to this
+/* Helper function for add_to_evolution. Returns the evolution
+ function for an assignment of the form "a = b + c", where "a" and
+ "b" are on the strongly connected component. CHREC_BEFORE is the
+ information that we already have collected up to this point.
+ TO_ADD is the evolution of "c".
+
+ When CHREC_BEFORE has an evolution part in LOOP_NB, add to this
evolution the expression TO_ADD, otherwise construct an evolution
part for this loop. */
@@ -907,8 +927,6 @@ static inline tree
set_nb_iterations_in_loop (struct loop *loop,
tree res)
{
- /* After the loop copy headers has transformed the code, each loop
- runs at least once. */
res = chrec_fold_plus (chrec_type (res), res, integer_one_node);
/* FIXME HWI: However we want to store one iteration less than the
count of the loop in order to be compatible with the other
@@ -1001,13 +1019,13 @@ get_loop_exit_condition (struct loop *lo
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "(get_loop_exit_condition \n ");
- if (loop_exit_edges (loop))
+ if (loop->exit_edges)
{
edge exit_edge;
tree expr;
- exit_edge = loop_exit_edge (loop, 0);
- expr = last_stmt (edge_source (exit_edge));
+ exit_edge = loop->exit_edges[0];
+ expr = last_stmt (exit_edge->src);
if (analyzable_condition (expr))
res = expr;
@@ -1032,11 +1050,11 @@ get_exit_conditions_rec (struct loop *lo
return;
/* Recurse on the inner loops, then on the next (sibling) loops. */
- get_exit_conditions_rec (inner_loop (loop), exit_conditions);
- get_exit_conditions_rec (next_loop (loop), exit_conditions);
+ get_exit_conditions_rec (loop->inner, exit_conditions);
+ get_exit_conditions_rec (loop->next, exit_conditions);
flow_loop_scan (loop, LOOP_EXIT_EDGES);
- if (loop_num_exits (loop) == 1)
+ if (loop->num_exits == 1)
{
tree loop_condition = get_loop_exit_condition (loop);
@@ -1057,7 +1075,7 @@ select_loops_exit_conditions (struct loo
{
struct loop *function_body = loops->parray[0];
- get_exit_conditions_rec (inner_loop (function_body), exit_conditions);
+ get_exit_conditions_rec (function_body->inner, exit_conditions);
}
@@ -1421,7 +1439,7 @@ follow_ssa_edge_inner_loop_phi (struct l
tree halting_phi,
tree *evolution_of_loop)
{
- struct loop *loop = loop_of_stmt (loop_phi_node);
+ struct loop *loop = loop_containing_stmt (loop_phi_node);
tree ev = analyze_scalar_evolution (loop, PHI_RESULT (loop_phi_node));
/* Sometimes, the inner loop is too difficult to analyze, and the
@@ -1470,7 +1488,7 @@ follow_ssa_edge (struct loop *loop,
if (TREE_CODE (def) == NOP_EXPR)
return false;
- def_loop = loop_of_stmt (def);
+ def_loop = loop_containing_stmt (def);
switch (TREE_CODE (def))
{
@@ -1528,7 +1546,7 @@ analyze_evolution_in_loop (tree loop_phi
{
int i;
tree evolution_function = chrec_not_analyzed_yet;
- struct loop *loop = loop_of_stmt (loop_phi_node);
+ struct loop *loop = loop_containing_stmt (loop_phi_node);
basic_block bb;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1652,7 +1670,7 @@ static tree
interpret_loop_phi (struct loop *loop, tree loop_phi_node)
{
tree res;
- struct loop *phi_loop = loop_of_stmt (loop_phi_node);
+ struct loop *phi_loop = loop_containing_stmt (loop_phi_node);
tree init_cond;
if (phi_loop != loop)
@@ -1890,7 +1908,7 @@ analyze_scalar_evolution_1 (struct loop
determine the evolution function of the variable, use the following
calls:
- unsigned loop_nb = loop_num (loop_of_stmt (stmt));
+ unsigned loop_nb = loop_containing_stmt (stmt)->num;
tree chrec_with_symbols = analyze_scalar_evolution (loop_nb, var);
tree chrec_instantiated = instantiate_parameters
(loop_nb, chrec_with_symbols);
@@ -2174,7 +2192,7 @@ number_of_iterations_in_loop (struct loo
/* Determine whether the number_of_iterations_in_loop has already
been computed. */
- res = loop_nb_iterations (loop);
+ res = loop->nb_iterations;
if (res)
return res;
res = chrec_dont_know;
@@ -2182,9 +2200,9 @@ number_of_iterations_in_loop (struct loo
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "(number_of_iterations_in_loop\n");
- if (!loop_exit_edges (loop))
+ if (!loop->exit_edges)
goto end;
- exit = loop_exit_edge (loop, 0);
+ exit = loop->exit_edges[0];
if (!number_of_iterations_exit (loop, exit, &niter_desc))
goto end;
@@ -2215,7 +2233,7 @@ number_of_iterations_for_all_loops (varr
for (i = 0; i < VARRAY_ACTIVE_SIZE (exit_conditions); i++)
{
tree res = number_of_iterations_in_loop
- (loop_of_stmt (VARRAY_TREE (exit_conditions, i)));
+ (loop_containing_stmt (VARRAY_TREE (exit_conditions, i)));
if (chrec_contains_undetermined (res))
nb_chrec_dont_know_loops++;
else
@@ -2371,8 +2389,8 @@ analyze_scalar_evolution_for_all_loop_ph
basic_block bb;
tree phi, chrec;
- loop = loop_of_stmt (VARRAY_TREE (exit_conditions, i));
- bb = loop_header (loop);
+ loop = loop_containing_stmt (VARRAY_TREE (exit_conditions, i));
+ bb = loop->header;
for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
if (is_gimple_reg (PHI_RESULT (phi)))
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 1.1.2.102.2.10
diff -d -u -p -r1.1.2.102.2.10 tree-ssa-dom.c
--- tree-ssa-dom.c 17 Jun 2004 18:25:12 -0000 1.1.2.102.2.10
+++ tree-ssa-dom.c 6 Jul 2004 19:12:54 -0000
@@ -1720,7 +1720,7 @@ simplify_rhs_and_lookup_avail_expr (stru
/* See if the RHS_DEF_STMT has the same form as our statement. */
if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (rhs_def_stmt, 1)) == rhs_code
- && loop_of_stmt (rhs_def_stmt) == loop_of_stmt (stmt))
+ && loop_containing_stmt (rhs_def_stmt) == loop_containing_stmt (stmt))
{
tree rhs_def_operand;
@@ -1750,7 +1750,7 @@ simplify_rhs_and_lookup_avail_expr (stru
/* See if the RHS_DEF_STMT has the same form as our statement. */
if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (rhs_def_stmt, 1)) == rhs_code
- && loop_of_stmt (rhs_def_stmt) == loop_of_stmt (stmt))
+ && loop_containing_stmt (rhs_def_stmt) == loop_containing_stmt (stmt))
{
tree rhs_def_rhs = TREE_OPERAND (rhs_def_stmt, 1);
enum tree_code rhs_def_code = TREE_CODE (rhs_def_rhs);
Index: tree-ssa-loop-ivcanon.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-loop-ivcanon.c,v
retrieving revision 1.1.2.15
diff -d -u -p -r1.1.2.15 tree-ssa-loop-ivcanon.c
--- tree-ssa-loop-ivcanon.c 1 Jul 2004 04:24:34 -0000 1.1.2.15
+++ tree-ssa-loop-ivcanon.c 6 Jul 2004 19:12:54 -0000
@@ -195,7 +195,7 @@ canonicalize_loop_induction_variables (s
if (TREE_CODE (niter) == INTEGER_CST)
{
- exit = loop_exit_edge (loop, 0);
+ exit = loop->exit_edges[0];
if (!just_once_each_iteration_p (loop, exit->src))
return;
Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-vectorizer.c,v
retrieving revision 1.1.2.47
diff -d -u -p -r1.1.2.47 tree-vectorizer.c
--- tree-vectorizer.c 4 Jul 2004 10:58:54 -0000 1.1.2.47
+++ tree-vectorizer.c 6 Jul 2004 19:12:55 -0000
@@ -539,7 +539,7 @@ vect_create_index_for_array_ref (tree st
access_fn = DR_ACCESS_FN (dr, 0);
- if (!vect_is_simple_iv_evolution (loop_num (loop), access_fn, &init, &step,
+ if (!vect_is_simple_iv_evolution (loop->num, access_fn, &init, &step,
true))
abort ();
@@ -1694,7 +1694,7 @@ vect_update_initial_conditions_of_duplic
(loop,
analyze_scalar_evolution (loop, PHI_RESULT (phi)));
- evolution_part = evolution_part_in_loop_num (access_fn, loop_num(loop));
+ evolution_part = evolution_part_in_loop_num (access_fn, loop->num);
/* FORNOW: We do not transform initial conditions of IVs
which evolution functions are a polynomial of degree >= 2 or
@@ -1822,7 +1822,7 @@ static void
vect_transform_loop_bound (loop_vec_info loop_vinfo, tree niters)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- edge exit_edge = loop_exit_edge (loop, 0);
+ edge exit_edge = loop->exit_edges[0];
block_stmt_iterator loop_exit_bsi = bsi_last (exit_edge->src);
tree indx_before_incr, indx_after_incr;
tree orig_cond_expr;
@@ -2756,7 +2756,7 @@ vect_analyze_scalar_cycles (loop_vec_inf
print_generic_expr (dump_file, access_fn, TDF_SLIM);
}
- if (!vect_is_simple_iv_evolution (loop_num (loop), access_fn, &dummy,
+ if (!vect_is_simple_iv_evolution (loop->num, access_fn, &dummy,
&dummy, false))
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2836,7 +2836,7 @@ vect_analyze_data_ref_dependence (struct
{
if (!array_base_name_differ_p (dra, drb))
{
- int level = (loop_of_stmt (stmt))->level;
+ int level = (loop_containing_stmt (stmt))->level;
int loop_nest = level - 1;
/* FORNOW: use most trivial and conservative test. */
@@ -2849,7 +2849,7 @@ vect_analyze_data_ref_dependence (struct
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
"vect_analyze_data_ref_dependence: same base\n");
- vect_debug_stats (loop_of_stmt (stmt),
+ vect_debug_stats (loop_containing_stmt (stmt),
"not vectorized: can't prove independence of array-refs.");
return true;
}
@@ -2877,7 +2877,7 @@ vect_analyze_data_ref_dependence (struct
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,"non restricted pointers. may alias.\n");
- vect_debug_stats (loop_of_stmt (stmt),
+ vect_debug_stats (loop_containing_stmt (stmt),
"not vectorized: can't prove independence of pointer-refs.");
return true;
}
@@ -3318,8 +3318,8 @@ vect_analyze_data_ref_access (struct dat
}
access_fn = DR_ACCESS_FN (dr, 0);
- if (!vect_is_simple_iv_evolution (loop_num (loop_of_stmt (DR_STMT (dr))),
- access_fn, &init, &step, true))
+ if (!vect_is_simple_iv_evolution (loop_containing_stmt (DR_STMT (dr))->num,
+ access_fn, &init, &step, true))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -3510,8 +3510,8 @@ vect_analyze_data_refs (loop_vec_info lo
print_generic_expr (dump_file, access_fn, TDF_SLIM);
}
- if (!vect_is_simple_iv_evolution (loop_num (loop), access_fn,
- &init, &step, false))
+ if (!vect_is_simple_iv_evolution (loop->num, access_fn,
+ &init, &step, false))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Access func for ptr too complicated.");
@@ -3571,7 +3571,7 @@ vect_analyze_data_refs (loop_vec_info lo
#ifndef VECT_TRANSFORM_INDIRECT_REFS_TO_ARRAY_REFS
indx_access_fn = build_polynomial_chrec
- (loop_num (loop), integer_zero_node, integer_one_node);
+ (loop->num, integer_zero_node, integer_one_node);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Access function of ptr indx: ");
@@ -4017,7 +4017,7 @@ vect_analyze_loop_with_symbolic_num_of_i
print_generic_expr (dump_file, access_fn, TDF_SLIM);
}
- evolution_part = evolution_part_in_loop_num (access_fn, loop_num(loop));
+ evolution_part = evolution_part_in_loop_num (access_fn, loop->num);
if (evolution_part == NULL_TREE)
return false;