/* Allocation for dataflow support routines.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
Originally contributed by Michael P. Hayes
(m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
/* This block is called to change the focus from one subset
to another. */
int p;
- bitmap diff = BITMAP_ALLOC (&df_bitmap_obstack);
- bitmap_and_compl (diff, df->blocks_to_analyze, blocks);
+ bitmap_head diff;
+ bitmap_initialize (&diff, &df_bitmap_obstack);
+ bitmap_and_compl (&diff, df->blocks_to_analyze, blocks);
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
bitmap_iterator bi;
unsigned int bb_index;
- EXECUTE_IF_SET_IN_BITMAP (diff, 0, bb_index, bi)
+ EXECUTE_IF_SET_IN_BITMAP (&diff, 0, bb_index, bi)
{
basic_block bb = BASIC_BLOCK (bb_index);
if (bb)
}
}
- BITMAP_FREE (diff);
+ bitmap_clear (&diff);
}
else
{
/* This block of code is executed to change the focus from
the entire function to a subset. */
- bitmap blocks_to_reset = NULL;
+ bitmap_head blocks_to_reset;
+ bool initialized = false;
int p;
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
if (dflow->optional_p && dflow->problem->reset_fun)
{
- if (!blocks_to_reset)
+ if (!initialized)
{
basic_block bb;
- blocks_to_reset =
- BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_initialize (&blocks_to_reset, &df_bitmap_obstack);
FOR_ALL_BB(bb)
{
- bitmap_set_bit (blocks_to_reset, bb->index);
+ bitmap_set_bit (&blocks_to_reset, bb->index);
}
}
- dflow->problem->reset_fun (blocks_to_reset);
+ dflow->problem->reset_fun (&blocks_to_reset);
}
}
- if (blocks_to_reset)
- BITMAP_FREE (blocks_to_reset);
+ if (initialized)
+ bitmap_clear (&blocks_to_reset);
df->blocks_to_analyze = BITMAP_ALLOC (&df_bitmap_obstack);
}
int removed = 0;
#ifdef ENABLE_DF_CHECKING
- enum df_changeable_flags saved_flags;
+ int saved_flags;
#endif
if (!df)
{
timevar_push (dflow->problem->tv_id);
+ /* (Re)Allocate the datastructures necessary to solve the problem. */
+ if (dflow->problem->alloc_fun)
+ dflow->problem->alloc_fun (blocks_to_consider);
+
#ifdef ENABLE_DF_CHECKING
if (dflow->problem->verify_start_fun)
dflow->problem->verify_start_fun ();
#endif
- /* (Re)Allocate the datastructures necessary to solve the problem. */
- if (dflow->problem->alloc_fun)
- dflow->problem->alloc_fun (blocks_to_consider);
-
/* Set up the problem and compute the local information. */
if (dflow->problem->local_compute_fun)
dflow->problem->local_compute_fun (blocks_to_consider);
}
+/* Mark BB as needing it's transfer functions as being out of
+ date, except for LR problem. Used when analyzing DEBUG_INSNs,
+ as LR problem can trigger DCE, and DEBUG_INSNs shouldn't ever
+ shorten or enlarge lifetime of regs. */
+
+void
+df_set_bb_dirty_nonlr (basic_block bb)
+{
+ if (df)
+ {
+ int p;
+ for (p = 1; p < df->num_problems_defined; p++)
+ {
+ struct dataflow *dflow = df->problems_in_order[p];
+ if (dflow == df_lr)
+ continue;
+ if (dflow->out_of_date_transfer_functions)
+ bitmap_set_bit (dflow->out_of_date_transfer_functions, bb->index);
+ dflow->solutions_dirty = true;
+ }
+ }
+}
+
+
/* Clear the dirty bits. This is called from places that delete
blocks. */
static void
basic_block bb;
void **problem_temps;
int size = last_basic_block * sizeof (void *);
- bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head tmp;
problem_temps = XNEWVAR (void *, size);
+ bitmap_initialize (&tmp, &df_bitmap_obstack);
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
dflow problem. */
if (dflow->out_of_date_transfer_functions)
{
- bitmap_copy (tmp, dflow->out_of_date_transfer_functions);
+ bitmap_copy (&tmp, dflow->out_of_date_transfer_functions);
bitmap_clear (dflow->out_of_date_transfer_functions);
- if (bitmap_bit_p (tmp, ENTRY_BLOCK))
+ if (bitmap_bit_p (&tmp, ENTRY_BLOCK))
bitmap_set_bit (dflow->out_of_date_transfer_functions, ENTRY_BLOCK);
- if (bitmap_bit_p (tmp, EXIT_BLOCK))
+ if (bitmap_bit_p (&tmp, EXIT_BLOCK))
bitmap_set_bit (dflow->out_of_date_transfer_functions, EXIT_BLOCK);
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- if (bitmap_bit_p (tmp, bb->index))
+ if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (dflow->out_of_date_transfer_functions, i);
i++;
}
if (df->blocks_to_analyze)
{
- if (bitmap_bit_p (tmp, ENTRY_BLOCK))
+ if (bitmap_bit_p (&tmp, ENTRY_BLOCK))
bitmap_set_bit (df->blocks_to_analyze, ENTRY_BLOCK);
- if (bitmap_bit_p (tmp, EXIT_BLOCK))
+ if (bitmap_bit_p (&tmp, EXIT_BLOCK))
bitmap_set_bit (df->blocks_to_analyze, EXIT_BLOCK);
- bitmap_copy (tmp, df->blocks_to_analyze);
+ bitmap_copy (&tmp, df->blocks_to_analyze);
bitmap_clear (df->blocks_to_analyze);
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- if (bitmap_bit_p (tmp, bb->index))
+ if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (df->blocks_to_analyze, i);
i++;
}
}
- BITMAP_FREE (tmp);
+ bitmap_clear (&tmp);
free (problem_temps);
}
-void
+DEBUG_FUNCTION void
df_insn_debug (rtx insn, bool follow_chain, FILE *file)
{
df_insn_uid_debug (INSN_UID (insn), follow_chain, file);
}
-void
+DEBUG_FUNCTION void
df_insn_debug_regno (rtx insn, FILE *file)
{
struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
fprintf (file, "\n");
}
-void
+DEBUG_FUNCTION void
df_regno_debug (unsigned int regno, FILE *file)
{
fprintf (file, "reg %d defs ", regno);
}
-void
+DEBUG_FUNCTION void
df_ref_debug (df_ref ref, FILE *file)
{
fprintf (file, "%c%d ",
DF_REF_REG_DEF_P (ref) ? 'd' : 'u',
DF_REF_ID (ref));
- fprintf (file, "reg %d bb %d insn %d flag 0x%x type 0x%x ",
+ fprintf (file, "reg %d bb %d insn %d flag %#x type %#x ",
DF_REF_REGNO (ref),
DF_REF_BBNO (ref),
DF_REF_IS_ARTIFICIAL (ref) ? -1 : DF_REF_INSN_UID (ref),
\f
/* Functions for debugging from GDB. */
-void
+DEBUG_FUNCTION void
debug_df_insn (rtx insn)
{
df_insn_debug (insn, true, stderr);
}
-void
+DEBUG_FUNCTION void
debug_df_reg (rtx reg)
{
df_regno_debug (REGNO (reg), stderr);
}
-void
+DEBUG_FUNCTION void
debug_df_regno (unsigned int regno)
{
df_regno_debug (regno, stderr);
}
-void
+DEBUG_FUNCTION void
debug_df_ref (df_ref ref)
{
df_ref_debug (ref, stderr);
}
-void
+DEBUG_FUNCTION void
debug_df_defno (unsigned int defno)
{
df_ref_debug (DF_DEFS_GET (defno), stderr);
}
-void
+DEBUG_FUNCTION void
debug_df_useno (unsigned int defno)
{
df_ref_debug (DF_USES_GET (defno), stderr);
}
-void
+DEBUG_FUNCTION void
debug_df_chain (struct df_link *link)
{
df_chain_dump (link, stderr);