From: Trevor Saunders Date: Sun, 28 Aug 2016 00:03:59 +0000 (+0000) Subject: make forced labels a vec X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f7eba349b7f2b140f163b772ba94b383d02d64e;p=gcc.git make forced labels a vec gcc/ChangeLog: 2016-08-27 Trevor Saunders * cfgbuild.c (make_edges): Adjust. * cfgrtl.c (can_delete_label_p): Likewise. * dwarf2cfi.c (create_trace_edges): Likewise. * except.c (sjlj_emit_dispatch_table): Likewise. * function.h (struct expr_status): make x_forced_labels a vector. * jump.c (rebuild_jump_labels_1): Adjust. * reload1.c (set_initial_label_offsets): Likewise. * stmt.c (force_label_rtx): Likewise. (expand_label): Likewise. From-SVN: r239800 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cfb164882e..baff0c613bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2016-08-27 Trevor Saunders + + * cfgbuild.c (make_edges): Adjust. + * cfgrtl.c (can_delete_label_p): Likewise. + * dwarf2cfi.c (create_trace_edges): Likewise. + * except.c (sjlj_emit_dispatch_table): Likewise. + * function.h (struct expr_status): make x_forced_labels a vector. + * jump.c (rebuild_jump_labels_1): Adjust. + * reload1.c (set_initial_label_offsets): Likewise. + * stmt.c (force_label_rtx): Likewise. + (expand_label): Likewise. + 2016-08-27 Trevor Saunders * haifa-sched.c (fix_recovery_deps): Make ready_list a vector. diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index c1ec46ad8d7..edecab52f5d 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -204,7 +204,8 @@ make_edges (basic_block min, basic_block max, int update_p) /* Heavy use of computed goto in machine-generated code can lead to nearly fully-connected CFGs. In that case we spend a significant amount of time searching the edge lists for duplicates. */ - if (forced_labels || cfun->cfg->max_jumptable_ents > 100) + if (!vec_safe_is_empty (forced_labels) + || cfun->cfg->max_jumptable_ents > 100) edge_cache = sbitmap_alloc (last_basic_block_for_fn (cfun)); /* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block @@ -280,8 +281,10 @@ make_edges (basic_block min, basic_block max, int update_p) everything on the forced_labels list. */ else if (computed_jump_p (insn)) { - for (rtx_insn_list *x = forced_labels; x; x = x->next ()) - make_label_edge (edge_cache, bb, x->insn (), EDGE_ABNORMAL); + rtx_insn *insn; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT (forced_labels, i, insn) + make_label_edge (edge_cache, bb, insn, EDGE_ABNORMAL); } /* Returns create an exit out. */ diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 0d335fc6e16..de07fcd4b1d 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -115,7 +115,8 @@ can_delete_label_p (const rtx_code_label *label) return (!LABEL_PRESERVE_P (label) /* User declared labels must be preserved. */ && LABEL_NAME (label) == 0 - && !in_insn_list_p (forced_labels, label)); + && !vec_safe_contains (forced_labels, + const_cast (label))); } /* Delete INSN by patching it out. */ diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index bcf79f5c164..6491d5aaf4c 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -2354,8 +2354,10 @@ create_trace_edges (rtx_insn *insn) } else if (computed_jump_p (insn)) { - for (rtx_insn_list *lab = forced_labels; lab; lab = lab->next ()) - maybe_record_trace_start (lab->insn (), insn); + rtx_insn *temp; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT (forced_labels, i, temp) + maybe_record_trace_start (temp, insn); } else if (returnjump_p (insn)) ; diff --git a/gcc/except.c b/gcc/except.c index 8aeb4e826fc..bc6f30cc920 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -1278,8 +1278,7 @@ sjlj_emit_dispatch_table (rtx_code_label *dispatch_label, int num_dispatch) label on the nonlocal_goto_label list. Since we're modeling these CFG edges more exactly, we can use the forced_labels list instead. */ LABEL_PRESERVE_P (dispatch_label) = 1; - forced_labels - = gen_rtx_INSN_LIST (VOIDmode, dispatch_label, forced_labels); + vec_safe_push (forced_labels, dispatch_label); #endif /* Load up exc_ptr and filter values from the function context. */ diff --git a/gcc/function.h b/gcc/function.h index 501ef684840..590a490af05 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -126,7 +126,7 @@ struct GTY(()) expr_status { rtx x_apply_args_value; /* List of labels that must never be deleted. */ - rtx_insn_list *x_forced_labels; + vec *x_forced_labels; }; typedef struct call_site_record_d *call_site_record; diff --git a/gcc/jump.c b/gcc/jump.c index 5b433af4216..22f8a71b760 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -68,8 +68,6 @@ static int invert_exp_1 (rtx, rtx); static void rebuild_jump_labels_1 (rtx_insn *f, bool count_forced) { - rtx_insn_list *insn; - timevar_push (TV_REBUILD_JUMP); init_label_info (f); mark_all_labels (f); @@ -79,9 +77,13 @@ rebuild_jump_labels_1 (rtx_insn *f, bool count_forced) count doesn't drop to zero. */ if (count_forced) - for (insn = forced_labels; insn; insn = insn->next ()) - if (LABEL_P (insn->insn ())) - LABEL_NUSES (insn->insn ())++; + { + rtx_insn *insn; + unsigned int i; + FOR_EACH_VEC_SAFE_ELT (forced_labels, i, insn) + if (LABEL_P (insn)) + LABEL_NUSES (insn)++; + } timevar_pop (TV_REBUILD_JUMP); } diff --git a/gcc/reload1.c b/gcc/reload1.c index 04cf2125c5b..2a9a562cbbd 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -3888,9 +3888,10 @@ set_initial_label_offsets (void) { memset (offsets_known_at, 0, num_labels); - for (rtx_insn_list *x = forced_labels; x; x = x->next ()) - if (x->insn ()) - set_label_offsets (x->insn (), NULL, 1); + unsigned int i; + rtx_insn *insn; + FOR_EACH_VEC_SAFE_ELT (forced_labels, i, insn) + set_label_offsets (insn, NULL, 1); for (rtx_insn_list *x = nonlocal_goto_handler_labels; x; x = x->next ()) if (x->insn ()) diff --git a/gcc/stmt.c b/gcc/stmt.c index 2e9072f4637..1bae9e9cb6e 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -136,7 +136,7 @@ force_label_rtx (tree label) gcc_assert (function); - forced_labels = gen_rtx_INSN_LIST (VOIDmode, ref, forced_labels); + vec_safe_push (forced_labels, ref); return ref; } @@ -190,7 +190,7 @@ expand_label (tree label) } if (FORCED_LABEL (label)) - forced_labels = gen_rtx_INSN_LIST (VOIDmode, label_r, forced_labels); + vec_safe_push (forced_labels, label_r); if (DECL_NONLOCAL (label) || FORCED_LABEL (label)) maybe_set_first_label_num (label_r);