OSDN Git Service

* lib/old-dejagnu.exp (old-dejagnu): Copy extra source files
[pf3gnuchains/gcc-fork.git] / gcc / rtl.c
index 0c84d75..3e73e4b 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -2,34 +2,35 @@
    Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999, 2000, 2001
    Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-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
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
 #include "rtl.h"
 #include "real.h"
 #include "ggc.h"
+#include "errors.h"
 
 \f
 /* Calculate the format for CONST_DOUBLE.  This depends on the relative
    widths of HOST_WIDE_INT and REAL_VALUE_TYPE.
 
-   We need to go out to e0wwwww, since REAL_ARITHMETIC assumes 16-bits
+   We need to go out to 0wwwww, since REAL_ARITHMETIC assumes 16-bits
    per element in REAL_VALUE_TYPE.
 
    This is duplicated in gengenrtl.c.
@@ -69,19 +70,19 @@ Boston, MA 02111-1307, USA.  */
 #endif /* REAL_WIDTH */
 
 #if REAL_WIDTH == 1
-# define CONST_DOUBLE_FORMAT   "e0ww"
+# define CONST_DOUBLE_FORMAT   "0ww"
 #else
 # if REAL_WIDTH == 2
-#  define CONST_DOUBLE_FORMAT  "e0ww"
+#  define CONST_DOUBLE_FORMAT  "0ww"
 # else
 #  if REAL_WIDTH == 3
-#   define CONST_DOUBLE_FORMAT "e0www"
+#   define CONST_DOUBLE_FORMAT "0www"
 #  else
 #   if REAL_WIDTH == 4
-#    define CONST_DOUBLE_FORMAT        "e0wwww"
+#    define CONST_DOUBLE_FORMAT        "0wwww"
 #   else
 #    if REAL_WIDTH == 5
-#     define CONST_DOUBLE_FORMAT       "e0wwwww"
+#     define CONST_DOUBLE_FORMAT       "0wwwww"
 #    else
 #     define CONST_DOUBLE_FORMAT       /* nothing - will cause syntax error */
 #    endif
@@ -116,11 +117,8 @@ const char * const rtx_name[] = {
 
 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER)  NAME,
 
-const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
+const char * const mode_name[] = {
 #include "machmode.def"
-  /* Add an extra field to avoid a core dump if someone tries to convert
-     MAX_MACHINE_MODE to a string.   */
-  ""
 };
 
 #undef DEF_MACHMODE
@@ -129,7 +127,7 @@ const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
 
 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER)  CLASS,
 
-const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
+const enum mode_class mode_class[] = {
 #include "machmode.def"
 };
 
@@ -140,7 +138,7 @@ const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
 
 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER)  BITSIZE,
 
-const unsigned int mode_bitsize[(int) MAX_MACHINE_MODE] = {
+const unsigned int mode_bitsize[] = {
 #include "machmode.def"
 };
 
@@ -151,7 +149,7 @@ const unsigned int mode_bitsize[(int) MAX_MACHINE_MODE] = {
 
 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER)  SIZE,
 
-const unsigned int mode_size[(int) MAX_MACHINE_MODE] = {
+const unsigned int mode_size[] = {
 #include "machmode.def"
 };
 
@@ -162,7 +160,7 @@ const unsigned int mode_size[(int) MAX_MACHINE_MODE] = {
 
 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER)  UNIT,
 
-const unsigned int mode_unit_size[(int) MAX_MACHINE_MODE] = {
+const unsigned int mode_unit_size[] = {
 #include "machmode.def"                /* machine modes are documented here */
 };
 
@@ -175,7 +173,7 @@ const unsigned int mode_unit_size[(int) MAX_MACHINE_MODE] = {
 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER)  \
   (unsigned char) WIDER,
 
-const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
+const unsigned char mode_wider_mode[] = {
 #include "machmode.def"                /* machine modes are documented here */
 };
 
@@ -186,7 +184,7 @@ const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
 
 /* Indexed by machine mode, gives mask of significant bits in mode.  */
 
-const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
+const unsigned HOST_WIDE_INT mode_mask_array[] = {
 #include "machmode.def"
 };
 
@@ -230,6 +228,8 @@ const char * const rtx_format[] = {
          prints the string
      "S" like "s", but optional:
         the containing rtx may end before this operand
+     "T" like "s", but treated specially by the RTL reader;
+         only found in machine description patterns.
      "e" a pointer to an rtl expression
          prints the expression
      "E" a pointer to a vector that points to a number of rtl expressions
@@ -239,7 +239,7 @@ const char * const rtx_format[] = {
      "u" a pointer to another insn
          prints the uid of the insn.
      "b" is a pointer to a bitmap header.
-     "t" is a tree pointer. */
+     "t" is a tree pointer.  */
 
 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   FORMAT ,
 #include "rtl.def"             /* rtl expressions are defined here */
@@ -263,7 +263,7 @@ const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS] =
   "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
   "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
   "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
-  "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
+  "NOTE_INSN_FUNCTION_END",
   "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
   "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
   "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
@@ -280,8 +280,9 @@ const char * const reg_note_name[] =
   "REG_LABEL", "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
   "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
   "REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
-  "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN",
-  "REG_NON_LOCAL_GOTO"
+  "REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN",
+  "REG_NON_LOCAL_GOTO", "REG_SETJMP", "REG_ALWAYS_RETURN",
+  "REG_VTABLE_REF"
 };
 
 \f
@@ -330,12 +331,12 @@ rtx_alloc (code)
 
 rtx
 copy_rtx (orig)
-     register rtx orig;
+     rtx orig;
 {
-  register rtx copy;
-  register int i, j;
-  register RTX_CODE code;
-  register const char *format_ptr;
+  rtx copy;
+  int i, j;
+  RTX_CODE code;
+  const char *format_ptr;
 
   code = GET_CODE (orig);
 
@@ -417,6 +418,7 @@ copy_rtx (orig)
        case 'i':
        case 's':
        case 'S':
+       case 'T':
        case 'u':
        case '0':
          /* These are left unchanged.  */
@@ -434,13 +436,13 @@ copy_rtx (orig)
 
 rtx
 copy_most_rtx (orig, may_share)
-     register rtx orig;
-     register rtx may_share;
+     rtx orig;
+     rtx may_share;
 {
-  register rtx copy;
-  register int i, j;
-  register RTX_CODE code;
-  register const char *format_ptr;
+  rtx copy;
+  int i, j;
+  RTX_CODE code;
+  const char *format_ptr;
 
   if (orig == may_share)
     return orig;
@@ -517,7 +519,7 @@ copy_most_rtx (orig, may_share)
          break;
 
        case '0':
-         /* Copy this through the wide int field; that's safest. */
+         /* Copy this through the wide int field; that's safest.  */
          X0WINT (copy, i) = X0WINT (orig, i);
          break;
 
@@ -529,13 +531,14 @@ copy_most_rtx (orig, may_share)
 }
 
 /* Create a new copy of an rtx.  Only copy just one level.  */
+
 rtx
 shallow_copy_rtx (orig)
      rtx orig;
 {
-  register int i;
-  register RTX_CODE code = GET_CODE (orig);
-  register rtx copy = rtx_alloc (code);
+  int i;
+  RTX_CODE code = GET_CODE (orig);
+  rtx copy = rtx_alloc (code);
 
   PUT_MODE (copy, GET_MODE (orig));
   copy->in_struct = orig->in_struct;
@@ -549,6 +552,23 @@ shallow_copy_rtx (orig)
 
   return copy;
 }
+
+/* Return the alignment of MODE. This will be bounded by 1 and
+   BIGGEST_ALIGNMENT.  */
+
+unsigned int
+get_mode_alignment (mode)
+     enum machine_mode mode;
+{
+  unsigned int alignment = GET_MODE_UNIT_SIZE (mode);
+  
+  /* Extract the LSB of the size.  */
+  alignment = alignment & -alignment;
+  alignment *= BITS_PER_UNIT;
+
+  alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
+  return alignment;
+}
 \f
 /* This is 1 until after the rtl generation pass.  */
 int rtx_equal_function_value_matters;
@@ -563,10 +583,10 @@ int
 rtx_equal_p (x, y)
      rtx x, y;
 {
-  register int i;
-  register int j;
-  register enum rtx_code code;
-  register const char *fmt;
+  int i;
+  int j;
+  enum rtx_code code;
+  const char *fmt;
 
   if (x == y)
     return 1;
@@ -588,10 +608,11 @@ rtx_equal_p (x, y)
   switch (code)
     {
     case REG:
-      /* Until rtl generation is complete, don't consider a reference to the
-        return register of the current function the same as the return from a
-        called function.  This eases the job of function integration.  Once the
-        distinction is no longer needed, they can be considered equivalent.  */
+      /* Until rtl generation is complete, don't consider a reference
+        to the return register of the current function the same as
+        the return from a called function.  This eases the job of
+        function integration.  Once the distinction is no longer
+        needed, they can be considered equivalent.  */
       return (REGNO (x) == REGNO (y)
              && (! rtx_equal_function_value_matters
                  || REG_FUNCTION_VALUE_P (x) == REG_FUNCTION_VALUE_P (y)));