This gives a slight improvement in typesafety in cfgexpand.c gcc/ * cfgexpand.c (lab_rtx_for_bb): Convert from pointer_map_t to pointer_map<rtx>. (label_rtx_for_bb): Update for conversion of lab_rtx_for_bb to a pointer_map<rtx>, eliminating casts from void* to rtx. (expand_gimple_basic_block): Likewise. (pass_expand::execute): Likewise, using new/delete of pointer_map<rtx> rathern than pointer_map_create/destroy. NULLify the lab_rtx_for_bb ptr after deletion for good measure. --- gcc/cfgexpand.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 934f40d..d124d94 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1956,7 +1956,7 @@ maybe_dump_rtl_for_gimple_stmt (gimple stmt, rtx since) /* Maps the blocks that do not contain tree labels to rtx labels. */ -static struct pointer_map_t *lab_rtx_for_bb; +static struct pointer_map<rtx> *lab_rtx_for_bb; /* Returns the label_rtx expression for a label starting basic block BB. */ @@ -1966,14 +1966,14 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) gimple_stmt_iterator gsi; tree lab; gimple lab_stmt; - void **elt; + rtx *elt; if (bb->flags & BB_RTL) return block_label (bb); - elt = pointer_map_contains (lab_rtx_for_bb, bb); + elt = lab_rtx_for_bb->contains (bb); if (elt) - return (rtx) *elt; + return *elt; /* Find the tree label if it is present. */ @@ -1990,9 +1990,9 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) return label_rtx (lab); } - elt = pointer_map_insert (lab_rtx_for_bb, bb); + elt = lab_rtx_for_bb->insert (bb); *elt = gen_label_rtx (); - return (rtx) *elt; + return *elt; } @@ -4880,7 +4880,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) rtx note, last; edge e; edge_iterator ei; - void **elt; + rtx *elt; if (dump_file) fprintf (dump_file, "\n;; Generating RTL for gimple basic block %d\n", @@ -4924,7 +4924,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) stmt = NULL; } - elt = pointer_map_contains (lab_rtx_for_bb, bb); + elt = lab_rtx_for_bb->contains (bb); if (stmt || elt) { @@ -4937,7 +4937,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) } if (elt) - emit_label ((rtx) *elt); + emit_label (*elt); /* Java emits line number notes in the top of labels. ??? Make this go away once line number notes are obsoleted. */ @@ -5797,7 +5797,7 @@ pass_expand::execute (function *fun) FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (fun)->succs) e->flags &= ~EDGE_EXECUTABLE; - lab_rtx_for_bb = pointer_map_create (); + lab_rtx_for_bb = new pointer_map <rtx>; FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (fun), next_bb) bb = expand_gimple_basic_block (bb, var_ret_seq != NULL_RTX); @@ -5822,7 +5822,8 @@ pass_expand::execute (function *fun) /* Expansion is used by optimization passes too, set maybe_hot_insn_p conservatively to true until they are all profile aware. */ - pointer_map_destroy (lab_rtx_for_bb); + delete lab_rtx_for_bb; + lab_rtx_for_bb = NULL; free_histograms (); construct_exit_block (); -- 1.8.5.3