From: Trevor Saunders <tbsaunde+...@tbsaunde.org> gcc/ChangeLog:
2016-04-20 Trevor Saunders <tbsaunde+...@tbsaunde.org> * builtins.c (expand_builtin): Adjust. * cfgbuild.c (make_edges): Likewise. * cfgrtl.c (delete_insn): Likewise. (cfg_layout_initialize): Likewise. * dwarf2cfi.c (create_trace_edges): Likewise. * emit-rtl.h (struct GTY): Make nonlocal_goto_handler_labels a vector. * recog.c (peep2_attempt): Adjust. * reload1.c (set_initial_label_offsets): Likewise. * sched-rgn.c (is_cfg_nonregular): Likewise. * stmt.c (expand_label): Likewise. --- gcc/builtins.c | 4 +--- gcc/cfgbuild.c | 8 ++++---- gcc/cfgrtl.c | 21 ++++++++++++--------- gcc/dwarf2cfi.c | 10 ++++++---- gcc/emit-rtl.h | 2 +- gcc/recog.c | 2 +- gcc/reload1.c | 7 ++++--- gcc/sched-rgn.c | 2 +- gcc/stmt.c | 4 +--- 9 files changed, 31 insertions(+), 29 deletions(-) diff --git a/gcc/builtins.c b/gcc/builtins.c index 3d89baf..9e6c08d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -6018,9 +6018,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, /* This is copied from the handling of non-local gotos. */ expand_builtin_setjmp_setup (buf_addr, label_r); - nonlocal_goto_handler_labels - = gen_rtx_INSN_LIST (VOIDmode, label_r, - nonlocal_goto_handler_labels); + vec_safe_push (nonlocal_goto_handler_labels, label_r); /* ??? Do not let expand_label treat us as such since we would not want to be both on the list of non-local labels and on the list of forced labels. */ diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index c1ec46a..bffb07b 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -333,10 +333,10 @@ make_edges (basic_block min, basic_block max, int update_p) taken, then only calls to those functions or to other nested functions that use them could possibly do nonlocal gotos. */ - for (rtx_insn_list *x = nonlocal_goto_handler_labels; - x; - x = x->next ()) - make_label_edge (edge_cache, bb, x->insn (), + rtx_insn *insn; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT_REVERSE (nonlocal_goto_handler_labels, i, insn) + make_label_edge (edge_cache, bb, insn, EDGE_ABNORMAL | EDGE_ABNORMAL_CALL); } diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 62b0596..7cfc634 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -157,7 +157,14 @@ delete_insn (rtx uncast_insn) } } - remove_node_from_insn_list (insn, &nonlocal_goto_handler_labels); + + unsigned int len = vec_safe_length (nonlocal_goto_handler_labels); + for (unsigned int i = 0; i < len; i++) + if ((*nonlocal_goto_handler_labels)[i] == insn) + { + nonlocal_goto_handler_labels->ordered_remove (i); + break; + } } if (really_delete) @@ -4236,9 +4243,6 @@ cfg_layout_duplicate_bb (basic_block bb) void cfg_layout_initialize (unsigned int flags) { - rtx_insn_list *x; - basic_block bb; - /* Once bb partitioning is complete, cfg layout mode should not be re-entered. Entering cfg layout mode may require fixups. As an example, if edge forwarding performed when optimizing the cfg @@ -4255,11 +4259,10 @@ cfg_layout_initialize (unsigned int flags) record_effective_endpoints (); /* Make sure that the targets of non local gotos are marked. */ - for (x = nonlocal_goto_handler_labels; x; x = x->next ()) - { - bb = BLOCK_FOR_INSN (x->insn ()); - bb->flags |= BB_NON_LOCAL_GOTO_TARGET; - } + rtx_insn *temp; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT_REVERSE (nonlocal_goto_handler_labels, i, temp) + BLOCK_FOR_INSN (temp)->flags |= BB_NON_LOCAL_GOTO_TARGET; cleanup_cfg (CLEANUP_CFGLAYOUT | flags); } diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index bcf79f5..6180da4 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -2384,10 +2384,12 @@ create_trace_edges (rtx_insn *insn) /* Process non-local goto edges. */ if (can_nonlocal_goto (insn)) - for (rtx_insn_list *lab = nonlocal_goto_handler_labels; - lab; - lab = lab->next ()) - maybe_record_trace_start_abnormal (lab->insn (), insn); + { + rtx_insn *temp; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT_REVERSE (nonlocal_goto_handler_labels, i, temp) + maybe_record_trace_start_abnormal (temp, insn); + } } else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (PATTERN (insn))) { diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index 39dfce9..745e25e 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -90,7 +90,7 @@ struct GTY(()) rtl_data { /* List (chain of INSN_LIST) of labels heading the current handlers for nonlocal gotos. */ - rtx_insn_list *x_nonlocal_goto_handler_labels; + vec<rtx_insn *, va_gc> *x_nonlocal_goto_handler_labels; /* Label that will go on function epilogue. Jumping to this label serves as a "return" instruction diff --git a/gcc/recog.c b/gcc/recog.c index 92b2aa3..587b3e4 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3409,7 +3409,7 @@ peep2_attempt (basic_block bb, rtx_insn *insn, int match_len, rtx_insn *attempt) delete_insn_chain (insn, peep2_insn_data[i].insn, false); /* Re-insert the EH_REGION notes. */ - if (eh_note || (was_call && nonlocal_goto_handler_labels)) + if (eh_note || (was_call && vec_safe_length (nonlocal_goto_handler_labels))) { edge eh_edge; edge_iterator ei; diff --git a/gcc/reload1.c b/gcc/reload1.c index d0084ac..770bf40 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -3877,9 +3877,10 @@ set_initial_label_offsets (void) if (x->insn ()) set_label_offsets (x->insn (), NULL, 1); - for (rtx_insn_list *x = nonlocal_goto_handler_labels; x; x = x->next ()) - if (x->insn ()) - set_label_offsets (x->insn (), NULL, 1); + rtx_insn *insn; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT_REVERSE (nonlocal_goto_handler_labels, i, insn) + set_label_offsets (insn, NULL, 1); for_each_eh_label (set_initial_eh_label_offset); } diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index fa662ff..d4b71a1 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -259,7 +259,7 @@ is_cfg_nonregular (void) /* If we have a label that could be the target of a nonlocal goto, then the cfg is not well structured. */ - if (nonlocal_goto_handler_labels) + if (vec_safe_length (nonlocal_goto_handler_labels)) return 1; /* If we have any forced labels, then the cfg is not well structured. */ diff --git a/gcc/stmt.c b/gcc/stmt.c index 2e9072f..a6612fc 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -184,9 +184,7 @@ expand_label (tree label) if (DECL_NONLOCAL (label)) { expand_builtin_setjmp_receiver (NULL); - nonlocal_goto_handler_labels - = gen_rtx_INSN_LIST (VOIDmode, label_r, - nonlocal_goto_handler_labels); + vec_safe_push<rtx_insn *> (nonlocal_goto_handler_labels, label_r); } if (FORCED_LABEL (label)) -- 2.7.4