OSDN Git Service

* init.c (build_new): Allow enumeration types for the array-bounds
[pf3gnuchains/gcc-fork.git] / gcc / resource.c
index de33cb1..8266321 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for computing resource usage of specific insns.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -176,7 +176,7 @@ next_insn_no_annul (insn)
 }
 \f
 /* Given X, some rtl, and RES, a pointer to a `struct resource', mark
-   which resources are references by the insn.  If INCLUDE_DELAYED_EFFECTS
+   which resources are referenced by the insn.  If INCLUDE_DELAYED_EFFECTS
    is TRUE, resources used by the called routine will be included for
    CALL_INSNs.  */
 
@@ -212,14 +212,24 @@ mark_referenced_resources (x, res, include_delayed_effects)
          unsigned int last_regno
            = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
 
+         if (last_regno > FIRST_PSEUDO_REGISTER)
+           abort ();
          for (r = regno; r < last_regno; r++)
            SET_HARD_REG_BIT (res->regs, r);
        }
       return;
 
     case REG:
-      for (r = 0; r < HARD_REGNO_NREGS (REGNO (x), GET_MODE (x)); r++)
-       SET_HARD_REG_BIT (res->regs, REGNO (x) + r);
+       {
+         unsigned int regno = REGNO (x);
+         unsigned int last_regno
+           = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
+
+         if (last_regno > FIRST_PSEUDO_REGISTER)
+           abort ();
+         for (r = regno; r < last_regno; r++)
+           SET_HARD_REG_BIT (res->regs, r);
+       }
       return;
 
     case MEM:
@@ -723,9 +733,9 @@ mark_set_resources (x, res, in_dest, mark_type)
 
     case PRE_MODIFY:
     case POST_MODIFY:
-      mark_set_resources (XEXP (x, 0), res, 1, 0);
-      mark_set_resources (XEXP (XEXP (x, 1), 0), res, 0, 0);
-      mark_set_resources (XEXP (XEXP (x, 1), 1), res, 0, 0);
+      mark_set_resources (XEXP (x, 0), res, 1, MARK_SRC_DEST);
+      mark_set_resources (XEXP (XEXP (x, 1), 0), res, 0, MARK_SRC_DEST);
+      mark_set_resources (XEXP (XEXP (x, 1), 1), res, 0, MARK_SRC_DEST);
       return;
 
     case SIGN_EXTRACT:
@@ -760,6 +770,8 @@ mark_set_resources (x, res, in_dest, mark_type)
              unsigned int last_regno
                = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
 
+             if (last_regno > FIRST_PSEUDO_REGISTER)
+               abort ();
              for (r = regno; r < last_regno; r++)
                SET_HARD_REG_BIT (res->regs, r);
            }
@@ -768,8 +780,16 @@ mark_set_resources (x, res, in_dest, mark_type)
 
     case REG:
       if (in_dest)
-        for (r = 0; r < HARD_REGNO_NREGS (REGNO (x), GET_MODE (x)); r++)
-         SET_HARD_REG_BIT (res->regs, REGNO (x) + r);
+       {
+         unsigned int regno = REGNO (x);
+         unsigned int last_regno
+           = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
+
+         if (last_regno > FIRST_PSEUDO_REGISTER)
+           abort ();
+         for (r = regno; r < last_regno; r++)
+           SET_HARD_REG_BIT (res->regs, r);
+       }
       return;
 
     case STRICT_LOW_PART:
@@ -923,7 +943,7 @@ mark_target_live_regs (insns, target, res)
        {
          /* Allocate a place to put our results and chain it into the 
             hash table.  */
-         tinfo = (struct target_info *) oballoc (sizeof (struct target_info));
+         tinfo = (struct target_info *) xmalloc (sizeof (struct target_info));
          tinfo->uid = INSN_UID (target);
          tinfo->block = b;
          tinfo->next = target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME];
@@ -1009,7 +1029,7 @@ mark_target_live_regs (insns, target, res)
 #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
                    && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
 #endif
-#if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
+#if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
                    && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
 #endif
                    )
@@ -1223,6 +1243,20 @@ free_resource_info ()
 {
   if (target_hash_table != NULL)
     {
+      int i;
+      
+      for (i = 0; i < TARGET_HASH_PRIME; ++i) 
+       {
+         struct target_info *ti = target_hash_table[i];
+
+         while (ti) 
+           {
+             struct target_info *next = ti->next;
+             free (ti);
+             ti = next;
+           }
+       }
+
       free (target_hash_table);
       target_hash_table = NULL;
     }