/* Allocation for dataflow support routines.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2008 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)
There are three variations of the live variable problem that are
available whenever dataflow is available. The LR problem finds the
areas that can reach a use of a variable, the UR problems finds the
-areas tha can be reached from a definition of a variable. The LIVE
+areas that can be reached from a definition of a variable. The LIVE
problem finds the intersection of these two areas.
There are several optional problems. These can be enabled when they
section.
In the middle layer, basic blocks are scanned to produce transfer
-functions which describe the effects of that block on the a global
+functions which describe the effects of that block on the global
dataflow solution. The transfer functions are only rebuilt if the
some instruction within the block has changed.
ACCESSING INSNS:
-1) The df insn information is kept in the insns array. This array is
- indexed by insn uid.
-
-2) Each insn has three sets of refs: They are linked into one of three
- lists: the insn's defs list (accessed by the DF_INSN_DEFS or
- DF_INSN_UID_DEFS macros), the insn's uses list (accessed by the
- DF_INSN_USES or DF_INSN_UID_USES macros) or the insn's eq_uses list
- (accessed by the DF_INSN_EQ_USES or DF_INSN_UID_EQ_USES macros).
- The latter list are the list of references in REG_EQUAL or
- REG_EQUIV notes. These macros produce a ref (or NULL), the rest of
- the list can be obtained by traversal of the NEXT_REF field
- (accessed by the DF_REF_NEXT_REF macro.) There is no significance
- to the ordering of the uses or refs in an instruction.
-
-3) Each insn has a logical uid field (LUID). When properly set, this
- is an integer that numbers each insn in the basic block, in order from
- the start of the block. The numbers are only correct after a call to
- df_analyse. They will rot after insns are added deleted or moved
- around.
+1) The df insn information is kept in an array of DF_INSN_INFO objects.
+ The array is indexed by insn uid, and every DF_REF points to the
+ DF_INSN_INFO object of the insn that contains the reference.
+
+2) Each insn has three sets of refs, which are linked into one of three
+ lists: The insn's defs list (accessed by the DF_INSN_INFO_DEFS,
+ DF_INSN_DEFS, or DF_INSN_UID_DEFS macros), the insn's uses list
+ (accessed by the DF_INSN_INFO_USES, DF_INSN_USES, or
+ DF_INSN_UID_USES macros) or the insn's eq_uses list (accessed by the
+ DF_INSN_INFO_EQ_USES, DF_INSN_EQ_USES or DF_INSN_UID_EQ_USES macros).
+ The latter list are the list of references in REG_EQUAL or REG_EQUIV
+ notes. These macros produce a ref (or NULL), the rest of the list
+ can be obtained by traversal of the NEXT_REF field (accessed by the
+ DF_REF_NEXT_REF macro.) There is no significance to the ordering of
+ the uses or refs in an instruction.
+
+3) Each insn has a logical uid field (LUID) which is stored in the
+ DF_INSN_INFO object for the insn. The LUID field is accessed by
+ the DF_INSN_INFO_LUID, DF_INSN_LUID, and DF_INSN_UID_LUID macros.
+ When properly set, the LUID is an integer that numbers each insn in
+ the basic block, in order from the start of the block.
+ The numbers are only correct after a call to df_analyze. They will
+ rot after insns are added deleted or moved round.
ACCESSING REFS:
chains.
4) An array of all of the uses (and an array of all of the defs) can
-
be built. These arrays are indexed by the value in the id
structure. These arrays are only lazily kept up to date, and that
process can be expensive. To have these arrays built, call
A set to a REG inside a ZERO_EXTRACT, or a set to a non-paradoxical SUBREG
for which the number of word_mode units covered by the outer mode is
-smaller than that covered by the inner mode, invokes a read-modify-write.
+smaller than that covered by the inner mode, invokes a read-modify-write
operation. We generate both a use and a def and again mark them
read/write.
}
+/* Write information about registers and basic blocks into FILE. The
+ bitmap is in the form used by df_byte_lr. This is part of making a
+ debugging dump. */
+
+void
+df_print_byte_regset (FILE *file, bitmap r)
+{
+ unsigned int max_reg = max_reg_num ();
+ bitmap_iterator bi;
+
+ if (r == NULL)
+ fputs (" (nil)", file);
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < max_reg; i++)
+ {
+ unsigned int first = df_byte_lr_get_regno_start (i);
+ unsigned int len = df_byte_lr_get_regno_len (i);
+
+ if (len > 1)
+ {
+ bool found = false;
+ unsigned int j;
+
+ EXECUTE_IF_SET_IN_BITMAP (r, first, j, bi)
+ {
+ found = j < first + len;
+ break;
+ }
+ if (found)
+ {
+ const char * sep = "";
+ fprintf (file, " %d", i);
+ if (i < FIRST_PSEUDO_REGISTER)
+ fprintf (file, " [%s]", reg_names[i]);
+ fprintf (file, "(");
+ EXECUTE_IF_SET_IN_BITMAP (r, first, j, bi)
+ {
+ if (j > first + len - 1)
+ break;
+ fprintf (file, "%s%d", sep, j-first);
+ sep = ", ";
+ }
+ fprintf (file, ")");
+ }
+ }
+ else
+ {
+ if (bitmap_bit_p (r, first))
+ {
+ fprintf (file, " %d", i);
+ if (i < FIRST_PSEUDO_REGISTER)
+ fprintf (file, " [%s]", reg_names[i]);
+ }
+ }
+
+ }
+ }
+ fprintf (file, "\n");
+}
+
+
/* Dump dataflow info. */
void
void
df_insn_debug_regno (rtx insn, FILE *file)
{
- unsigned int uid = INSN_UID(insn);
+ struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
fprintf (file, "insn %d bb %d luid %d defs ",
- uid, BLOCK_FOR_INSN (insn)->index, DF_INSN_LUID (insn));
- df_refs_chain_dump (DF_INSN_UID_DEFS (uid), false, file);
+ INSN_UID (insn), BLOCK_FOR_INSN (insn)->index,
+ DF_INSN_INFO_LUID (insn_info));
+ df_refs_chain_dump (DF_INSN_INFO_DEFS (insn_info), false, file);
fprintf (file, " uses ");
- df_refs_chain_dump (DF_INSN_UID_USES (uid), false, file);
+ df_refs_chain_dump (DF_INSN_INFO_USES (insn_info), false, file);
fprintf (file, " eq_uses ");
- df_refs_chain_dump (DF_INSN_UID_EQ_USES (uid), false, file);
+ df_refs_chain_dump (DF_INSN_INFO_EQ_USES (insn_info), false, file);
fprintf (file, "\n");
}
fprintf (file, "reg %d bb %d insn %d flag 0x%x type 0x%x ",
DF_REF_REGNO (ref),
DF_REF_BBNO (ref),
- DF_REF_INSN (ref) ? INSN_UID (DF_REF_INSN (ref)) : -1,
+ DF_REF_INSN_INFO (ref) ? INSN_UID (DF_REF_INSN (ref)) : -1,
DF_REF_FLAGS (ref),
DF_REF_TYPE (ref));
if (DF_REF_LOC (ref))