* 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.
From-SVN: r125336
+2007-06-05 Thomas Neumann <tneumann@users.sourceforge.net>
+
+ * 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 <iant@google.com>
* tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a
* c-common.c (warn_logical_operator): Fix condition.
-2007-03-10 Tobias Schlüter <tobi@gcc.gnu.org>
+2007-03-10 Tobias Schl�ter <tobi@gcc.gnu.org>
* config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Add missing
quotation mark.
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;
alloc_block (void)
{
basic_block bb;
- bb = ggc_alloc_cleared (sizeof (*bb));
+ bb = GGC_CNEW (struct basic_block_def);
return bb;
}
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;
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));
&& 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]);
}
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);
}
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;
elt = pointer_map_contains (lab_rtx_for_bb, bb);
if (elt)
- return *elt;
+ return (rtx) *elt;
/* Find the tree label if it is present. */
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.
}
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. */
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';
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
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);
}
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))
/* 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;
/* 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)
{
/* 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;
}
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;
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));
}
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.
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;
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")))
{
/* 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. */
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. */
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. */
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. */
rtl_split_block (basic_block bb, void *insnp)
{
basic_block new_bb;
- rtx insn = insnp;
+ rtx insn = (rtx) insnp;
edge e;
edge_iterator ei;
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';
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;
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);
}
dump_graph (FILE *f, struct graph *g)
{
int i;
- struct edge *e;
+ struct graph_edge *e;
for (i = 0; i < g->n_vertices; i++)
{
/* 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];
{
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)
{
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;
}
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;
}
/* 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;
/* 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);
/* 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);
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;
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++)
void
free_graph (struct graph *g)
{
- struct edge *e, *n;
+ struct graph_edge *e, *n;
struct vertex *v;
int i;
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
/* 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. */
};
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. */
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);