#include "rtl.h"
#include "hard-reg-set.h"
#include "regs.h"
-#include "fibheap.h"
#include "target.h"
#include "expr.h"
#include "flags.h"
#include "df.h"
#include "cfgloop.h"
#include "rtl-iter.h"
+#include "fibonacci_heap.h"
/* Target register optimizations - these are performed after reload. */
bitmap live_range;
} *btr_def;
+typedef fibonacci_heap <long, btr_def_s> btr_heap_t;
+typedef fibonacci_node <long, btr_def_s> 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);
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)
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,
}
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)
{
}
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);
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);
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,
free (btrs_live);
free (btrs_live_at_end);
obstack_free (&migrate_btrl_obstack, NULL);
- fibheap_delete (all_btr_defs);
}
static void