Commit 749a2da1 by Richard Kenner Committed by Richard Kenner

c-decl.c (mark_binding_level): Use 'for' instead of `while'.

	* c-decl.c (mark_binding_level): Use 'for' instead of `while'.
	* conflict.c: Minor cleanups.
	* optabs.c: Add blank line
	* simplify-rtx.c:

From-SVN: r33226
parent 83c1f628
Tue Apr 18 14:16:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* c-decl.c (mark_binding_level): Use 'for' instead of `while'.
* conflict.c: Minor cleanups.
* optabs.c: Add blank line
* simplify-rtx.c:
2000-04-17 Zack Weinberg <zack@wolery.cumb.org> 2000-04-17 Zack Weinberg <zack@wolery.cumb.org>
* cppexp.c (lex): Don't assume tokens are NUL terminated. * cppexp.c (lex): Don't assume tokens are NUL terminated.
......
...@@ -2860,13 +2860,14 @@ lookup_name_current_level (name) ...@@ -2860,13 +2860,14 @@ lookup_name_current_level (name)
} }
/* Mark ARG for GC. */ /* Mark ARG for GC. */
static void static void
mark_binding_level (arg) mark_binding_level (arg)
void *arg; void *arg;
{ {
struct binding_level *level = *(struct binding_level **) arg; struct binding_level *level = *(struct binding_level **) arg;
while (level) for (; level != 0; level = level->level_chain)
{ {
ggc_mark_tree (level->names); ggc_mark_tree (level->names);
ggc_mark_tree (level->tags); ggc_mark_tree (level->tags);
...@@ -2874,7 +2875,6 @@ mark_binding_level (arg) ...@@ -2874,7 +2875,6 @@ mark_binding_level (arg)
ggc_mark_tree (level->blocks); ggc_mark_tree (level->blocks);
ggc_mark_tree (level->this_block); ggc_mark_tree (level->this_block);
ggc_mark_tree (level->parm_order); ggc_mark_tree (level->parm_order);
level = level->level_chain;
} }
} }
......
...@@ -2,22 +2,22 @@ ...@@ -2,22 +2,22 @@
Copyright (C) 2000 Free Software Foundation, Inc. Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC Contributed by CodeSourcery, LLC
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation; either version 2, or (at your option)
any later version. any later version.
GNU CC is distributed in the hope that it will be useful, GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
/* References: /* References:
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "obstack.h" #include "obstack.h"
#include "hashtab.h" #include "hashtab.h"
#include "rtl.h" #include "rtl.h"
...@@ -108,23 +107,18 @@ struct conflict_graph_def ...@@ -108,23 +107,18 @@ struct conflict_graph_def
/* The initial capacity (number of conflict arcs) for newly-created /* The initial capacity (number of conflict arcs) for newly-created
conflict graphs. */ conflict graphs. */
#define INITIAL_ARC_CAPACITY (64) #define INITIAL_ARC_CAPACITY 64
/* Computes the hash value of the conflict graph arc connecting regs /* Computes the hash value of the conflict graph arc connecting regs
R1__ and R2__. R1__ is assumed to be smaller or equal to R2__. */ R1 and R2. R1 is assumed to be smaller or equal to R2. */
#define CONFLICT_HASH_FN(r1__, r2__) ((r2__) * ((r2__) - 1) / 2 + (r1__)) #define CONFLICT_HASH_FN(R1, R2) ((R2) * ((R2) - 1) / 2 + (R1))
static unsigned arc_hash static unsigned arc_hash PARAMS ((const void *));
PARAMS ((const void *arcp)); static int arc_eq PARAMS ((const void *, const void *));
static int arc_eq static int print_conflict PARAMS ((int, int, void *));
PARAMS ((const void *arcp1, const void *arcp2)); static void mark_reg PARAMS ((rtx, rtx, void *));
static int print_conflict
PARAMS ((int reg1, int reg2, void *contextp));
static void mark_reg
PARAMS ((rtx reg, rtx setter, void *data));
/* Callback function to compute the hash value of an arc. Uses /* Callback function to compute the hash value of an arc. Uses
current_graph to locate the graph to which the arc belongs. */ current_graph to locate the graph to which the arc belongs. */
...@@ -133,6 +127,7 @@ arc_hash (arcp) ...@@ -133,6 +127,7 @@ arc_hash (arcp)
const void *arcp; const void *arcp;
{ {
conflict_graph_arc arc = (conflict_graph_arc) arcp; conflict_graph_arc arc = (conflict_graph_arc) arcp;
return CONFLICT_HASH_FN (arc->smaller, arc->larger); return CONFLICT_HASH_FN (arc->smaller, arc->larger);
} }
...@@ -146,6 +141,7 @@ arc_eq (arcp1, arcp2) ...@@ -146,6 +141,7 @@ arc_eq (arcp1, arcp2)
{ {
conflict_graph_arc arc1 = (conflict_graph_arc) arcp1; conflict_graph_arc arc1 = (conflict_graph_arc) arcp1;
conflict_graph_arc arc2 = (conflict_graph_arc) arcp2; conflict_graph_arc arc2 = (conflict_graph_arc) arcp2;
return arc1->smaller == arc2->smaller && arc1->larger == arc2->larger; return arc1->smaller == arc2->smaller && arc1->larger == arc2->larger;
} }
...@@ -156,24 +152,23 @@ conflict_graph ...@@ -156,24 +152,23 @@ conflict_graph
conflict_graph_new (num_regs) conflict_graph_new (num_regs)
int num_regs; int num_regs;
{ {
conflict_graph graph = conflict_graph graph
(conflict_graph) xmalloc (sizeof (struct conflict_graph_def)); = (conflict_graph) xmalloc (sizeof (struct conflict_graph_def));
graph->num_regs = num_regs; graph->num_regs = num_regs;
/* Set up the hash table. No delete action is specified; memory /* Set up the hash table. No delete action is specified; memory
management of arcs is through the obstack. */ management of arcs is through the obstack. */
graph->arc_hash_table = graph->arc_hash_table
htab_create (INITIAL_ARC_CAPACITY, &arc_hash, &arc_eq, NULL); = htab_create (INITIAL_ARC_CAPACITY, &arc_hash, &arc_eq, NULL);
/* Create an obstack for allocating arcs. */ /* Create an obstack for allocating arcs. */
obstack_init (&(graph->arc_obstack)); obstack_init (&graph->arc_obstack);
/* Create and zero the lookup table by register number. */ /* Create and zero the lookup table by register number. */
graph->neighbor_heads = (conflict_graph_arc *) graph->neighbor_heads
xmalloc (num_regs * sizeof (conflict_graph_arc)); = (conflict_graph_arc *) xmalloc (num_regs * sizeof (conflict_graph_arc));
memset (graph->neighbor_heads, 0,
num_regs * sizeof (conflict_graph_arc));
memset (graph->neighbor_heads, 0, num_regs * sizeof (conflict_graph_arc));
return graph; return graph;
} }
...@@ -183,7 +178,7 @@ void ...@@ -183,7 +178,7 @@ void
conflict_graph_delete (graph) conflict_graph_delete (graph)
conflict_graph graph; conflict_graph graph;
{ {
obstack_free (&(graph->arc_obstack), NULL); obstack_free (&graph->arc_obstack, NULL);
htab_delete (graph->arc_hash_table); htab_delete (graph->arc_hash_table);
free (graph->neighbor_heads); free (graph->neighbor_heads);
free (graph); free (graph);
...@@ -218,10 +213,11 @@ conflict_graph_add (graph, reg1, reg2) ...@@ -218,10 +213,11 @@ conflict_graph_add (graph, reg1, reg2)
return 0; return 0;
/* Allocate an arc. */ /* Allocate an arc. */
arc = (conflict_graph_arc) arc
obstack_alloc (&(graph->arc_obstack), = (conflict_graph_arc)
sizeof (struct conflict_graph_arc_def)); obstack_alloc (&graph->arc_obstack,
sizeof (struct conflict_graph_arc_def));
/* Record the reg numbers. */ /* Record the reg numbers. */
arc->smaller = smaller; arc->smaller = smaller;
arc->larger = larger; arc->larger = larger;
...@@ -299,6 +295,7 @@ conflict_graph_merge_regs (graph, target, src) ...@@ -299,6 +295,7 @@ conflict_graph_merge_regs (graph, target, src)
while (arc != NULL) while (arc != NULL)
{ {
int other = arc->smaller; int other = arc->smaller;
if (other == src) if (other == src)
other = arc->larger; other = arc->larger;
...@@ -372,19 +369,22 @@ conflict_graph_print (graph, fp) ...@@ -372,19 +369,22 @@ conflict_graph_print (graph, fp)
{ {
int reg; int reg;
struct print_context context; struct print_context context;
context.fp = fp;
context.fp = fp;
fprintf (fp, "Conflicts:\n"); fprintf (fp, "Conflicts:\n");
/* Loop over registers supported in this graph. */ /* Loop over registers supported in this graph. */
for (reg = 0; reg < graph->num_regs; ++reg) for (reg = 0; reg < graph->num_regs; ++reg)
{ {
context.reg = reg; context.reg = reg;
context.started = 0; context.started = 0;
/* Scan the conflicts for reg, printing as we go. A label for /* Scan the conflicts for reg, printing as we go. A label for
this line will be printed the first time a conflict is this line will be printed the first time a conflict is
printed for the reg; we won't start a new line if this reg printed for the reg; we won't start a new line if this reg
has no conflicts. */ has no conflicts. */
conflict_graph_enum (graph, reg, &print_conflict, &context); conflict_graph_enum (graph, reg, &print_conflict, &context);
/* If this reg does have conflicts, end the line. */ /* If this reg does have conflicts, end the line. */
if (context.started) if (context.started)
fputc ('\n', fp); fputc ('\n', fp);
...@@ -469,9 +469,7 @@ conflict_graph_compute (regs, p) ...@@ -469,9 +469,7 @@ conflict_graph_compute (regs, p)
/* Walk the instruction stream backwards. */ /* Walk the instruction stream backwards. */
head = bb->head; head = bb->head;
insn = bb->end; insn = bb->end;
for (insn = bb->end; for (insn = bb->end; insn != head; insn = PREV_INSN (insn))
insn != head;
insn = PREV_INSN (insn))
{ {
int born_reg; int born_reg;
int live_reg; int live_reg;
...@@ -497,20 +495,21 @@ conflict_graph_compute (regs, p) ...@@ -497,20 +495,21 @@ conflict_graph_compute (regs, p)
/* For every reg born here, add a conflict with every other /* For every reg born here, add a conflict with every other
reg live coming into this insn. */ reg live coming into this insn. */
EXECUTE_IF_SET_IN_REG_SET (born, EXECUTE_IF_SET_IN_REG_SET
FIRST_PSEUDO_REGISTER, (born, FIRST_PSEUDO_REGISTER, born_reg,
born_reg, { {
EXECUTE_IF_SET_IN_REG_SET (live, EXECUTE_IF_SET_IN_REG_SET
FIRST_PSEUDO_REGISTER, (live, FIRST_PSEUDO_REGISTER, live_reg,
live_reg, { {
/* Build the conflict graph in terms of canonical /* Build the conflict graph in terms of canonical
regnos. */ regnos. */
int b = partition_find (p, born_reg); int b = partition_find (p, born_reg);
int l = partition_find (p, live_reg); int l = partition_find (p, live_reg);
if (b != l)
conflict_graph_add (graph, b, l); if (b != l)
}); conflict_graph_add (graph, b, l);
}); });
});
/* Morgan's algorithm checks the operands of the insn /* Morgan's algorithm checks the operands of the insn
and adds them to the set of live regs. Instead, we and adds them to the set of live regs. Instead, we
...@@ -519,7 +518,8 @@ conflict_graph_compute (regs, p) ...@@ -519,7 +518,8 @@ conflict_graph_compute (regs, p)
for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
if (REG_NOTE_KIND (link) == REG_DEAD) if (REG_NOTE_KIND (link) == REG_DEAD)
{ {
int regno = REGNO (XEXP (link, 0)); unsigned int regno = REGNO (XEXP (link, 0));
if (REGNO_REG_SET_P (regs, regno)) if (REGNO_REG_SET_P (regs, regno))
SET_REGNO_REG_SET (live, regno); SET_REGNO_REG_SET (live, regno);
} }
......
...@@ -3098,6 +3098,7 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, align, ...@@ -3098,6 +3098,7 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, align,
to be used for operand OPNUM of the insn, is converted from mode MODE to to be used for operand OPNUM of the insn, is converted from mode MODE to
WIDER_MODE (UNSIGNEDP determines whether it is a unsigned conversion), and WIDER_MODE (UNSIGNEDP determines whether it is a unsigned conversion), and
that it is accepted by the operand predicate. Return the new value. */ that it is accepted by the operand predicate. Return the new value. */
rtx rtx
prepare_operand (icode, x, opnum, mode, wider_mode, unsignedp) prepare_operand (icode, x, opnum, mode, wider_mode, unsignedp)
int icode; int icode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment