This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[new-regalloc] Convert sbitmap's to regset's
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: [new-regalloc] Convert sbitmap's to regset's
- From: Daniel Berlin <dan at www dot cgsoftware dot com>
- Date: Thu, 1 Feb 2001 21:35:53 -0500 (EST)
Note the use of BITMAP_XMALLOC(), because INIT*_REG_SET won't initialize a
regset (bitmap), only a regset_head (bitmap_head).
I didn't feel like creating 65 new variables, just so i could write
precolored = INITIALIZE_REG_SET (precolored_stupid_new_variable)
I also couldn't figure out easily how to initialize one that i could
return from a function.
All attemps failed.
Another note, why are the dump_sbitmap arguments the reversal of the
dump_bitmap ones?
If no one objects, i'll commit this.
If people like, I can make a REG_SET macro that does the right thing to
return a regset pointer, and reverse the arguments so they match for both
bitmaps and sbitmaps.
Index: ChangeLog.RA
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/ChangeLog.RA,v
retrieving revision 1.1.2.7
diff -c -3 -p -r1.1.2.7 ChangeLog.RA
*** ChangeLog.RA 2001/02/01 17:14:22 1.1.2.7
--- ChangeLog.RA 2001/02/02 02:22:51
***************
*** 1,8 ****
2001-02-01 Daniel Berlin <dberlin@redhat.com>
* new-regalloc.c (coalesce): Fixed test for constrainedness.
(top level): Include new-regalloc.h
!
2001-01-31 Daniel Berlin <dberlin@redhat.com>
--- 1,14 ----
2001-02-01 Daniel Berlin <dberlin@redhat.com>
+ * new-regalloc.c: Convert sbitmaps to regsets.
+ (finish_new_regalloc): Delete ig_node's as well.
+ (ig_node_delete): Free memory for ig_node's properly.
+ (find_move_cost): Fix cost calculation.
+
+
* new-regalloc.c (coalesce): Fixed test for constrainedness.
(top level): Include new-regalloc.h
!
2001-01-31 Daniel Berlin <dberlin@redhat.com>
Index: new-regalloc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/new-regalloc.c,v
retrieving revision 1.1.2.8
diff -c -3 -p -r1.1.2.8 new-regalloc.c
*** new-regalloc.c 2001/02/01 17:14:22 1.1.2.8
--- new-regalloc.c 2001/02/02 02:22:52
*************** static int edge_weight PARAMS ((unsigned
*** 177,188 ****
static void add_edge PARAMS ((unsigned int, unsigned int));
static void add_move PARAMS ((unsigned int, rtx));
static int is_reg_candidate PARAMS ((unsigned int));
! static int is_candidate_move PARAMS ((rtx, sbitmap));
! static void make_worklist PARAMS ((sbitmap));
static hset node_moves PARAMS ((unsigned int));
static int move_related PARAMS ((unsigned int));
static int varray_contains PARAMS ((varray_type, unsigned int));
! static sbitmap adjacent PARAMS ((unsigned int));
static int enable_moves_1 PARAMS ((void **, void *));
static void enable_moves PARAMS ((unsigned int));
static void decrement_degree PARAMS ((unsigned int, unsigned int));
--- 177,188 ----
static void add_edge PARAMS ((unsigned int, unsigned int));
static void add_move PARAMS ((unsigned int, rtx));
static int is_reg_candidate PARAMS ((unsigned int));
! static int is_candidate_move PARAMS ((rtx, regset));
! static void make_worklist PARAMS ((regset));
static hset node_moves PARAMS ((unsigned int));
static int move_related PARAMS ((unsigned int));
static int varray_contains PARAMS ((varray_type, unsigned int));
! static regset adjacent PARAMS ((unsigned int));
static int enable_moves_1 PARAMS ((void **, void *));
static void enable_moves PARAMS ((unsigned int));
static void decrement_degree PARAMS ((unsigned int, unsigned int));
*************** void finish_new_regalloc PARAMS ((void))
*** 218,229 ****
typedef struct i_g_node
{
hset moveList;
! sbitmap adjList;
unsigned int alias;
int degree;
} *ig_node;
static ig_node ig_node_new PARAMS ((void));
static void print_ig_node PARAMS ((FILE *, void *));
void debug_ig_node PARAMS ((void *));
--- 218,230 ----
typedef struct i_g_node
{
hset moveList;
! regset adjList;
unsigned int alias;
int degree;
} *ig_node;
static ig_node ig_node_new PARAMS ((void));
+ static void ig_node_delete PARAMS ((ig_node));
static void print_ig_node PARAMS ((FILE *, void *));
void debug_ig_node PARAMS ((void *));
*************** ig_node_new ()
*** 234,246 ****
ig_node retval;
retval = ggc_alloc_cleared (sizeof (struct i_g_node));
! retval->adjList = sbitmap_alloc (max_reg_num ());
! sbitmap_zero (retval->adjList);
retval->moveList = hset_new();
return retval;
}
!
static void
print_ig_node (file, node)
FILE *file;
--- 235,254 ----
ig_node retval;
retval = ggc_alloc_cleared (sizeof (struct i_g_node));
! retval->adjList = BITMAP_XMALLOC();
! CLEAR_REG_SET(retval->adjList);
retval->moveList = hset_new();
return retval;
}
! static void
! ig_node_delete (node)
! ig_node node;
! {
! hset_delete(node->moveList);
! FREE_REG_SET(node->adjList);
! }
!
static void
print_ig_node (file, node)
FILE *file;
*************** debug_integer_hset(set)
*** 460,473 ****
}
/* Precolored nodes */
! static sbitmap precolored;
/* Rest are from paper */
! static sbitmap simplifyWorklist;
! static sbitmap freezeWorklist;
! static sbitmap spillWorklist;
! static sbitmap spilledNodes;
! static sbitmap coalescedNodes;
static hset coalescedMoves;
static hset constrainedMoves;
static hset frozenMoves;
--- 468,481 ----
}
/* Precolored nodes */
! static regset precolored;
/* Rest are from paper */
! static regset simplifyWorklist;
! static regset freezeWorklist;
! static regset spillWorklist;
! static regset spilledNodes;
! static regset coalescedNodes;
static hset coalescedMoves;
static hset constrainedMoves;
static hset frozenMoves;
*************** static double *costs;
*** 480,485 ****
--- 488,495 ----
static ig_node *regInfo;
/* Map registers to colors */
static int *colors;
+ /* What nodes are on the stack (So we don't have to look through the stack continuously */
+ static regset selectNodes;
/* Stack of nodes to color */
static varray_type selectStack;
/* Data flow analyzer structure */
*************** static int debug_new_regalloc = 2;
*** 493,498 ****
--- 503,518 ----
/* Whether to use biased coloring or not */
static int biased_coloring = 0;
+ static int
+ regset_first_set_bit (regs)
+ regset regs;
+ {
+ unsigned int i;
+ EXECUTE_IF_SET_IN_REG_SET (regs, 0, i, return i; );
+ return -1;
+
+ }
+
/* Determine if regno is a candidate for this pass of register
allocation. */
static int
*************** is_reg_candidate (regno)
*** 506,512 ****
static int
is_candidate_move (insn, candidates)
rtx insn;
! sbitmap candidates;
{
rtx set;
--- 526,532 ----
static int
is_candidate_move (insn, candidates)
rtx insn;
! regset candidates;
{
rtx set;
*************** is_candidate_move (insn, candidates)
*** 520,527 ****
if (GET_CODE (SET_SRC (set)) == REG
&& GET_CODE (SET_DEST (set)) == REG
! && TEST_BIT (candidates, REGNO (SET_SRC (set)))
! && TEST_BIT (candidates, REGNO (SET_DEST (set))))
return 1;
return 0;
--- 540,547 ----
if (GET_CODE (SET_SRC (set)) == REG
&& GET_CODE (SET_DEST (set)) == REG
! && REGNO_REG_SET_P (candidates, REGNO (SET_SRC (set)))
! && REGNO_REG_SET_P (candidates, REGNO (SET_DEST (set))))
return 1;
return 0;
*************** edge_weight (v1, v2)
*** 535,543 ****
{
int w1 = 0, w2 = 0;
! if (! TEST_BIT (precolored, v1))
w1 = CLASS_MAX_NREGS (reg_preferred_class (v1), PSEUDO_REGNO_MODE (v1));
! if (! TEST_BIT (precolored, v2))
w2 = CLASS_MAX_NREGS (reg_preferred_class (v2), PSEUDO_REGNO_MODE (v2));
switch (w1 + w2)
--- 555,563 ----
{
int w1 = 0, w2 = 0;
! if (! REGNO_REG_SET_P (precolored, v1))
w1 = CLASS_MAX_NREGS (reg_preferred_class (v1), PSEUDO_REGNO_MODE (v1));
! if (! REGNO_REG_SET_P (precolored, v2))
w2 = CLASS_MAX_NREGS (reg_preferred_class (v2), PSEUDO_REGNO_MODE (v2));
switch (w1 + w2)
*************** add_edge (v1, v2)
*** 562,581 ****
unsigned int v1;
unsigned int v2;
{
! if (v1 != v2 && ! TEST_BIT (regInfo[v1]->adjList, v2))
{
/* Precolored nodes that interfere with each other are irrelevant,
we don't color them anyway (since they are precolored). */
! if (! TEST_BIT (precolored, v1))
{
/* Add v2 to v1's adjacency list. */
! SET_BIT (regInfo[v1]->adjList, v2);
regInfo[v1]->degree += edge_weight(v1, v2);
}
! if (! TEST_BIT (precolored, v2))
{
/* Add v1 to v2's adjacency list. */
! SET_BIT (regInfo[v2]->adjList, v1);
regInfo[v2]->degree += edge_weight (v2, v1);
}
}
--- 582,601 ----
unsigned int v1;
unsigned int v2;
{
! if (v1 != v2 && ! REGNO_REG_SET_P (regInfo[v1]->adjList, v2))
{
/* Precolored nodes that interfere with each other are irrelevant,
we don't color them anyway (since they are precolored). */
! if (! REGNO_REG_SET_P (precolored, v1))
{
/* Add v2 to v1's adjacency list. */
! SET_REGNO_REG_SET (regInfo[v1]->adjList, v2);
regInfo[v1]->degree += edge_weight(v1, v2);
}
! if (! REGNO_REG_SET_P (precolored, v2))
{
/* Add v1 to v2's adjacency list. */
! SET_REGNO_REG_SET (regInfo[v2]->adjList, v1);
regInfo[v2]->degree += edge_weight (v2, v1);
}
}
*************** reg_freedom (regNum)
*** 658,694 ****
/* Make the worklists from the inital set of candidates. */
static void
make_worklist(set)
! sbitmap set;
{
unsigned int entry;
! EXECUTE_IF_SET_IN_SBITMAP (set, 0, entry,
{
unsigned int regNum = entry;
/* Remove it from the initial set */
! RESET_BIT(set, entry);
/* If it's of significant degree, place it on the spillWorklist. */
if (regInfo[regNum]->degree >= reg_freedom(regNum))
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting %d onto spillWorklist\n", regNum);
! SET_BIT(spillWorklist, regNum);
}
/* If it's move related, put it on the freeze worklist. */
else if (move_related(regNum))
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting %d onto freezeWorklist\n", regNum);
! SET_BIT(freezeWorklist, regNum);
}
/* Otherwise, put it on the simplify worklist. */
else
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting %d onto simplifyWorklist\n", regNum);
! SET_BIT(simplifyWorklist, regNum);
}
});
}
--- 678,714 ----
/* Make the worklists from the inital set of candidates. */
static void
make_worklist(set)
! regset set;
{
unsigned int entry;
! EXECUTE_IF_SET_IN_REG_SET (set, 0, entry,
{
unsigned int regNum = entry;
/* Remove it from the initial set */
! CLEAR_REGNO_REG_SET(set, entry);
/* If it's of significant degree, place it on the spillWorklist. */
if (regInfo[regNum]->degree >= reg_freedom(regNum))
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting %d onto spillWorklist\n", regNum);
! SET_REGNO_REG_SET(spillWorklist, regNum);
}
/* If it's move related, put it on the freeze worklist. */
else if (move_related(regNum))
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting %d onto freezeWorklist\n", regNum);
! SET_REGNO_REG_SET(freezeWorklist, regNum);
}
/* Otherwise, put it on the simplify worklist. */
else
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting %d onto simplifyWorklist\n", regNum);
! SET_REGNO_REG_SET(simplifyWorklist, regNum);
}
});
}
*************** varray_contains (array, regNum)
*** 708,728 ****
}
/* adjacent(n) = adjList[n] - (selectStack U coalescedMoves) */
! static sbitmap
adjacent(regNum)
unsigned int regNum;
{
! sbitmap result;
unsigned int entry;
!
! result = sbitmap_alloc (max_reg_num ());
! sbitmap_zero (result);
! sbitmap_a_or_b (result, result, regInfo[regNum]->adjList);
! sbitmap_difference (result, result, coalescedNodes);
! EXECUTE_IF_SET_IN_SBITMAP (result, 0, entry,
{
! if (varray_contains (selectStack, entry))
! RESET_BIT (result, entry);
});
return result;
--- 728,750 ----
}
/* adjacent(n) = adjList[n] - (selectStack U coalescedMoves) */
! static regset
adjacent(regNum)
unsigned int regNum;
{
! regset result;
unsigned int entry;
!
! result = BITMAP_XMALLOC();
!
! CLEAR_REG_SET(result);
! COPY_REG_SET (result, regInfo[regNum]->adjList);
! AND_COMPL_REG_SET( result, coalescedNodes);
! EXECUTE_IF_SET_IN_REG_SET (result, 0, entry,
{
!
! if (REGNO_REG_SET_P (selectNodes, entry))
! CLEAR_REGNO_REG_SET (result, entry);
});
return result;
*************** decrement_degree(regNum, from)
*** 765,771 ****
{
int w = edge_weight (regNum, from);
int d = regInfo[regNum]->degree;
! sbitmap adj;
unsigned int entry;
/* If it was of significant degree before, and isn't now, we need to
--- 787,793 ----
{
int w = edge_weight (regNum, from);
int d = regInfo[regNum]->degree;
! regset adj;
unsigned int entry;
/* If it was of significant degree before, and isn't now, we need to
*************** decrement_degree(regNum, from)
*** 778,793 ****
/* Make all moves involving variable ready for coalescing. */
enable_moves (regNum);
adj = adjacent (regNum);
! EXECUTE_IF_SET_IN_SBITMAP (adj, 0, entry, { enable_moves (entry); });
! sbitmap_free (adj);
/* This variable is now low-degree... treat it that way. */
! RESET_BIT (spillWorklist, regNum);
if (move_related (regNum))
! SET_BIT (freezeWorklist, regNum);
else
! SET_BIT (simplifyWorklist, regNum);
}
}
--- 800,815 ----
/* Make all moves involving variable ready for coalescing. */
enable_moves (regNum);
adj = adjacent (regNum);
! EXECUTE_IF_SET_IN_REG_SET (adj, 0, entry, { enable_moves (entry); });
! FREE_REG_SET (adj);
/* This variable is now low-degree... treat it that way. */
! CLEAR_REGNO_REG_SET (spillWorklist, regNum);
if (move_related (regNum))
! SET_REGNO_REG_SET (freezeWorklist, regNum);
else
! SET_REGNO_REG_SET (simplifyWorklist, regNum);
}
}
*************** simplify ()
*** 797,832 ****
{
unsigned int currReg;
unsigned int entry;
! sbitmap adj;
/* Pick the first thing on the worklist. */
! currReg = sbitmap_first_set_bit (simplifyWorklist);
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "picked reg %d in simplify\n", currReg);
/* Remove it. */
! RESET_BIT(simplifyWorklist, currReg);
/* Push it onto the selectStack to be colored. */
VARRAY_PUSH_UINT(selectStack, currReg);
!
adj = adjacent (currReg);
/* From new register allocator paper. */
/* ??? My that's a descriptive comment. */
if (regInfo[currReg]->degree > reg_freedom (currReg))
! EXECUTE_IF_SET_IN_SBITMAP (adj, 0, entry, { enable_moves (entry); });
/* Now that we've removed it, everything adjacent to it gets
decremented in degree. */
! EXECUTE_IF_SET_IN_SBITMAP (adj, 0, entry,
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Decrementing degree of %d\n", entry);
decrement_degree(entry, currReg);
});
! sbitmap_free (adj);
}
/* If regNum was coalesced, find out where it went, recursively if
--- 819,854 ----
{
unsigned int currReg;
unsigned int entry;
! regset adj;
/* Pick the first thing on the worklist. */
! currReg = regset_first_set_bit (simplifyWorklist);
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "picked reg %d in simplify\n", currReg);
/* Remove it. */
! CLEAR_REGNO_REG_SET(simplifyWorklist, currReg);
/* Push it onto the selectStack to be colored. */
VARRAY_PUSH_UINT(selectStack, currReg);
! SET_REGNO_REG_SET (selectNodes, currReg);
adj = adjacent (currReg);
/* From new register allocator paper. */
/* ??? My that's a descriptive comment. */
if (regInfo[currReg]->degree > reg_freedom (currReg))
! EXECUTE_IF_SET_IN_REG_SET (adj, 0, entry, { enable_moves (entry); });
/* Now that we've removed it, everything adjacent to it gets
decremented in degree. */
! EXECUTE_IF_SET_IN_REG_SET (adj, 0, entry,
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Decrementing degree of %d\n", entry);
decrement_degree(entry, currReg);
});
! FREE_REG_SET (adj);
}
/* If regNum was coalesced, find out where it went, recursively if
*************** get_alias (regNum)
*** 837,843 ****
{
unsigned int result;
! if (TEST_BIT (coalescedNodes, regNum))
result = get_alias (regInfo[regNum]->alias);
else
result = regNum;
--- 859,865 ----
{
unsigned int result;
! if (REGNO_REG_SET_P (coalescedNodes, regNum))
result = get_alias (regInfo[regNum]->alias);
else
result = regNum;
*************** float find_move_cost(move)
*** 860,866 ****
else
rhs = reg_preferred_class (REGNO (SET_SRC (body)));
! return BLOCK_FOR_INSN(move)->loop_depth * REGISTER_MOVE_COST (GET_MODE (SET_SRC (body)), rhs, lhs);
}
/* Find the move with the maximum cost */
--- 882,888 ----
else
rhs = reg_preferred_class (REGNO (SET_SRC (body)));
! return ( BLOCK_FOR_INSN(move)->loop_depth + 1) * REGISTER_MOVE_COST (GET_MODE (SET_SRC (body)), rhs, lhs);
}
/* Find the move with the maximum cost */
*************** add_worklist (regNum)
*** 904,911 ****
if (! move_related (regNum)
&& regInfo[regNum]->degree < reg_freedom (regNum))
{
! RESET_BIT (freezeWorklist, regNum);
! SET_BIT (simplifyWorklist, regNum);
}
}
--- 926,933 ----
if (! move_related (regNum)
&& regInfo[regNum]->degree < reg_freedom (regNum))
{
! CLEAR_REGNO_REG_SET (freezeWorklist, regNum);
! SET_REGNO_REG_SET (simplifyWorklist, regNum);
}
}
*************** precolored_OK (f, r)
*** 915,933 ****
unsigned int f;
unsigned int r;
{
! sbitmap adjacentSet = regInfo[f]->adjList;
unsigned int entry;
if (TEST_HARD_REG_BIT (fixed_reg_set, f) || TEST_HARD_REG_BIT (fixed_reg_set, r))
return 0;
! EXECUTE_IF_SET_IN_SBITMAP (adjacentSet, 0, entry,
{
! if (! varray_contains (selectStack, entry) &&
! ! TEST_BIT (coalescedNodes, entry) &&
!( (regInfo[entry]->degree < reg_freedom(entry)) ||
! TEST_BIT (precolored, entry) ||
! TEST_BIT (regInfo[entry]->adjList, f)))
return 0;
});
--- 937,955 ----
unsigned int f;
unsigned int r;
{
! regset adjacentSet = regInfo[f]->adjList;
unsigned int entry;
if (TEST_HARD_REG_BIT (fixed_reg_set, f) || TEST_HARD_REG_BIT (fixed_reg_set, r))
return 0;
! EXECUTE_IF_SET_IN_REG_SET (adjacentSet, 0, entry,
{
! if (! REGNO_REG_SET_P (selectNodes, entry) &&
! ! REGNO_REG_SET_P (coalescedNodes, entry) &&
!( (regInfo[entry]->degree < reg_freedom(entry)) ||
! REGNO_REG_SET_P (precolored, entry) ||
! REGNO_REG_SET_P (regInfo[entry]->adjList, f)))
return 0;
});
*************** conservative(rhs, lhs)
*** 947,953 ****
unsigned int entry;
enum machine_mode lhsmode, rhsmode;
int result;
! sbitmap visited;
/* XXX: If they aren't the same mode, they can't possibly be
combined, right? */
--- 969,975 ----
unsigned int entry;
enum machine_mode lhsmode, rhsmode;
int result;
! regset visited;
/* XXX: If they aren't the same mode, they can't possibly be
combined, right? */
*************** conservative(rhs, lhs)
*** 970,986 ****
combine the classes when we coalesce. */
/* Cache visited entries so we don't waste a ton of time. */
! visited = sbitmap_alloc (max_reg_num ());
! sbitmap_zero(visited);
result = 0;
/* We don't figure out the full set of neighbors beforehand, as it's
much slower than prescreening. */
! EXECUTE_IF_SET_IN_SBITMAP (regInfo[lhs]->adjList, 0, entry,
{
! if (! TEST_BIT (visited, entry))
{
! SET_BIT (visited, entry);
if (regInfo[entry]->degree >= reg_freedom (entry))
{
k += edge_weight (lhs, entry);
--- 992,1008 ----
combine the classes when we coalesce. */
/* Cache visited entries so we don't waste a ton of time. */
! visited = BITMAP_XMALLOC();
! CLEAR_REG_SET(visited);
result = 0;
/* We don't figure out the full set of neighbors beforehand, as it's
much slower than prescreening. */
! EXECUTE_IF_SET_IN_REG_SET (regInfo[lhs]->adjList, 0, entry,
{
! if (! REGNO_REG_SET_P (visited, entry))
{
! SET_REGNO_REG_SET (visited, entry);
if (regInfo[entry]->degree >= reg_freedom (entry))
{
k += edge_weight (lhs, entry);
*************** conservative(rhs, lhs)
*** 990,1000 ****
}
});
! EXECUTE_IF_SET_IN_SBITMAP (regInfo[rhs]->adjList, 0, entry,
{
! if (! TEST_BIT (visited, entry))
{
! SET_BIT (visited, entry);
if (regInfo[entry]->degree >= reg_freedom (entry))
{
k += edge_weight (rhs, entry);
--- 1012,1022 ----
}
});
! EXECUTE_IF_SET_IN_REG_SET (regInfo[rhs]->adjList, 0, entry,
{
! if (! REGNO_REG_SET_P (visited, entry))
{
! SET_REGNO_REG_SET (visited, entry);
if (regInfo[entry]->degree >= reg_freedom (entry))
{
k += edge_weight (rhs, entry);
*************** conservative(rhs, lhs)
*** 1006,1012 ****
result = 1;
fail:
! sbitmap_free (visited);
return result;
}
--- 1028,1034 ----
result = 1;
fail:
! FREE_REG_SET (visited);
return result;
}
*************** combine (u, v)
*** 1018,1037 ****
unsigned int u;
unsigned int v;
{
! sbitmap adj;
unsigned int entry;
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "Coalescing %d and %d\n", u, v);
/* Remove v from the worklists, and make it a coalesced node. */
! if (TEST_BIT (freezeWorklist, v))
! RESET_BIT (freezeWorklist, v);
else
! RESET_BIT (spillWorklist, v);
/* Throw it on the coalesced node list. */
! SET_BIT (coalescedNodes, v);
/* Set up the alias. */
regInfo[v]->alias = u;
--- 1040,1059 ----
unsigned int u;
unsigned int v;
{
! regset adj;
unsigned int entry;
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "Coalescing %d and %d\n", u, v);
/* Remove v from the worklists, and make it a coalesced node. */
! if (REGNO_REG_SET_P (freezeWorklist, v))
! CLEAR_REGNO_REG_SET (freezeWorklist, v);
else
! CLEAR_REGNO_REG_SET (spillWorklist, v);
/* Throw it on the coalesced node list. */
! SET_REGNO_REG_SET (coalescedNodes, v);
/* Set up the alias. */
regInfo[v]->alias = u;
*************** combine (u, v)
*** 1041,1058 ****
/* Add our new neighbors, decrement the degree of the old ones. */
adj = adjacent (v);
! EXECUTE_IF_SET_IN_SBITMAP (adj, 0, entry,
{
add_edge (entry, u);
decrement_degree (entry, v);
});
! sbitmap_free (adj);
/* The new node might be of significant degree now. */
! if (regInfo[u]->degree >= reg_freedom (u) && TEST_BIT (freezeWorklist, u))
{
! RESET_BIT (freezeWorklist, u);
! SET_BIT (spillWorklist, u);
}
}
--- 1063,1080 ----
/* Add our new neighbors, decrement the degree of the old ones. */
adj = adjacent (v);
! EXECUTE_IF_SET_IN_REG_SET (adj, 0, entry,
{
add_edge (entry, u);
decrement_degree (entry, v);
});
! FREE_REG_SET (adj);
/* The new node might be of significant degree now. */
! if (regInfo[u]->degree >= reg_freedom (u) && REGNO_REG_SET_P (freezeWorklist, u))
{
! CLEAR_REGNO_REG_SET (freezeWorklist, u);
! SET_REGNO_REG_SET (spillWorklist, u);
}
}
*************** coalesce ()
*** 1067,1073 ****
unsigned int rhs = get_alias (REGNO (SET_SRC (PATTERN (as))));
/* If the right hand side is precolored, swap the sides. */
! if (TEST_BIT (precolored, rhs))
{
unsigned int temp;
temp = lhs;
--- 1089,1095 ----
unsigned int rhs = get_alias (REGNO (SET_SRC (PATTERN (as))));
/* If the right hand side is precolored, swap the sides. */
! if (REGNO_REG_SET_P (precolored, rhs))
{
unsigned int temp;
temp = lhs;
*************** coalesce ()
*** 1086,1093 ****
else
{
/* It's constrained if it's precolored, or they interefere. */
! if (TEST_BIT (precolored, rhs)
! || TEST_BIT (regInfo[rhs]->adjList, lhs))
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Move from %d to %d is constrained\n", lhs, rhs);
--- 1108,1115 ----
else
{
/* It's constrained if it's precolored, or they interefere. */
! if (REGNO_REG_SET_P (precolored, rhs)
! || REGNO_REG_SET_P (regInfo[rhs]->adjList, lhs))
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Move from %d to %d is constrained\n", lhs, rhs);
*************** coalesce ()
*** 1102,1109 ****
{
/* We are going to compute the adjacent sets on the fly, so
we don't do it here. */
! if ((conservative (lhs, rhs) && ! TEST_BIT (precolored, lhs))
! || (TEST_BIT (precolored, lhs) && precolored_OK (rhs, lhs)))
{
/* Coalesce lhs and rhs conservatively. */
hset_insert (coalescedMoves, as);
--- 1124,1131 ----
{
/* We are going to compute the adjacent sets on the fly, so
we don't do it here. */
! if ((conservative (lhs, rhs) && ! REGNO_REG_SET_P (precolored, lhs))
! || (REGNO_REG_SET_P (precolored, lhs) && precolored_OK (rhs, lhs)))
{
/* Coalesce lhs and rhs conservatively. */
hset_insert (coalescedMoves, as);
*************** freeze_moves (regNum)
*** 1148,1155 ****
if (hset_empty (nodemoves)
&& regInfo[v]->degree < reg_freedom (v))
{
! RESET_BIT (freezeWorklist, v);
! SET_BIT (simplifyWorklist, v);
}
hset_delete (nodemoves);
--- 1170,1177 ----
if (hset_empty (nodemoves)
&& regInfo[v]->degree < reg_freedom (v))
{
! CLEAR_REGNO_REG_SET (freezeWorklist, v);
! SET_REGNO_REG_SET (simplifyWorklist, v);
}
hset_delete (nodemoves);
*************** static void
*** 1165,1175 ****
freeze ()
{
/* Pick a random element from the freeze worklist. */
! unsigned int regNum = sbitmap_first_set_bit (freezeWorklist);
/* And freeze it's moves. */
! RESET_BIT (freezeWorklist, regNum);
! SET_BIT (simplifyWorklist, regNum);
freeze_moves (regNum);
}
--- 1187,1197 ----
freeze ()
{
/* Pick a random element from the freeze worklist. */
! unsigned int regNum = regset_first_set_bit (freezeWorklist);
/* And freeze it's moves. */
! CLEAR_REGNO_REG_SET (freezeWorklist, regNum);
! SET_REGNO_REG_SET (simplifyWorklist, regNum);
freeze_moves (regNum);
}
*************** select_spill()
*** 1195,1201 ****
unsigned int minNode = 0;
unsigned int entry;
! EXECUTE_IF_SET_IN_SBITMAP (spillWorklist, 0, entry,
{
float h = (*spill_heuristic) (entry);
if (h < minCost)
--- 1217,1223 ----
unsigned int minNode = 0;
unsigned int entry;
! EXECUTE_IF_SET_IN_REG_SET (spillWorklist, 0, entry,
{
float h = (*spill_heuristic) (entry);
if (h < minCost)
*************** select_spill()
*** 1208,1215 ****
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "almost-spilling node %d\n", minNode);
! RESET_BIT (spillWorklist, minNode);
! SET_BIT (simplifyWorklist, minNode);
freeze_moves (minNode);
}
--- 1230,1237 ----
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "almost-spilling node %d\n", minNode);
! CLEAR_REGNO_REG_SET (spillWorklist, minNode);
! SET_REGNO_REG_SET (simplifyWorklist, minNode);
freeze_moves (minNode);
}
*************** assign_regs()
*** 1314,1320 ****
{
int firstOKBit = -1;
unsigned int entry;
! sbitmap coloredNodes = sbitmap_alloc (max_reg_num ());
HARD_REG_SET *excluded = xcalloc (max_reg_num (), sizeof (HARD_REG_SET));
if (biased_coloring)
--- 1336,1343 ----
{
int firstOKBit = -1;
unsigned int entry;
!
! regset coloredNodes = BITMAP_XMALLOC();
HARD_REG_SET *excluded = xcalloc (max_reg_num (), sizeof (HARD_REG_SET));
if (biased_coloring)
*************** assign_regs()
*** 1329,1335 ****
HARD_REG_SET avoid;
VARRAY_POP(selectStack);
!
pref_class = reg_preferred_class (currReg);
alt_class = reg_alternate_class (currReg);
COPY_HARD_REG_SET (okColors, reg_class_contents[pref_class]);
--- 1352,1358 ----
HARD_REG_SET avoid;
VARRAY_POP(selectStack);
! CLEAR_REGNO_REG_SET (selectNodes, currReg);
pref_class = reg_preferred_class (currReg);
alt_class = reg_alternate_class (currReg);
COPY_HARD_REG_SET (okColors, reg_class_contents[pref_class]);
*************** assign_regs()
*** 1337,1357 ****
AND_COMPL_HARD_REG_SET (okColors, fixed_reg_set);
! EXECUTE_IF_SET_IN_SBITMAP (regInfo[currReg]->adjList, 0, entry,
! {
! unsigned int w = get_alias(entry);
! if (TEST_BIT (coloredNodes, w) || TEST_BIT (precolored, w))
! {
! int index = colors[w];
! if (index >= 0)
! {
! /* If one is a superset of the other, this should already
! handle it, because we'll still clear the right bits. */
! CLEAR_HARD_REG_BIT (okColors, index);
! AND_COMPL_HARD_REG_SET (okColors, excluded[w]);
! }
! }
! });
/* Biased coloring, not finished yet by a long shot */
if (biased_coloring)
{
--- 1360,1380 ----
AND_COMPL_HARD_REG_SET (okColors, fixed_reg_set);
! EXECUTE_IF_SET_IN_BITMAP (regInfo[currReg]->adjList, 0, entry,
! {
! unsigned int w = get_alias(entry);
! if (REGNO_REG_SET_P (coloredNodes, w) || REGNO_REG_SET_P (precolored, w))
! {
! int index = colors[w];
! if (index >= 0)
! {
! /* If one is a superset of the other, this should already
! handle it, because we'll still clear the right bits. */
! CLEAR_HARD_REG_BIT (okColors, index);
! AND_COMPL_HARD_REG_SET (okColors, excluded[w]);
! }
! }
! });
/* Biased coloring, not finished yet by a long shot */
if (biased_coloring)
{
*************** assign_regs()
*** 1368,1383 ****
if (hset_member (frozenMoves, (void *)copy))
{
! unsigned int source = get_alias (REGNO (SET_SRC (copy)));
! unsigned int dest = get_alias (REGNO (SET_DEST (copy)));
unsigned int partner = currReg == source ? dest : source;
unsigned int color = colors[partner];
if (0 < color && color < FIRST_PSEUDO_REGISTER)
costs[color] += find_move_cost(copy);
! else if (! TEST_BIT (spilledNodes, partner))
{
unsigned int m;
! EXECUTE_IF_SET_IN_SBITMAP (regInfo[partner]->adjList, 0, m,
{
unsigned int neighbor = get_alias(m);
unsigned int color = colors[neighbor];
--- 1391,1406 ----
if (hset_member (frozenMoves, (void *)copy))
{
! unsigned int source = get_alias (REGNO (SET_SRC (PATTERN (copy))));
! unsigned int dest = get_alias (REGNO (SET_DEST (PATTERN (copy))));
unsigned int partner = currReg == source ? dest : source;
unsigned int color = colors[partner];
if (0 < color && color < FIRST_PSEUDO_REGISTER)
costs[color] += find_move_cost(copy);
! else if (! REGNO_REG_SET_P (spilledNodes, partner))
{
unsigned int m;
! EXECUTE_IF_SET_IN_REG_SET (regInfo[partner]->adjList, 0, m,
{
unsigned int neighbor = get_alias(m);
unsigned int color = colors[neighbor];
*************** assign_regs()
*** 1385,1430 ****
SET_HARD_REG_BIT(avoid, color);
});
}
}
! });
}
/* Non-biased coloring stuff */
! {
!
! firstOKBit = find_reg_given_constraints (okColors, currReg);
! if (firstOKBit == -1)
! {
! /* Couldn't find a color to set -- guess we have to spill. */
! SET_BIT (spilledNodes, currReg);
! if (rtl_dump_file != NULL && debug_new_regalloc > 0)
! fprintf (rtl_dump_file, "Spilling register %d\n", currReg);
! reg_renumber[currReg] = -1;
! }
! else
! {
! /* We can color it. Yay! */
! int numRegs;
! int k;
!
! SET_BIT (coloredNodes, currReg);
! colors[currReg] = firstOKBit;
! numRegs = HARD_REGNO_NREGS (firstOKBit, PSEUDO_REGNO_MODE (currReg));
!
! /* Exclude the other regs this color is also using, from
! being used by this node's neighbors. */
! for (k = 1; k < numRegs; k++)
! SET_HARD_REG_BIT (excluded[currReg], colors[currReg] + k);
!
! if (rtl_dump_file != NULL && debug_new_regalloc > 0)
! fprintf (rtl_dump_file, "Color of register %d is %d\n",
! currReg, colors[currReg]);
! }
! }
}
/* Now take care of coalesced variables. */
! EXECUTE_IF_SET_IN_SBITMAP (coalescedNodes, 0, entry,
{
unsigned int v1 = entry;
unsigned int v2 = get_alias (v1);
--- 1408,1472 ----
SET_HARD_REG_BIT(avoid, color);
});
}
+ }
+ });
+ for (l = 0; l < FIRST_PSEUDO_REGISTER; l++)
+ if (TEST_HARD_REG_BIT (okColors, l) && costs[l] > best_cost)
+ {
+ best_cost = costs[l];
+ best_color = l;
+ }
+ for (l = 0; l <FIRST_PSEUDO_REGISTER; l++)
+ if (TEST_HARD_REG_BIT (okColors, l)
+ && costs[l] == best_cost && ! TEST_HARD_REG_BIT (avoid, l))
+ {
+ best_color = l;
+ break;
}
! colors[currReg] = best_color;
! reg_renumber[currReg] = best_color;
! if (rtl_dump_file != NULL && debug_new_regalloc > 0)
! fprintf (rtl_dump_file, "Color of register %d is %d\n",
! currReg, colors[currReg]);
}
/* Non-biased coloring stuff */
! else
! {
! firstOKBit = find_reg_given_constraints (okColors, currReg);
!
! if (firstOKBit == -1)
! {
! /* Couldn't find a color to set -- guess we have to spill. */
! SET_REGNO_REG_SET (spilledNodes, currReg);
! if (rtl_dump_file != NULL && debug_new_regalloc > 0)
! fprintf (rtl_dump_file, "Spilling register %d\n", currReg);
! reg_renumber[currReg] = -1;
! }
! else
! {
! /* We can color it. Yay! */
! int numRegs;
! int k;
!
! SET_REGNO_REG_SET (coloredNodes, currReg);
! colors[currReg] = firstOKBit;
! numRegs = HARD_REGNO_NREGS (firstOKBit, PSEUDO_REGNO_MODE (currReg));
!
! /* Exclude the other regs this color is also using, from
! being used by this node's neighbors. */
! for (k = 1; k < numRegs; k++)
! SET_HARD_REG_BIT (excluded[currReg], colors[currReg] + k);
!
! if (rtl_dump_file != NULL && debug_new_regalloc > 0)
! fprintf (rtl_dump_file, "Color of register %d is %d\n",
! currReg, colors[currReg]);
! }
! }
}
/* Now take care of coalesced variables. */
! EXECUTE_IF_SET_IN_REG_SET (coalescedNodes, 0, entry,
{
unsigned int v1 = entry;
unsigned int v2 = get_alias (v1);
*************** assign_regs()
*** 1443,1449 ****
v1, colors[v2]);
colors[v1] = colors[v2];
});
!
free (excluded);
}
--- 1485,1491 ----
v1, colors[v2]);
colors[v1] = colors[v2];
});
! FREE_REG_SET (coloredNodes);
free (excluded);
}
*************** perform_new_regalloc ()
*** 1477,1483 ****
/* simplify-coalesce-freeze-spill loop */
while (1)
{
! if (sbitmap_first_set_bit (simplifyWorklist) != -1)
{
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "simplifying\n");
--- 1519,1525 ----
/* simplify-coalesce-freeze-spill loop */
while (1)
{
! if (regset_first_set_bit (simplifyWorklist) != -1)
{
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "simplifying\n");
*************** perform_new_regalloc ()
*** 1489,1501 ****
fprintf (rtl_dump_file, "coalescing\n");
coalesce ();
}
! else if (sbitmap_first_set_bit (freezeWorklist) != -1)
{
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "freezing\n");
freeze ();
}
! else if (sbitmap_first_set_bit(spillWorklist) != -1)
{
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "spilling\n");
--- 1531,1543 ----
fprintf (rtl_dump_file, "coalescing\n");
coalesce ();
}
! else if (regset_first_set_bit (freezeWorklist) != -1)
{
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "freezing\n");
freeze ();
}
! else if (regset_first_set_bit(spillWorklist) != -1)
{
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
fprintf (rtl_dump_file, "spilling\n");
*************** perform_new_regalloc ()
*** 1513,1519 ****
assign_regs ();
/* If we spilled */
! if (sbitmap_first_set_bit(spilledNodes) != -1)
{
/* FIXME: Insert spill code insertion here. */
rewrite_program (1);
--- 1555,1561 ----
assign_regs ();
/* If we spilled */
! if (regset_first_set_bit(spilledNodes) != -1)
{
/* FIXME: Insert spill code insertion here. */
rewrite_program (1);
*************** void
*** 1533,1543 ****
perform_new_regalloc_init ()
{
int i;
! sbitmap initial;
! sbitmap moveCandidates;
! initial = sbitmap_alloc (max_reg_num ());
! sbitmap_zero (initial);
/* Do dataflow analysis on all blocks. */
df_analyse (dataflowAnalyser, 0, DF_ALL | DF_HARD_REGS);
--- 1575,1585 ----
perform_new_regalloc_init ()
{
int i;
! regset initial;
! regset moveCandidates;
! initial = BITMAP_XMALLOC();
! CLEAR_REG_SET(initial);
/* Do dataflow analysis on all blocks. */
df_analyse (dataflowAnalyser, 0, DF_ALL | DF_HARD_REGS);
*************** perform_new_regalloc_init ()
*** 1553,1559 ****
regInfo[i] = ig_node_new();
regInfo[i]->degree = INT_MAX;
colors[i] = i;
! SET_BIT (precolored, i);
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting precolored node for hard reg %d\n", i);
}
--- 1595,1601 ----
regInfo[i] = ig_node_new();
regInfo[i]->degree = INT_MAX;
colors[i] = i;
! SET_REGNO_REG_SET (precolored, i);
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting precolored node for hard reg %d\n", i);
}
*************** perform_new_regalloc_init ()
*** 1561,1580 ****
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting new candidate %d\n", i);
! SET_BIT (initial, i);
regInfo[i] = ig_node_new ();
}
}
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
{
fprintf (rtl_dump_file, "Initial set:");
! dump_sbitmap (rtl_dump_file, initial);
fprintf (rtl_dump_file, "Precolored set:");
! dump_sbitmap (rtl_dump_file, precolored);
}
! moveCandidates = sbitmap_alloc (max_reg_num ());
! sbitmap_a_or_b (moveCandidates, initial, precolored);
/* Process all the basic blocks. */
for (i = 0; i < n_basic_blocks; i++)
--- 1603,1626 ----
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting new candidate %d\n", i);
! SET_REGNO_REG_SET (initial, i);
regInfo[i] = ig_node_new ();
}
}
if (rtl_dump_file != NULL && debug_new_regalloc > 0)
{
fprintf (rtl_dump_file, "Initial set:");
! dump_regset (initial, rtl_dump_file);
! fprintf (rtl_dump_file, "\n");
fprintf (rtl_dump_file, "Precolored set:");
! dump_regset (precolored, rtl_dump_file);
! fprintf (rtl_dump_file, "\n");
!
}
! moveCandidates = BITMAP_XMALLOC();
!
! IOR_REG_SET (moveCandidates, precolored);
/* Process all the basic blocks. */
for (i = 0; i < n_basic_blocks; i++)
*************** perform_new_regalloc_init ()
*** 1623,1629 ****
currdef = DF_INSN_DEFS (dataflowAnalyser, currinsn);
for (; currdef; currdef = currdef->next)
! EXECUTE_IF_SET_IN_SBITMAP(live, 0, j,
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting edge from %d to %d\n",
--- 1669,1675 ----
currdef = DF_INSN_DEFS (dataflowAnalyser, currinsn);
for (; currdef; currdef = currdef->next)
! EXECUTE_IF_SET_IN_SBITMAP (live, 0, j,
{
if (rtl_dump_file != NULL && debug_new_regalloc > 1)
fprintf (rtl_dump_file, "Inserting edge from %d to %d\n",
*************** perform_new_regalloc_init ()
*** 1650,1657 ****
extra interference edges if necessary for very weird constraints. It's
really no skin off our back, or theirs. */
make_worklist (initial);
! sbitmap_free (moveCandidates);
! sbitmap_free (initial);
compute_bb_for_insn (get_max_uid ());
}
--- 1696,1703 ----
extra interference edges if necessary for very weird constraints. It's
really no skin off our back, or theirs. */
make_worklist (initial);
! FREE_REG_SET (moveCandidates);
! FREE_REG_SET (initial);
compute_bb_for_insn (get_max_uid ());
}
*************** void
*** 1661,1687 ****
init_new_regalloc ()
{
int i, max_reg = max_reg_num ();
!
/* Initialize our variables. */
spill_heuristic = default_heuristic;
!
! precolored = sbitmap_alloc (max_reg);
! sbitmap_zero (precolored);
! simplifyWorklist = sbitmap_alloc (max_reg);
! sbitmap_zero (simplifyWorklist);
! freezeWorklist = sbitmap_alloc (max_reg);
! sbitmap_zero (freezeWorklist);
! spillWorklist = sbitmap_alloc (max_reg);
! sbitmap_zero (spillWorklist);
! spilledNodes = sbitmap_alloc(max_reg);
! sbitmap_zero (spilledNodes);
! coalescedNodes = sbitmap_alloc(max_reg);
! sbitmap_zero (coalescedNodes);
coalescedMoves = hset_new ();
constrainedMoves = hset_new ();
--- 1707,1733 ----
init_new_regalloc ()
{
int i, max_reg = max_reg_num ();
!
/* Initialize our variables. */
spill_heuristic = default_heuristic;
!
! precolored = BITMAP_XMALLOC();
! CLEAR_REG_SET (precolored);
! simplifyWorklist = BITMAP_XMALLOC();
! CLEAR_REG_SET (simplifyWorklist);
! freezeWorklist = BITMAP_XMALLOC();
! CLEAR_REG_SET (freezeWorklist);
! spillWorklist = BITMAP_XMALLOC();
! CLEAR_REG_SET (spillWorklist);
! spilledNodes = BITMAP_XMALLOC();
! CLEAR_REG_SET (spilledNodes);
! coalescedNodes = BITMAP_XMALLOC();
! CLEAR_REG_SET (coalescedNodes);
coalescedMoves = hset_new ();
constrainedMoves = hset_new ();
*************** init_new_regalloc ()
*** 1690,1704 ****
activeMoves = hset_new ();
regInfo = ggc_alloc_cleared (sizeof (ig_node) * max_reg);
! reg_freedoms = ggc_alloc_cleared (sizeof(int) * max_reg_num ());
! colors = ggc_alloc (sizeof (int) * max_reg_num ());
for (i = 0; i < max_reg; i++)
{
colors[i] = -1;
reg_freedoms[i] = -1;
}
!
VARRAY_UINT_INIT (selectStack, 1, "Interference graph stack");
dataflowAnalyser = df_init ();
allocate_reg_info (max_reg, FALSE, TRUE);
--- 1736,1751 ----
activeMoves = hset_new ();
regInfo = ggc_alloc_cleared (sizeof (ig_node) * max_reg);
! reg_freedoms = ggc_alloc_cleared (sizeof(int) * max_reg);
! colors = ggc_alloc (sizeof (int) * max_reg);
for (i = 0; i < max_reg; i++)
{
colors[i] = -1;
reg_freedoms[i] = -1;
}
! selectNodes = BITMAP_XMALLOC();
! CLEAR_REG_SET (selectNodes);
VARRAY_UINT_INIT (selectStack, 1, "Interference graph stack");
dataflowAnalyser = df_init ();
allocate_reg_info (max_reg, FALSE, TRUE);
*************** init_new_regalloc ()
*** 1714,1725 ****
void
finish_new_regalloc ()
{
/* Cleanup after ourselves */
! sbitmap_free (simplifyWorklist);
! sbitmap_free (freezeWorklist);
! sbitmap_free (spillWorklist);
! sbitmap_free (spilledNodes);
! sbitmap_free (coalescedNodes);
hset_free (coalescedMoves);
hset_free (constrainedMoves);
hset_free (frozenMoves);
--- 1761,1779 ----
void
finish_new_regalloc ()
{
+ int i;
+ for (i=0; i < max_reg_num(); i++)
+ if (regInfo[i] != 0)
+ ig_node_delete (regInfo[i]);
+
/* Cleanup after ourselves */
!
! FREE_REG_SET (simplifyWorklist);
! FREE_REG_SET (freezeWorklist);
! FREE_REG_SET (spillWorklist);
! FREE_REG_SET (spilledNodes);
! FREE_REG_SET (coalescedNodes);
! FREE_REG_SET (selectNodes);
hset_free (coalescedMoves);
hset_free (constrainedMoves);
hset_free (frozenMoves);