From: Martin Liska Date: Tue, 18 Nov 2014 16:17:28 +0000 (+0100) Subject: bt-load is ported to fibonacci_heap. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5bfe5bddeea2fadd6bb8c244a95959b988ccb16;p=gcc.git bt-load is ported to fibonacci_heap. * bt-load.c (add_btr_def): New fibonacci_heap is used. (migrate_btr_defs): Likewise. From-SVN: r217723 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6d2d5f7a72e..60e64a22085 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-11-18 Martin Liska + + * bt-load.c (add_btr_def): New fibonacci_heap is used. + (migrate_btr_defs): Likewise. + 2014-11-18 Martin Liska * tracer.c (tail_duplicate): New fibonacci_heap class is used. diff --git a/gcc/bt-load.c b/gcc/bt-load.c index 66bbf03bd00..3002b62e8e1 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see #include "rtl.h" #include "hard-reg-set.h" #include "regs.h" -#include "fibheap.h" #include "target.h" #include "expr.h" #include "flags.h" @@ -51,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "cfgloop.h" #include "rtl-iter.h" +#include "fibonacci_heap.h" /* Target register optimizations - these are performed after reload. */ @@ -122,23 +122,26 @@ typedef struct btr_def_s bitmap live_range; } *btr_def; +typedef fibonacci_heap btr_heap_t; +typedef fibonacci_node btr_heap_node_t; + static int issue_rate; static int basic_block_freq (const_basic_block); static int insn_sets_btr_p (const rtx_insn *, int, int *); static void find_btr_def_group (btr_def_group *, btr_def); -static btr_def add_btr_def (fibheap_t, basic_block, int, rtx_insn *, +static btr_def add_btr_def (btr_heap_t *, basic_block, int, rtx_insn *, unsigned int, int, btr_def_group *); static btr_user new_btr_user (basic_block, int, rtx_insn *); static void dump_hard_reg_set (HARD_REG_SET); static void dump_btrs_live (int); static void note_other_use_this_block (unsigned int, btr_user); -static void compute_defs_uses_and_gen (fibheap_t, btr_def *,btr_user *, +static void compute_defs_uses_and_gen (btr_heap_t *, btr_def *,btr_user *, sbitmap *, sbitmap *, HARD_REG_SET *); static void compute_kill (sbitmap *, sbitmap *, HARD_REG_SET *); static void compute_out (sbitmap *bb_out, sbitmap *, sbitmap *, int); static void link_btr_uses (btr_def *, btr_user *, sbitmap *, sbitmap *, int); -static void build_btr_def_use_webs (fibheap_t); +static void build_btr_def_use_webs (btr_heap_t *); static int block_at_edge_of_live_range_p (int, btr_def); static void clear_btr_from_live_range (btr_def def); static void add_btr_to_live_range (btr_def, int); @@ -290,7 +293,7 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def) block BB, instruction INSN, and insert it into ALL_BTR_DEFS. Return the new definition. */ static btr_def -add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid, +add_btr_def (btr_heap_t *all_btr_defs, basic_block bb, int insn_luid, rtx_insn *insn, unsigned int dest_reg, int other_btr_uses_before_def, btr_def_group *all_btr_def_groups) @@ -310,7 +313,7 @@ add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid, this_def->live_range = NULL; find_btr_def_group (all_btr_def_groups, this_def); - fibheap_insert (all_btr_defs, -this_def->cost, this_def); + all_btr_defs->insert (-this_def->cost, this_def); if (dump_file) fprintf (dump_file, @@ -436,7 +439,7 @@ note_btr_set (rtx dest, const_rtx set ATTRIBUTE_UNUSED, void *data) } static void -compute_defs_uses_and_gen (fibheap_t all_btr_defs, btr_def *def_array, +compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, btr_user *use_array, sbitmap *btr_defset, sbitmap *bb_gen, HARD_REG_SET *btrs_written) { @@ -767,7 +770,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, } static void -build_btr_def_use_webs (fibheap_t all_btr_defs) +build_btr_def_use_webs (btr_heap_t *all_btr_defs) { const int max_uid = get_max_uid (); btr_def *def_array = XCNEWVEC (btr_def, max_uid); @@ -1393,7 +1396,7 @@ migrate_btr_def (btr_def def, int min_cost) static void migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) { - fibheap_t all_btr_defs = fibheap_new (); + btr_heap_t all_btr_defs (LONG_MIN); int reg; gcc_obstack_init (&migrate_btrl_obstack); @@ -1427,15 +1430,15 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) btrs_live = XCNEWVEC (HARD_REG_SET, last_basic_block_for_fn (cfun)); btrs_live_at_end = XCNEWVEC (HARD_REG_SET, last_basic_block_for_fn (cfun)); - build_btr_def_use_webs (all_btr_defs); + build_btr_def_use_webs (&all_btr_defs); - while (!fibheap_empty (all_btr_defs)) + while (!all_btr_defs.empty ()) { - btr_def def = (btr_def) fibheap_extract_min (all_btr_defs); - int min_cost = -fibheap_min_key (all_btr_defs); + btr_def def = all_btr_defs.extract_min (); + int min_cost = -all_btr_defs.min_key (); if (migrate_btr_def (def, min_cost)) { - fibheap_insert (all_btr_defs, -def->cost, (void *) def); + all_btr_defs.insert (-def->cost, def); if (dump_file) { fprintf (dump_file, @@ -1450,7 +1453,6 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) free (btrs_live); free (btrs_live_at_end); obstack_free (&migrate_btrl_obstack, NULL); - fibheap_delete (all_btr_defs); } static void