/* Static Single Assignment conversion routines for the GNU compiler.
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GCC.
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "rtl.h"
#include "expr.h"
the same hard register in the same machine mode are in the same
class. */
-/* If conservative_reg_partition is non-zero, use a conservative
+/* If conservative_reg_partition is nonzero, use a conservative
register partitioning algorithm (which leaves more regs after
emerging from SSA) instead of the coalescing one. This is being
left in for a limited time only, as a debugging tool until the
partition reg_partition;
};
-static void ssa_rename_from_initialize
- PARAMS ((void));
-static rtx ssa_rename_from_lookup
- PARAMS ((int reg));
-static unsigned int original_register
- PARAMS ((unsigned int regno));
-static void ssa_rename_from_insert
- PARAMS ((unsigned int reg, rtx r));
-static void ssa_rename_from_free
- PARAMS ((void));
-typedef int (*srf_trav) PARAMS ((int regno, rtx r, sbitmap canonical_elements, partition reg_partition));
-static void ssa_rename_from_traverse
- PARAMS ((htab_trav callback_function, sbitmap canonical_elements, partition reg_partition));
-/*static Avoid warnign message. */ void ssa_rename_from_print
- PARAMS ((void));
-static int ssa_rename_from_print_1
- PARAMS ((void **slot, void *data));
-static hashval_t ssa_rename_from_hash_function
- PARAMS ((const void * srfp));
-static int ssa_rename_from_equal
- PARAMS ((const void *srfp1, const void *srfp2));
-static void ssa_rename_from_delete
- PARAMS ((void *srfp));
-
-static rtx ssa_rename_to_lookup
- PARAMS ((rtx reg));
-static void ssa_rename_to_insert
- PARAMS ((rtx reg, rtx r));
+static rtx gen_sequence (void);
+static void ssa_rename_from_initialize (void);
+static rtx ssa_rename_from_lookup (int reg);
+static unsigned int original_register (unsigned int regno);
+static void ssa_rename_from_insert (unsigned int reg, rtx r);
+static void ssa_rename_from_free (void);
+typedef int (*srf_trav) (int regno, rtx r, sbitmap canonical_elements,
+ partition reg_partition);
+static void ssa_rename_from_traverse (htab_trav callback_function,
+ sbitmap canonical_elements, partition reg_partition);
+/*static Avoid warning message. */ void ssa_rename_from_print (void);
+static int ssa_rename_from_print_1 (void **slot, void *data);
+static hashval_t ssa_rename_from_hash_function (const void * srfp);
+static int ssa_rename_from_equal (const void *srfp1, const void *srfp2);
+static void ssa_rename_from_delete (void *srfp);
+
+static rtx ssa_rename_to_lookup (rtx reg);
+static void ssa_rename_to_insert (rtx reg, rtx r);
/* The number of registers that were live on entry to the SSA routines. */
static unsigned int ssa_max_reg_num;
struct rename_context;
-static inline rtx * phi_alternative
- PARAMS ((rtx, int));
-static void compute_dominance_frontiers_1
- PARAMS ((sbitmap *frontiers, int *idom, int bb, sbitmap done));
-static void find_evaluations_1
- PARAMS ((rtx dest, rtx set, void *data));
-static void find_evaluations
- PARAMS ((sbitmap *evals, int nregs));
-static void compute_iterated_dominance_frontiers
- PARAMS ((sbitmap *idfs, sbitmap *frontiers, sbitmap *evals, int nregs));
-static void insert_phi_node
- PARAMS ((int regno, int b));
-static void insert_phi_nodes
- PARAMS ((sbitmap *idfs, sbitmap *evals, int nregs));
-static void create_delayed_rename
- PARAMS ((struct rename_context *, rtx *));
-static void apply_delayed_renames
- PARAMS ((struct rename_context *));
-static int rename_insn_1
- PARAMS ((rtx *ptr, void *data));
-static void rename_block
- PARAMS ((int b, int *idom));
-static void rename_registers
- PARAMS ((int nregs, int *idom));
-
-static inline int ephi_add_node
- PARAMS ((rtx reg, rtx *nodes, int *n_nodes));
-static int * ephi_forward
- PARAMS ((int t, sbitmap visited, sbitmap *succ, int *tstack));
-static void ephi_backward
- PARAMS ((int t, sbitmap visited, sbitmap *pred, rtx *nodes));
-static void ephi_create
- PARAMS ((int t, sbitmap visited, sbitmap *pred, sbitmap *succ, rtx *nodes));
-static void eliminate_phi
- PARAMS ((edge e, partition reg_partition));
-static int make_regs_equivalent_over_bad_edges
- PARAMS ((int bb, partition reg_partition));
+static inline rtx * phi_alternative (rtx, int);
+static void compute_dominance_frontiers_1 (sbitmap *frontiers,
+ dominance_info idom, int bb,
+ sbitmap done);
+static void find_evaluations_1 (rtx dest, rtx set, void *data);
+static void find_evaluations (sbitmap *evals, int nregs);
+static void compute_iterated_dominance_frontiers (sbitmap *idfs,
+ sbitmap *frontiers,
+ sbitmap *evals, int nregs);
+static void insert_phi_node (int regno, int b);
+static void insert_phi_nodes (sbitmap *idfs, sbitmap *evals, int nregs);
+static void create_delayed_rename (struct rename_context *, rtx *);
+static void apply_delayed_renames (struct rename_context *);
+static int rename_insn_1 (rtx *ptr, void *data);
+static void rename_block (int b, dominance_info dom);
+static void rename_registers (int nregs, dominance_info idom);
+
+static inline int ephi_add_node (rtx reg, rtx *nodes, int *n_nodes);
+static int * ephi_forward (int t, sbitmap visited, sbitmap *succ, int *tstack);
+static void ephi_backward (int t, sbitmap visited, sbitmap *pred, rtx *nodes);
+static void ephi_create (int t, sbitmap visited, sbitmap *pred,
+ sbitmap *succ, rtx *nodes);
+static void eliminate_phi (edge e, partition reg_partition);
+static int make_regs_equivalent_over_bad_edges (int bb,
+ partition reg_partition);
/* These are used only in the conservative register partitioning
algorithms. */
static int make_equivalent_phi_alternatives_equivalent
- PARAMS ((int bb, partition reg_partition));
-static partition compute_conservative_reg_partition
- PARAMS ((void));
-static int record_canonical_element_1
- PARAMS ((void **srfp, void *data));
-static int check_hard_regs_in_partition
- PARAMS ((partition reg_partition));
-static int rename_equivalent_regs_in_insn
- PARAMS ((rtx *ptr, void *data));
+ (int bb, partition reg_partition);
+static partition compute_conservative_reg_partition (void);
+static int record_canonical_element_1 (void **srfp, void *data);
+static int check_hard_regs_in_partition (partition reg_partition);
/* These are used in the register coalescing algorithm. */
-static int coalesce_if_unconflicting
- PARAMS ((partition p, conflict_graph conflicts, int reg1, int reg2));
-static int coalesce_regs_in_copies
- PARAMS ((basic_block bb, partition p, conflict_graph conflicts));
-static int coalesce_reg_in_phi
- PARAMS ((rtx, int dest_regno, int src_regno, void *data));
-static int coalesce_regs_in_successor_phi_nodes
- PARAMS ((basic_block bb, partition p, conflict_graph conflicts));
-static partition compute_coalesced_reg_partition
- PARAMS ((void));
-static int mark_reg_in_phi
- PARAMS ((rtx *ptr, void *data));
-static void mark_phi_and_copy_regs
- PARAMS ((regset phi_set));
-
-static int rename_equivalent_regs_in_insn
- PARAMS ((rtx *ptr, void *data));
-static void rename_equivalent_regs
- PARAMS ((partition reg_partition));
+static int coalesce_if_unconflicting (partition p, conflict_graph conflicts,
+ int reg1, int reg2);
+static int coalesce_regs_in_copies (basic_block bb, partition p,
+ conflict_graph conflicts);
+static int coalesce_reg_in_phi (rtx, int dest_regno, int src_regno,
+ void *data);
+static int coalesce_regs_in_successor_phi_nodes (basic_block bb,
+ partition p,
+ conflict_graph conflicts);
+static partition compute_coalesced_reg_partition (void);
+static int mark_reg_in_phi (rtx *ptr, void *data);
+static void mark_phi_and_copy_regs (regset phi_set);
+
+static int rename_equivalent_regs_in_insn (rtx *ptr, void *data);
+static void rename_equivalent_regs (partition reg_partition);
/* Deal with hard registers. */
-static int conflicting_hard_regs_p
- PARAMS ((int reg1, int reg2));
+static int conflicting_hard_regs_p (int reg1, int reg2);
/* ssa_rename_to maps registers and machine modes to SSA pseudo registers. */
/* Find the register associated with REG in the indicated mode. */
static rtx
-ssa_rename_to_lookup (reg)
- rtx reg;
+ssa_rename_to_lookup (rtx reg)
{
if (!HARD_REGISTER_P (reg))
return ssa_rename_to_pseudo[REGNO (reg) - FIRST_PSEUDO_REGISTER];
/* Store a new value mapping REG to R in ssa_rename_to. */
static void
-ssa_rename_to_insert(reg, r)
- rtx reg;
- rtx r;
+ssa_rename_to_insert (rtx reg, rtx r)
{
if (!HARD_REGISTER_P (reg))
ssa_rename_to_pseudo[REGNO (reg) - FIRST_PSEUDO_REGISTER] = r;
/* Prepare ssa_rename_from for use. */
static void
-ssa_rename_from_initialize ()
+ssa_rename_from_initialize (void)
{
/* We use an arbitrary initial hash table size of 64. */
ssa_rename_from_ht = htab_create (64,
found. */
static rtx
-ssa_rename_from_lookup (reg)
- int reg;
+ssa_rename_from_lookup (int reg)
{
ssa_rename_from_pair srfp;
ssa_rename_from_pair *answer;
srfp.reg = reg;
srfp.original = NULL_RTX;
- answer = (ssa_rename_from_pair *)
- htab_find_with_hash (ssa_rename_from_ht, (void *) &srfp, reg);
+ answer = htab_find_with_hash (ssa_rename_from_ht, (void *) &srfp, reg);
return (answer == 0 ? NULL_RTX : answer->original);
}
Otherwise, return this register number REGNO. */
static unsigned int
-original_register (regno)
- unsigned int regno;
+original_register (unsigned int regno)
{
rtx original_rtx = ssa_rename_from_lookup (regno);
return original_rtx != NULL_RTX ? REGNO (original_rtx) : regno;
/* Add mapping from R to REG to ssa_rename_from even if already present. */
static void
-ssa_rename_from_insert (reg, r)
- unsigned int reg;
- rtx r;
+ssa_rename_from_insert (unsigned int reg, rtx r)
{
void **slot;
ssa_rename_from_pair *srfp = xmalloc (sizeof (ssa_rename_from_pair));
current use of this function. */
static void
-ssa_rename_from_traverse (callback_function,
- canonical_elements, reg_partition)
- htab_trav callback_function;
- sbitmap canonical_elements;
- partition reg_partition;
+ssa_rename_from_traverse (htab_trav callback_function,
+ sbitmap canonical_elements, partition reg_partition)
{
struct ssa_rename_from_hash_table_data srfhd;
srfhd.canonical_elements = canonical_elements;
/* Destroy ssa_rename_from. */
static void
-ssa_rename_from_free ()
+ssa_rename_from_free (void)
{
htab_delete (ssa_rename_from_ht);
}
/* static Avoid erroneous error message. */
void
-ssa_rename_from_print ()
+ssa_rename_from_print (void)
{
printf ("ssa_rename_from's hash table contents:\n");
htab_traverse (ssa_rename_from_ht, &ssa_rename_from_print_1, NULL);
}
/* Print the contents of the hash table entry SLOT, passing the unused
- sttribute DATA. Used as a callback function with htab_traverse (). */
+ attribute DATA. Used as a callback function with htab_traverse (). */
static int
-ssa_rename_from_print_1 (slot, data)
- void **slot;
- void *data ATTRIBUTE_UNUSED;
+ssa_rename_from_print_1 (void **slot, void *data ATTRIBUTE_UNUSED)
{
ssa_rename_from_pair * p = *slot;
printf ("ssa_rename_from maps pseudo %i to original %i.\n",
/* Given a hash entry SRFP, yield a hash value. */
static hashval_t
-ssa_rename_from_hash_function (srfp)
- const void *srfp;
+ssa_rename_from_hash_function (const void *srfp)
{
return ((const ssa_rename_from_pair *) srfp)->reg;
}
/* Test whether two hash table entries SRFP1 and SRFP2 are equal. */
static int
-ssa_rename_from_equal (srfp1, srfp2)
- const void *srfp1;
- const void *srfp2;
+ssa_rename_from_equal (const void *srfp1, const void *srfp2)
{
return ssa_rename_from_hash_function (srfp1) ==
ssa_rename_from_hash_function (srfp2);
/* Delete the hash table entry SRFP. */
static void
-ssa_rename_from_delete (srfp)
- void *srfp;
+ssa_rename_from_delete (void *srfp)
{
free (srfp);
}
for predecessor block C. */
static inline rtx *
-phi_alternative (set, c)
- rtx set;
- int c;
+phi_alternative (rtx set, int c)
{
rtvec phi_vec = XVEC (SET_SRC (set), 0);
int v;
}
/* Given the SET of a phi node, remove the alternative for predecessor
- block C. Return non-zero on success, or zero if no alternative is
+ block C. Return nonzero on success, or zero if no alternative is
found for C. */
int
-remove_phi_alternative (set, block)
- rtx set;
- basic_block block;
+remove_phi_alternative (rtx set, basic_block block)
{
rtvec phi_vec = XVEC (SET_SRC (set), 0);
int num_elem = GET_NUM_ELEM (phi_vec);
static int fe_current_bb;
static void
-find_evaluations_1 (dest, set, data)
- rtx dest;
- rtx set ATTRIBUTE_UNUSED;
- void *data ATTRIBUTE_UNUSED;
+find_evaluations_1 (rtx dest, rtx set ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
{
if (GET_CODE (dest) == REG
&& CONVERT_REGISTER_TO_SSA_P (REGNO (dest)))
}
static void
-find_evaluations (evals, nregs)
- sbitmap *evals;
- int nregs;
+find_evaluations (sbitmap *evals, int nregs)
{
basic_block bb;
/* Computing the Dominance Frontier:
- As decribed in Morgan, section 3.5, this may be done simply by
+ As described in Morgan, section 3.5, this may be done simply by
walking the dominator tree bottom-up, computing the frontier for
the children before the parent. When considering a block B,
there are two cases:
*/
static void
-compute_dominance_frontiers_1 (frontiers, idom, bb, done)
- sbitmap *frontiers;
- int *idom;
- int bb;
- sbitmap done;
+compute_dominance_frontiers_1 (sbitmap *frontiers, dominance_info idom,
+ int bb, sbitmap done)
{
basic_block b = BASIC_BLOCK (bb);
edge e;
dominator tree (blocks dominated by this one) are children in the
CFG, so check all blocks. */
FOR_EACH_BB (c)
- if (idom[c->index] == bb && ! TEST_BIT (done, c->index))
+ if (get_immediate_dominator (idom, c)->index == bb
+ && ! TEST_BIT (done, c->index))
compute_dominance_frontiers_1 (frontiers, idom, c->index, done);
/* Find blocks conforming to rule (1) above. */
{
if (e->dest == EXIT_BLOCK_PTR)
continue;
- if (idom[e->dest->index] != bb)
+ if (get_immediate_dominator (idom, e->dest)->index != bb)
SET_BIT (frontiers[bb], e->dest->index);
}
/* Find blocks conforming to rule (2). */
FOR_EACH_BB (c)
- if (idom[c->index] == bb)
+ if (get_immediate_dominator (idom, c)->index == bb)
{
int x;
EXECUTE_IF_SET_IN_SBITMAP (frontiers[c->index], 0, x,
{
- if (idom[x] != bb)
+ if (get_immediate_dominator (idom, BASIC_BLOCK (x))->index != bb)
SET_BIT (frontiers[bb], x);
});
}
}
void
-compute_dominance_frontiers (frontiers, idom)
- sbitmap *frontiers;
- int *idom;
+compute_dominance_frontiers (sbitmap *frontiers, dominance_info idom)
{
sbitmap done = sbitmap_alloc (last_basic_block);
sbitmap_zero (done);
*/
static void
-compute_iterated_dominance_frontiers (idfs, frontiers, evals, nregs)
- sbitmap *idfs;
- sbitmap *frontiers;
- sbitmap *evals;
- int nregs;
+compute_iterated_dominance_frontiers (sbitmap *idfs, sbitmap *frontiers,
+ sbitmap *evals, int nregs)
{
sbitmap worklist;
int reg, passes = 0;
/* Insert the phi nodes. */
static void
-insert_phi_node (regno, bb)
- int regno, bb;
+insert_phi_node (int regno, int bb)
{
basic_block b = BASIC_BLOCK (bb);
edge e;
}
static void
-insert_phi_nodes (idfs, evals, nregs)
- sbitmap *idfs;
- sbitmap *evals ATTRIBUTE_UNUSED;
- int nregs;
+insert_phi_nodes (sbitmap *idfs, sbitmap *evals ATTRIBUTE_UNUSED, int nregs)
{
int reg;
/* Rename the registers to conform to SSA.
This is essentially the algorithm presented in Figure 7.8 of Morgan,
- with a few changes to reduce pattern search time in favour of a bit
+ with a few changes to reduce pattern search time in favor of a bit
more memory usage. */
/* One of these is created for each set. It will live in a list local
/* Queue the rename of *REG_LOC. */
static void
-create_delayed_rename (c, reg_loc)
- struct rename_context *c;
- rtx *reg_loc;
+create_delayed_rename (struct rename_context *c, rtx *reg_loc)
{
struct rename_set_data *r;
- r = (struct rename_set_data *) xmalloc (sizeof(*r));
+ r = xmalloc (sizeof(*r));
if (GET_CODE (*reg_loc) != REG
|| !CONVERT_REGISTER_TO_SSA_P (REGNO (*reg_loc)))
applying all the renames on NEW_RENAMES. */
static void
-apply_delayed_renames (c)
- struct rename_context *c;
+apply_delayed_renames (struct rename_context *c)
{
struct rename_set_data *r;
struct rename_set_data *last_r = NULL;
Mark pseudos that are set for later update. Transform uses of pseudos. */
static int
-rename_insn_1 (ptr, data)
- rtx *ptr;
- void *data;
+rename_insn_1 (rtx *ptr, void *data)
{
rtx x = *ptr;
struct rename_context *context = data;
}
case REG:
- if (CONVERT_REGISTER_TO_SSA_P (REGNO (x)) &&
- REGNO (x) < ssa_max_reg_num)
+ if (CONVERT_REGISTER_TO_SSA_P (REGNO (x))
+ && REGNO (x) < ssa_max_reg_num)
{
rtx new_reg = ssa_rename_to_lookup (x);
- if (new_reg != NULL_RTX && new_reg != RENAME_NO_RTX)
+ if (new_reg != RENAME_NO_RTX && new_reg != NULL_RTX)
{
if (GET_MODE (x) != GET_MODE (new_reg))
abort ();
*ptr = new_reg;
}
- /* Else this is a use before a set. Warn? */
+ else
+ {
+ /* Undefined value used, rename it to a new pseudo register so
+ that it cannot conflict with an existing register. */
+ *ptr = gen_reg_rtx (GET_MODE (x));
+ }
}
return -1;
}
}
+static rtx
+gen_sequence (void)
+{
+ rtx first_insn = get_insns ();
+ rtx result;
+ rtx tem;
+ int i;
+ int len;
+
+ /* Count the insns in the chain. */
+ len = 0;
+ for (tem = first_insn; tem; tem = NEXT_INSN (tem))
+ len++;
+
+ result = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (len));
+
+ for (i = 0, tem = first_insn; tem; tem = NEXT_INSN (tem), i++)
+ XVECEXP (result, 0, i) = tem;
+
+ return result;
+}
+
static void
-rename_block (bb, idom)
- int bb;
- int *idom;
+rename_block (int bb, dominance_info idom)
{
basic_block b = BASIC_BLOCK (bb);
edge e;
dominator order. */
FOR_EACH_BB (c)
- if (idom[c->index] == bb)
+ if (get_immediate_dominator (idom, c)->index == bb)
rename_block (c->index, idom);
/* Step Four: Update the sets to refer to their new register,
}
static void
-rename_registers (nregs, idom)
- int nregs;
- int *idom;
+rename_registers (int nregs, dominance_info idom)
{
VARRAY_RTX_INIT (ssa_definition, nregs * 3, "ssa_definition");
ssa_rename_from_initialize ();
- ssa_rename_to_pseudo = (rtx *) alloca (nregs * sizeof(rtx));
- memset ((char *) ssa_rename_to_pseudo, 0, nregs * sizeof(rtx));
- memset ((char *) ssa_rename_to_hard, 0,
- FIRST_PSEUDO_REGISTER * NUM_MACHINE_MODES * sizeof (rtx));
+ ssa_rename_to_pseudo = alloca (nregs * sizeof(rtx));
+ memset (ssa_rename_to_pseudo, 0, nregs * sizeof(rtx));
+ memset (ssa_rename_to_hard, 0,
+ FIRST_PSEUDO_REGISTER * NUM_MACHINE_MODES * sizeof (rtx));
rename_block (0, idom);
/* The main entry point for moving to SSA. */
void
-convert_to_ssa ()
+convert_to_ssa (void)
{
/* Element I is the set of blocks that set register I. */
sbitmap *evals;
sbitmap *idfs;
/* Element I is the immediate dominator of block I. */
- int *idom;
+ dominance_info idom;
int nregs;
dead code. We'll let the SSA optimizers do that. */
life_analysis (get_insns (), NULL, 0);
- idom = (int *) alloca (last_basic_block * sizeof (int));
- memset ((void *) idom, -1, (size_t) last_basic_block * sizeof (int));
- calculate_dominance_info (idom, NULL, CDI_DOMINATORS);
+ idom = calculate_dominance_info (CDI_DOMINATORS);
if (rtl_dump_file)
{
fputs (";; Immediate Dominators:\n", rtl_dump_file);
FOR_EACH_BB (bb)
- fprintf (rtl_dump_file, ";\t%3d = %3d\n", bb->index, idom[bb->index]);
+ fprintf (rtl_dump_file, ";\t%3d = %3d\n", bb->index,
+ get_immediate_dominator (idom, bb)->index);
fflush (rtl_dump_file);
}
in_ssa_form = 1;
reg_scan (get_insns (), max_reg_num (), 1);
+ free_dominance_info (idom);
}
/* REG is the representative temporary of its partition. Add it to the
index of this register in the node set. */
static inline int
-ephi_add_node (reg, nodes, n_nodes)
- rtx reg, *nodes;
- int *n_nodes;
+ephi_add_node (rtx reg, rtx *nodes, int *n_nodes)
{
int i;
for (i = *n_nodes - 1; i >= 0; --i)
no other dependencies. */
static int *
-ephi_forward (t, visited, succ, tstack)
- int t;
- sbitmap visited;
- sbitmap *succ;
- int *tstack;
+ephi_forward (int t, sbitmap visited, sbitmap *succ, int *tstack)
{
int s;
a cycle in the graph, copying the data forward as we go. */
static void
-ephi_backward (t, visited, pred, nodes)
- int t;
- sbitmap visited, *pred;
- rtx *nodes;
+ephi_backward (int t, sbitmap visited, sbitmap *pred, rtx *nodes)
{
int p;
and any cycle of which it is a member. */
static void
-ephi_create (t, visited, pred, succ, nodes)
- int t;
- sbitmap visited, *pred, *succ;
- rtx *nodes;
+ephi_create (int t, sbitmap visited, sbitmap *pred, sbitmap *succ, rtx *nodes)
{
rtx reg_u = NULL_RTX;
int unvisited_predecessors = 0;
/* Convert the edge to normal form. */
static void
-eliminate_phi (e, reg_partition)
- edge e;
- partition reg_partition;
+eliminate_phi (edge e, partition reg_partition)
{
int n_nodes;
sbitmap *pred, *succ;
present in Phi(B). There is an edge from FIND(T0)->FIND(T1) for
each T0 = PHI(...,T1,...), where T1 is for the edge from block C. */
- nodes = (rtx *) alloca (n_nodes * sizeof(rtx));
+ nodes = alloca (n_nodes * sizeof(rtx));
pred = sbitmap_vector_alloc (n_nodes, n_nodes);
succ = sbitmap_vector_alloc (n_nodes, n_nodes);
sbitmap_vector_zero (pred, n_nodes);
visited = sbitmap_alloc (n_nodes);
sbitmap_zero (visited);
- tstack = stack = (int *) alloca (n_nodes * sizeof (int));
+ tstack = stack = alloca (n_nodes * sizeof (int));
for (i = 0; i < n_nodes; ++i)
if (! TEST_BIT (visited, i))
ephi_create (i, visited, pred, succ, nodes);
}
- insn = gen_sequence ();
+ insn = get_insns ();
end_sequence ();
insert_insn_on_edge (insn, e);
if (rtl_dump_file)
and C is the ith predecessor of B,
then T0 and Ti must be equivalent.
- Return non-zero iff any such cases were found for which the two
+ Return nonzero iff any such cases were found for which the two
regs were not already in the same class. */
static int
-make_regs_equivalent_over_bad_edges (bb, reg_partition)
- int bb;
- partition reg_partition;
+make_regs_equivalent_over_bad_edges (int bb, partition reg_partition)
{
int changed = 0;
basic_block b = BASIC_BLOCK (bb);
}
/* Consider phi insns in basic block BB pairwise. If the set target
- of both isns are equivalent pseudos, make the corresponding phi
+ of both insns are equivalent pseudos, make the corresponding phi
alternatives in each phi corresponding equivalent.
Return nonzero if any new register classes were unioned. */
static int
-make_equivalent_phi_alternatives_equivalent (bb, reg_partition)
- int bb;
- partition reg_partition;
+make_equivalent_phi_alternatives_equivalent (int bb, partition reg_partition)
{
int changed = 0;
basic_block b = BASIC_BLOCK (bb);
See Morgan 7.3.1. */
static partition
-compute_conservative_reg_partition ()
+compute_conservative_reg_partition (void)
{
basic_block bb;
int changed = 0;
See Morgan figure 11.15. */
static int
-coalesce_if_unconflicting (p, conflicts, reg1, reg2)
- partition p;
- conflict_graph conflicts;
- int reg1;
- int reg2;
+coalesce_if_unconflicting (partition p, conflict_graph conflicts,
+ int reg1, int reg2)
{
int reg;
See Morgan figure 11.14. */
static int
-coalesce_regs_in_copies (bb, p, conflicts)
- basic_block bb;
- partition p;
- conflict_graph conflicts;
+coalesce_regs_in_copies (basic_block bb, partition p, conflict_graph conflicts)
{
int changed = 0;
rtx insn;
/* Callback function for for_each_successor_phi. If the set
destination and the phi alternative regs do not conflict, place
- them in the same paritition class. DATA is a pointer to a
+ them in the same partition class. DATA is a pointer to a
phi_coalesce_context struct. */
static int
-coalesce_reg_in_phi (insn, dest_regno, src_regno, data)
- rtx insn ATTRIBUTE_UNUSED;
- int dest_regno;
- int src_regno;
- void *data;
+coalesce_reg_in_phi (rtx insn ATTRIBUTE_UNUSED, int dest_regno,
+ int src_regno, void *data)
{
struct phi_coalesce_context *context =
(struct phi_coalesce_context *) data;
See Morgan figure 11.14. */
static int
-coalesce_regs_in_successor_phi_nodes (bb, p, conflicts)
- basic_block bb;
- partition p;
- conflict_graph conflicts;
+coalesce_regs_in_successor_phi_nodes (basic_block bb, partition p,
+ conflict_graph conflicts)
{
struct phi_coalesce_context context;
context.p = p;
The caller is responsible for deallocating the returned partition. */
static partition
-compute_coalesced_reg_partition ()
+compute_coalesced_reg_partition (void)
{
basic_block bb;
int changed = 0;
set all regs. Called from for_each_rtx. */
static int
-mark_reg_in_phi (ptr, data)
- rtx *ptr;
- void *data;
+mark_reg_in_phi (rtx *ptr, void *data)
{
rtx expr = *ptr;
regset set = (regset) data;
ssa_definition. */
static void
-mark_phi_and_copy_regs (phi_set)
- regset phi_set;
+mark_phi_and_copy_regs (regset phi_set)
{
unsigned int reg;
partition which specifies equivalences. */
static int
-rename_equivalent_regs_in_insn (ptr, data)
- rtx *ptr;
- void* data;
+rename_equivalent_regs_in_insn (rtx *ptr, void* data)
{
rtx x = *ptr;
partition reg_partition = (partition) data;
as a callback function for traversing ssa_rename_from. */
static int
-record_canonical_element_1 (srfp, data)
- void **srfp;
- void *data;
+record_canonical_element_1 (void **srfp, void *data)
{
unsigned int reg = ((ssa_rename_from_pair *) *srfp)->reg;
sbitmap canonical_elements =
nonzero if this is the case, i.e., the partition is acceptable. */
static int
-check_hard_regs_in_partition (reg_partition)
- partition reg_partition;
+check_hard_regs_in_partition (partition reg_partition)
{
/* CANONICAL_ELEMENTS has a nonzero bit if a class with the given register
number and machine mode has already been seen. This is a
any SEQUENCE insns. */
static void
-rename_equivalent_regs (reg_partition)
- partition reg_partition;
+rename_equivalent_regs (partition reg_partition)
{
basic_block b;
/* The main entry point for moving from SSA. */
void
-convert_from_ssa ()
+convert_from_ssa (void)
{
basic_block b, bb;
partition reg_partition;
count_or_remove_death_notes (NULL, 1);
/* Deallocate the data structures. */
- VARRAY_FREE (ssa_definition);
+ ssa_definition = 0;
ssa_rename_from_free ();
}
destination, the regno of the phi argument corresponding to BB,
and DATA.
- If FN ever returns non-zero, stops immediately and returns this
+ If FN ever returns nonzero, stops immediately and returns this
value. Otherwise, returns zero. */
int
-for_each_successor_phi (bb, fn, data)
- basic_block bb;
- successor_phi_fn fn;
- void *data;
+for_each_successor_phi (basic_block bb, successor_phi_fn fn, void *data)
{
edge e;
different hard registers. */
static int
-conflicting_hard_regs_p (reg1, reg2)
- int reg1;
- int reg2;
+conflicting_hard_regs_p (int reg1, int reg2)
{
int orig_reg1 = original_register (reg1);
int orig_reg2 = original_register (reg2);