OSDN Git Service

(emit_library_call): Don't pass VOIDmode to type_for_mode.
[pf3gnuchains/gcc-fork.git] / gcc / rtl.c
index 7b646c3..b77df81 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -1,5 +1,5 @@
 /* Allocate and read RTL for GNU C Compiler.
-   Copyright (C) 1987, 1988, 1991 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1988, 1991, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -15,13 +15,15 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 
 #include "config.h"
 #include <ctype.h>
 #include <stdio.h>
 #include "rtl.h"
+#include "real.h"
 
 #include "obstack.h"
 #define        obstack_chunk_alloc     xmalloc
@@ -35,8 +37,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 extern struct obstack *rtl_obstack;
 
-extern long ftell();
-
 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
 extern long atol();
 #endif
@@ -123,11 +123,6 @@ enum machine_mode mode_wider_mode[(int) MAX_MACHINE_MODE] = {
 
 enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS];
 
-/* Commonly used modes.  */
-
-enum machine_mode byte_mode;   /* Mode whose width is BITS_PER_UNIT */
-enum machine_mode word_mode;   /* Mode whose width is BITS_PER_WORD */
-
 /* Indexed by rtx code, gives a sequence of operand-types for
    rtx's of that code.  The sequence is a C string in which
    each character describes one operand.  */
@@ -171,13 +166,14 @@ char rtx_class[] = {
 
 /* Names for kinds of NOTEs and REG_NOTEs.  */
 
-char *note_insn_name[] = { "NOTE_INSN_FUNCTION_BEG", "NOTE_INSN_DELETED",
+char *note_insn_name[] = { 0                    , "NOTE_INSN_DELETED",
                           "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
                           "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
                           "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
                           "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
                           "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
-                          "NOT_INSN_DELETED_LABEL"};
+                          "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
+                          "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END"};
 
 char *reg_note_name[] = { "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0",
                          "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL",
@@ -200,9 +196,10 @@ rtvec_alloc (n)
                              + (( n - 1) * sizeof (rtunion)));
 
   /* clear out the vector */
-  PUT_NUM_ELEM(rt, n);
-  for (i=0; i < n; i++)
-    rt->elem[i].rtvec = NULL;  /* @@ not portable due to rtunion */
+  PUT_NUM_ELEM (rt, n);
+
+  for (i = 0; i < n; i++)
+    rt->elem[i].rtwint = 0;
 
   return rt;
 }
@@ -235,11 +232,27 @@ rtx_alloc (code)
   ob->next_free += length;
   ob->object_base = ob->next_free;
 
-  * (int *) rt = 0;
+  /* We want to clear everything up to the FLD array.  Normally, this is
+     one int, but we don't want to assume that and it isn't very portable
+     anyway; this is.  */
+
+  length = (sizeof (struct rtx_def) - sizeof (rtunion) - 1) / sizeof (int);
+  for (; length >= 0; length--)
+    ((int *) rt)[length] = 0;
+
   PUT_CODE (rt, code);
 
   return rt;
 }
+
+/* Free the rtx X and all RTL allocated since X.  */
+
+void
+rtx_free (x)
+     rtx x;
+{
+  obstack_free (rtl_obstack, x);
+}
 \f
 /* Create a new copy of an rtx.
    Recursively copies the operands of the rtx,
@@ -266,7 +279,23 @@ copy_rtx (orig)
     case CODE_LABEL:
     case PC:
     case CC0:
+    case SCRATCH:
+      /* SCRATCH must be shared because they represent distinct values.  */
       return orig;
+
+    case CONST:
+      /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
+        a LABEL_REF, it isn't sharable.  */
+      if (GET_CODE (XEXP (orig, 0)) == PLUS
+         && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
+         && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
+       return orig;
+      break;
+
+      /* A MEM with a constant address is not sharable.  The problem is that
+        the constant address may need to be reloaded.  If the mem is shared,
+        then reloading one copy of this mem will cause all copies to appear
+        to have been reloaded.  */
     }
 
   copy = rtx_alloc (code);
@@ -673,7 +702,6 @@ read_rtx (infile)
        {
          int saw_paren = 0;
          register char *stringbuf;
-         int stringbufsize;
 
          c = read_skip_spaces (infile);
          if (c == '(')
@@ -778,8 +806,9 @@ init_rtl ()
       *s++ = 'e';
       *s++ = '0';
       /* Set the GET_RTX_FORMAT of CONST_DOUBLE to a string
-        of as many `i's as we now have elements.  */
-      for (i = 0; i < rtx_length[(int) CONST_DOUBLE]; i++)
+        of as many `w's as we now have elements.  Subtract two from
+        the size to account for the 'e' and the '0'.  */
+      for (i = 2; i < rtx_length[(int) CONST_DOUBLE]; i++)
        *s++ = 'w';
       *s++ = 0;
     }
@@ -796,15 +825,11 @@ init_rtl ()
     }
 #endif
 
-  /* Find the narrowest mode for each class and compute the word and byte
-     modes.  */
+  /* Find the narrowest mode for each class.  */
 
   for (i = 0; i < (int) MAX_MODE_CLASS; i++)
     min_class_size[i] = 1000;
 
-  byte_mode = VOIDmode;
-  word_mode = VOIDmode;
-
   for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
        mode = (enum machine_mode) ((int) mode + 1))
     {
@@ -813,15 +838,6 @@ init_rtl ()
          class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode;
          min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode);
        }
-      if (GET_MODE_CLASS (mode) == MODE_INT
-         && GET_MODE_BITSIZE (mode) == BITS_PER_UNIT
-         && byte_mode == VOIDmode)
-       byte_mode = mode;
-
-      if (GET_MODE_CLASS (mode) == MODE_INT
-         && GET_MODE_BITSIZE (mode) == BITS_PER_WORD
-         && word_mode == VOIDmode)
-       word_mode = mode;
     }
 }
 \f