OSDN Git Service

* tree-ssa-dom.c (dom_opt_finalize_block): Fix violation of strict
[pf3gnuchains/gcc-fork.git] / gcc / conflict.c
index 0aec927..31886fa 100644 (file)
@@ -148,8 +148,7 @@ arc_eq (const void *arcp1, const void *arcp2)
 conflict_graph
 conflict_graph_new (int num_regs)
 {
-  conflict_graph graph
-    = (conflict_graph) xmalloc (sizeof (struct conflict_graph_def));
+  conflict_graph graph = xmalloc (sizeof (struct conflict_graph_def));
   graph->num_regs = num_regs;
 
   /* Set up the hash table.  No delete action is specified; memory
@@ -161,10 +160,8 @@ conflict_graph_new (int num_regs)
   obstack_init (&graph->arc_obstack);
             
   /* Create and zero the lookup table by register number.  */
-  graph->neighbor_heads
-    = (conflict_graph_arc *) xmalloc (num_regs * sizeof (conflict_graph_arc));
+  graph->neighbor_heads = xcalloc (num_regs, sizeof (conflict_graph_arc));
 
-  memset (graph->neighbor_heads, 0, num_regs * sizeof (conflict_graph_arc));
   return graph;
 }
 
@@ -193,8 +190,7 @@ conflict_graph_add (conflict_graph graph, int reg1, int reg2)
   void **slot;
 
   /* A reg cannot conflict with itself.  */
-  if (reg1 == reg2)
-    abort ();
+  gcc_assert (reg1 != reg2);
 
   dummy.smaller = smaller;
   dummy.larger = larger;
@@ -206,8 +202,7 @@ conflict_graph_add (conflict_graph graph, int reg1, int reg2)
 
   /* Allocate an arc.  */
   arc
-    = (conflict_graph_arc)
-      obstack_alloc (&graph->arc_obstack,
+    = obstack_alloc (&graph->arc_obstack,
                     sizeof (struct conflict_graph_arc_def));
   
   /* Record the reg numbers.  */
@@ -328,10 +323,11 @@ print_conflict (int reg1, int reg2, void *contextp)
      is the interesting one.  */
   if (reg1 == context->reg)
     reg = reg2;
-  else if (reg2 == context->reg)
-    reg = reg1;
   else
-    abort ();
+    {
+      gcc_assert (reg2 == context->reg);
+      reg = reg1;
+    }
 
   /* Print the conflict.  */
   fprintf (context->fp, " %d", reg);
@@ -380,7 +376,7 @@ mark_reg (rtx reg, rtx setter ATTRIBUTE_UNUSED, void *data)
     reg = SUBREG_REG (reg);
 
   /* We're only interested in regs.  */
-  if (GET_CODE (reg) != REG)
+  if (!REG_P (reg))
     return;
 
   SET_REGNO_REG_SET (set, REGNO (reg));
@@ -439,9 +435,9 @@ conflict_graph_compute (regset regs, partition p)
       AND_REG_SET (live, regs);
 
       /* Walk the instruction stream backwards.  */
-      head = bb->head;
-      insn = bb->end;
-      for (insn = bb->end; insn != head; insn = PREV_INSN (insn))
+      head = BB_HEAD (bb);
+      insn = BB_END (bb);
+      for (insn = BB_END (bb); insn != head; insn = PREV_INSN (insn))
        {
          int born_reg;
          int live_reg;