diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8da0981fba0..dd3b451854b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,37 @@ +2007-06-05 Thomas Neumann + + * cfg.c (init_flow): Use type safe memory macros. + (alloc_block): Likewise. + (unchecked_make_edge): Likewise. + (dump_flow_info): Avoid using C++ keywords as variable names. + (copy_original_table_clear): Cast according to the coding conventions. + (copy_original_table_set): Likewise. + * cfgexpand (label_rtx_for_bb): Likewise. + (expand_gimüle_basic_block): Likewise. + * cfghooks.c (dump_bb): Likewise. + (lv_adjust_loop_header_phi): Avoid using C++ keywords as variable names. + (lv_add_condition_to_bb): Likewise. + * cfglayout (relink_block_chain): Cast according to the coding + conventions. + (fixup_reorder_chain): Likewise. + (fixup_fallthru_exit_predecessor): Likewise. + * cfgloop.c (glb_enum_p): Likewise. + (get_exit_description): Likewise. + (dump_recorded_exit): Likewise. + * cfgloop.h (enum loop_estimation): Move out of struct scope... + (struct loop): ... from here. + * cfgloopmanip (rpe_enum_p): Cast according to the coding conventions. + * cfgrtl.c (rtl_create_basic_block): Likewise. + (rtl_split_block): Likewise. + (rtl_dump_bb): Likewise. + (cfg_layout_split_block): Likewise. + (init_rtl_bb_info): Use typesafe memory macros. + + * graphds.h (struct graph_edge): Renamed edge to graph_edge. + * graphds.h: Updated all usages of edge to graph_edge. + * graphds.c: Likewise. + * cfgloopanal.c: Likewise. + 2007-06-05 Ian Lance Taylor * tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a @@ -7216,7 +7250,7 @@ * c-common.c (warn_logical_operator): Fix condition. -2007-03-10 Tobias Schlüter +2007-03-10 Tobias Schl�ter * config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Add missing quotation mark. diff --git a/gcc/cfg.c b/gcc/cfg.c index 63d053067fd..cbaf8f658aa 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -83,11 +83,11 @@ void init_flow (void) { if (!cfun->cfg) - cfun->cfg = ggc_alloc_cleared (sizeof (struct control_flow_graph)); + cfun->cfg = GGC_CNEW (struct control_flow_graph); n_edges = 0; - ENTRY_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def)); + ENTRY_BLOCK_PTR = GGC_CNEW (struct basic_block_def); ENTRY_BLOCK_PTR->index = ENTRY_BLOCK; - EXIT_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def)); + EXIT_BLOCK_PTR = GGC_CNEW (struct basic_block_def); EXIT_BLOCK_PTR->index = EXIT_BLOCK; ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR; EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR; @@ -134,7 +134,7 @@ basic_block alloc_block (void) { basic_block bb; - bb = ggc_alloc_cleared (sizeof (*bb)); + bb = GGC_CNEW (struct basic_block_def); return bb; } @@ -264,7 +264,7 @@ edge unchecked_make_edge (basic_block src, basic_block dst, int flags) { edge e; - e = ggc_alloc_cleared (sizeof (*e)); + e = GGC_CNEW (struct edge_def); n_edges++; e->src = src; @@ -542,7 +542,7 @@ dump_flow_info (FILE *file, int flags) for (i = FIRST_PSEUDO_REGISTER; i < max; i++) if (REG_N_REFS (i)) { - enum reg_class class, altclass; + enum reg_class prefclass, altclass; fprintf (file, "\nRegister %d used %d times across %d insns", i, REG_N_REFS (i), REG_LIVE_LENGTH (i)); @@ -563,17 +563,17 @@ dump_flow_info (FILE *file, int flags) && PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD) fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i)); - class = reg_preferred_class (i); + prefclass = reg_preferred_class (i); altclass = reg_alternate_class (i); - if (class != GENERAL_REGS || altclass != ALL_REGS) + if (prefclass != GENERAL_REGS || altclass != ALL_REGS) { - if (altclass == ALL_REGS || class == ALL_REGS) - fprintf (file, "; pref %s", reg_class_names[(int) class]); + if (altclass == ALL_REGS || prefclass == ALL_REGS) + fprintf (file, "; pref %s", reg_class_names[(int) prefclass]); else if (altclass == NO_REGS) - fprintf (file, "; %s or none", reg_class_names[(int) class]); + fprintf (file, "; %s or none", reg_class_names[(int) prefclass]); else fprintf (file, "; pref %s, else %s", - reg_class_names[(int) class], + reg_class_names[(int) prefclass], reg_class_names[(int) altclass]); } @@ -1107,7 +1107,7 @@ copy_original_table_clear (htab_t tab, unsigned obj) if (!slot) return; - elt = *slot; + elt = (struct htab_bb_copy_original_entry *) *slot; htab_clear_slot (tab, slot); pool_free (original_copy_bb_pool, elt); } @@ -1129,7 +1129,8 @@ copy_original_table_set (htab_t tab, unsigned obj, unsigned val) htab_find_slot (tab, &key, INSERT); if (!*slot) { - *slot = pool_alloc (original_copy_bb_pool); + *slot = (struct htab_bb_copy_original_entry *) + pool_alloc (original_copy_bb_pool); (*slot)->index1 = obj; } (*slot)->index2 = val; diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index da1e8552e24..24ec32d76c0 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1262,7 +1262,7 @@ label_rtx_for_bb (basic_block bb) elt = pointer_map_contains (lab_rtx_for_bb, bb); if (elt) - return *elt; + return (rtx) *elt; /* Find the tree label if it is present. */ @@ -1281,7 +1281,7 @@ label_rtx_for_bb (basic_block bb) elt = pointer_map_insert (lab_rtx_for_bb, bb); *elt = gen_label_rtx (); - return *elt; + return (rtx) *elt; } /* A subroutine of expand_gimple_basic_block. Expand one COND_EXPR. @@ -1538,7 +1538,7 @@ expand_gimple_basic_block (basic_block bb) } if (elt) - emit_label (*elt); + emit_label ((rtx) *elt); /* Java emits line number notes in the top of labels. ??? Make this go away once line number notes are obsoleted. */ diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index beb377bd1e4..8852ca91f4f 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -259,7 +259,7 @@ dump_bb (basic_block bb, FILE *outf, int indent) edge_iterator ei; char *s_indent; - s_indent = alloca ((size_t) indent + 1); + s_indent = (char *) alloca ((size_t) indent + 1); memset (s_indent, ' ', (size_t) indent); s_indent[indent] = '\0'; @@ -1043,10 +1043,10 @@ extract_cond_bb_edges (basic_block b, edge *e1, edge *e2) new condition basic block that guards the versioned loop. */ void lv_adjust_loop_header_phi (basic_block first, basic_block second, - basic_block new, edge e) + basic_block new_block, edge e) { if (cfg_hooks->lv_adjust_loop_header_phi) - cfg_hooks->lv_adjust_loop_header_phi (first, second, new, e); + cfg_hooks->lv_adjust_loop_header_phi (first, second, new_block, e); } /* Conditions in trees and RTL are different so we need @@ -1054,8 +1054,8 @@ lv_adjust_loop_header_phi (basic_block first, basic_block second, versioning code. */ void lv_add_condition_to_bb (basic_block first, basic_block second, - basic_block new, void *cond) + basic_block new_block, void *cond) { gcc_assert (cfg_hooks->lv_add_condition_to_bb); - cfg_hooks->lv_add_condition_to_bb (first, second, new, cond); + cfg_hooks->lv_add_condition_to_bb (first, second, new_block, cond); } diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 38e3d7b1e18..3c3654d0459 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -627,7 +627,7 @@ relink_block_chain (bool stay_in_cfglayout_mode) fprintf (dump_file, "Reordered sequence:\n"); for (bb = ENTRY_BLOCK_PTR->next_bb, index = NUM_FIXED_BLOCKS; bb; - bb = bb->aux, index++) + bb = (basic_block) bb->aux, index++) { fprintf (dump_file, " %i ", index); if (get_bb_original (bb)) @@ -645,7 +645,7 @@ relink_block_chain (bool stay_in_cfglayout_mode) /* Now reorder the blocks. */ prev_bb = ENTRY_BLOCK_PTR; bb = ENTRY_BLOCK_PTR->next_bb; - for (; bb; prev_bb = bb, bb = bb->aux) + for (; bb; prev_bb = bb, bb = (basic_block) bb->aux) { bb->prev_bb = prev_bb; prev_bb->next_bb = bb; @@ -693,7 +693,7 @@ fixup_reorder_chain (void) /* First do the bulk reordering -- rechain the blocks without regard to the needed changes to jumps and labels. */ - for (bb = ENTRY_BLOCK_PTR->next_bb; bb; bb = bb->aux) + for (bb = ENTRY_BLOCK_PTR->next_bb; bb; bb = (basic_block) bb->aux) { if (bb->il.rtl->header) { @@ -736,7 +736,7 @@ fixup_reorder_chain (void) /* Now add jumps and labels as needed to match the blocks new outgoing edges. */ - for (bb = ENTRY_BLOCK_PTR->next_bb; bb ; bb = bb->aux) + for (bb = ENTRY_BLOCK_PTR->next_bb; bb ; bb = (basic_block) bb->aux) { edge e_fall, e_taken, e; rtx bb_end_insn; @@ -951,11 +951,11 @@ fixup_fallthru_exit_predecessor (void) } while (c->aux != bb) - c = c->aux; + c = (basic_block) c->aux; c->aux = bb->aux; while (c->aux) - c = c->aux; + c = (basic_block) c->aux; c->aux = bb; bb->aux = NULL; diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 66461d994af..8e1edbddc68 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -776,7 +776,7 @@ flow_bb_inside_loop_p (const struct loop *loop, const basic_block bb) static bool glb_enum_p (basic_block bb, void *glb_loop) { - struct loop *loop = glb_loop; + struct loop *loop = (struct loop *) glb_loop; return (bb != loop->header && dominated_by_p (CDI_DOMINATORS, bb, loop->header)); } @@ -974,8 +974,8 @@ loop_exit_free (void *ex) static struct loop_exit * get_exit_descriptions (edge e) { - return htab_find_with_hash (current_loops->exits, e, - htab_hash_pointer (e)); + return (struct loop_exit *) htab_find_with_hash (current_loops->exits, e, + htab_hash_pointer (e)); } /* Updates the lists of loop exits in that E appears. @@ -1075,14 +1075,14 @@ record_loop_exits (void) static int dump_recorded_exit (void **slot, void *file) { - struct loop_exit *exit = *slot; + struct loop_exit *exit = (struct loop_exit *) *slot; unsigned n = 0; edge e = exit->e; for (; exit != NULL; exit = exit->next_e) n++; - fprintf (file, "Edge %d->%d exits %u loops\n", + fprintf ((FILE*) file, "Edge %d->%d exits %u loops\n", e->src->index, e->dest->index, n); return 1; diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index 59815ccdc82..7b042ebe462 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -90,6 +90,16 @@ DEF_VEC_P (loop_p); DEF_VEC_ALLOC_P (loop_p, heap); DEF_VEC_ALLOC_P (loop_p, gc); +/* An integer estimation of the number of iterations. Estimate_state + describes what is the state of the estimation. */ +enum loop_estimation +{ + /* Estimate was not computed yet. */ + EST_NOT_COMPUTED, + /* Estimate is ready. */ + EST_AVAILABLE +}; + /* Structure to hold information for each natural loop. */ struct loop GTY ((chain_next ("%h.next"))) { @@ -135,13 +145,7 @@ struct loop GTY ((chain_next ("%h.next"))) /* An integer estimation of the number of iterations. Estimate_state describes what is the state of the estimation. */ - enum - { - /* Estimate was not computed yet. */ - EST_NOT_COMPUTED, - /* Estimate is ready. */ - EST_AVAILABLE - } estimate_state; + enum loop_estimation estimate_state; /* An integer guaranteed to bound the number of iterations of the loop from above. */ diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 30c871860f4..53d36d94ffc 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -55,9 +55,9 @@ just_once_each_iteration_p (const struct loop *loop, basic_block bb) same scc. */ static void -check_irred (struct graph *g, struct edge *e) +check_irred (struct graph *g, struct graph_edge *e) { - edge real = e->data; + edge real = (edge) e->data; /* All edges should lead from a component with higher number to the one with lower one. */ diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 4568833065b..92ab088ea40 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -49,7 +49,7 @@ static void unloop (struct loop *, bool *); static bool rpe_enum_p (basic_block bb, void *data) { - return dominated_by_p (CDI_DOMINATORS, bb, data); + return dominated_by_p (CDI_DOMINATORS, bb, (basic_block) data); } /* Remove basic blocks BBS. NBBS is the number of the basic blocks. */ diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 2f6ea7dc965..11deebc2cd9 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -321,7 +321,7 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after) static basic_block rtl_create_basic_block (void *headp, void *endp, basic_block after) { - rtx head = headp, end = endp; + rtx head = (rtx) headp, end = (rtx) endp; basic_block bb; /* Grow the basic block array if needed. */ @@ -474,7 +474,7 @@ static basic_block rtl_split_block (basic_block bb, void *insnp) { basic_block new_bb; - rtx insn = insnp; + rtx insn = (rtx) insnp; edge e; edge_iterator ei; @@ -1519,7 +1519,7 @@ rtl_dump_bb (basic_block bb, FILE *outf, int indent) rtx last; char *s_indent; - s_indent = alloca ((size_t) indent + 1); + s_indent = (char *) alloca ((size_t) indent + 1); memset (s_indent, ' ', (size_t) indent); s_indent[indent] = '\0'; @@ -2300,7 +2300,7 @@ purge_all_dead_edges (void) static basic_block cfg_layout_split_block (basic_block bb, void *insnp) { - rtx insn = insnp; + rtx insn = (rtx) insnp; basic_block new_bb = rtl_split_block (bb, insn); new_bb->il.rtl->footer = bb->il.rtl->footer; @@ -2879,7 +2879,7 @@ void init_rtl_bb_info (basic_block bb) { gcc_assert (!bb->il.rtl); - bb->il.rtl = ggc_alloc_cleared (sizeof (struct rtl_bb_info)); + bb->il.rtl = GGC_CNEW (struct rtl_bb_info); } diff --git a/gcc/graphds.c b/gcc/graphds.c index 1496e09a028..da5a4e52e0b 100644 --- a/gcc/graphds.c +++ b/gcc/graphds.c @@ -34,7 +34,7 @@ void dump_graph (FILE *f, struct graph *g) { int i; - struct edge *e; + struct graph_edge *e; for (i = 0; i < g->n_vertices; i++) { @@ -69,10 +69,10 @@ new_graph (int n_vertices) /* Adds an edge from F to T to graph G. The new edge is returned. */ -struct edge * +struct graph_edge * add_edge (struct graph *g, int f, int t) { - struct edge *e = XNEW (struct edge); + struct graph_edge *e = XNEW (struct graph_edge); struct vertex *vf = &g->vertices[f], *vt = &g->vertices[t]; @@ -95,7 +95,7 @@ identify_vertices (struct graph *g, int v, int u) { struct vertex *vv = &g->vertices[v]; struct vertex *uu = &g->vertices[u]; - struct edge *e, *next; + struct graph_edge *e, *next; for (e = uu->succ; e; e = next) { @@ -122,7 +122,7 @@ identify_vertices (struct graph *g, int v, int u) direction given by FORWARD. */ static inline int -dfs_edge_src (struct edge *e, bool forward) +dfs_edge_src (struct graph_edge *e, bool forward) { return forward ? e->src : e->dest; } @@ -131,7 +131,7 @@ dfs_edge_src (struct edge *e, bool forward) the direction given by FORWARD. */ static inline int -dfs_edge_dest (struct edge *e, bool forward) +dfs_edge_dest (struct graph_edge *e, bool forward) { return forward ? e->dest : e->src; } @@ -139,8 +139,8 @@ dfs_edge_dest (struct edge *e, bool forward) /* Helper function for graphds_dfs. Returns the first edge after E (including E), in the graph direction given by FORWARD, that belongs to SUBGRAPH. */ -static inline struct edge * -foll_in_subgraph (struct edge *e, bool forward, bitmap subgraph) +static inline struct graph_edge * +foll_in_subgraph (struct graph_edge *e, bool forward, bitmap subgraph) { int d; @@ -162,10 +162,10 @@ foll_in_subgraph (struct edge *e, bool forward, bitmap subgraph) /* Helper function for graphds_dfs. Select the first edge from V in G, in the direction given by FORWARD, that belongs to SUBGRAPH. */ -static inline struct edge * +static inline struct graph_edge * dfs_fst_edge (struct graph *g, int v, bool forward, bitmap subgraph) { - struct edge *e; + struct graph_edge *e; e = (forward ? g->vertices[v].succ : g->vertices[v].pred); return foll_in_subgraph (e, forward, subgraph); @@ -174,8 +174,8 @@ dfs_fst_edge (struct graph *g, int v, bool forward, bitmap subgraph) /* Helper function for graphds_dfs. Returns the next edge after E, in the graph direction given by FORWARD, that belongs to SUBGRAPH. */ -static inline struct edge * -dfs_next_edge (struct edge *e, bool forward, bitmap subgraph) +static inline struct graph_edge * +dfs_next_edge (struct graph_edge *e, bool forward, bitmap subgraph) { return foll_in_subgraph (forward ? e->succ_next : e->pred_next, forward, subgraph); @@ -192,8 +192,8 @@ graphds_dfs (struct graph *g, int *qs, int nq, VEC (int, heap) **qt, bool forward, bitmap subgraph) { int i, tick = 0, v, comp = 0, top; - struct edge *e; - struct edge **stack = XNEWVEC (struct edge *, g->n_vertices); + struct graph_edge *e; + struct graph_edge **stack = XNEWVEC (struct graph_edge *, g->n_vertices); bitmap_iterator bi; unsigned av; @@ -314,7 +314,7 @@ graphds_scc (struct graph *g, bitmap subgraph) void for_each_edge (struct graph *g, graphds_edge_callback callback) { - struct edge *e; + struct graph_edge *e; int i; for (i = 0; i < g->n_vertices; i++) @@ -327,7 +327,7 @@ for_each_edge (struct graph *g, graphds_edge_callback callback) void free_graph (struct graph *g) { - struct edge *e, *n; + struct graph_edge *e, *n; struct vertex *v; int i; @@ -406,7 +406,7 @@ graphds_domtree (struct graph *g, int entry, int *marks = XCNEWVEC (int, g->n_vertices); int mark = 1, i, v, idom; bool changed = true; - struct edge *e; + struct graph_edge *e; /* We use a slight modification of the standard iterative algorithm, as described in diff --git a/gcc/graphds.h b/gcc/graphds.h index 2aad4b00a73..23f7fb93784 100644 --- a/gcc/graphds.h +++ b/gcc/graphds.h @@ -21,10 +21,10 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA /* Structure representing edge of a graph. */ -struct edge +struct graph_edge { int src, dest; /* Source and destination. */ - struct edge *pred_next, *succ_next; + struct graph_edge *pred_next, *succ_next; /* Next edge in predecessor and successor lists. */ void *data; /* Data attached to the edge. */ }; @@ -33,7 +33,7 @@ struct edge struct vertex { - struct edge *pred, *succ; + struct graph_edge *pred, *succ; /* Lists of predecessors and successors. */ int component; /* Number of dfs restarts before reaching the vertex. */ @@ -52,12 +52,12 @@ struct graph struct graph *new_graph (int); void dump_graph (FILE *, struct graph *); -struct edge *add_edge (struct graph *, int, int); +struct graph_edge *add_edge (struct graph *, int, int); void identify_vertices (struct graph *, int, int); int graphds_dfs (struct graph *, int *, int, VEC (int, heap) **, bool, bitmap); int graphds_scc (struct graph *, bitmap); void graphds_domtree (struct graph *, int, int *, int *, int *); -typedef void (*graphds_edge_callback) (struct graph *, struct edge *); +typedef void (*graphds_edge_callback) (struct graph *, struct graph_edge *); void for_each_edge (struct graph *, graphds_edge_callback); void free_graph (struct graph *g);