OSDN Git Service

* Makefile.in (install-info): Simplify.
[pf3gnuchains/gcc-fork.git] / gcc / emit-rtl.c
index c3f36fa..1f355e8 100644 (file)
@@ -110,9 +110,14 @@ rtx const_true_rtx;
 REAL_VALUE_TYPE dconst0;
 REAL_VALUE_TYPE dconst1;
 REAL_VALUE_TYPE dconst2;
+REAL_VALUE_TYPE dconst3;
+REAL_VALUE_TYPE dconst10;
 REAL_VALUE_TYPE dconstm1;
 REAL_VALUE_TYPE dconstm2;
 REAL_VALUE_TYPE dconsthalf;
+REAL_VALUE_TYPE dconstthird;
+REAL_VALUE_TYPE dconstpi;
+REAL_VALUE_TYPE dconste;
 
 /* All references to the following fixed hard registers go through
    these unique rtl objects.  On machines where the frame-pointer and
@@ -132,8 +137,6 @@ REAL_VALUE_TYPE dconsthalf;
 
    In an inline procedure, the stack and frame pointer rtxs may not be
    used for anything else.  */
-rtx struct_value_rtx;          /* (REG:Pmode STRUCT_VALUE_REGNUM) */
-rtx struct_value_incoming_rtx; /* (REG:Pmode STRUCT_VALUE_INCOMING_REGNUM) */
 rtx static_chain_rtx;          /* (REG:Pmode STATIC_CHAIN_REGNUM) */
 rtx static_chain_incoming_rtx; /* (REG:Pmode STATIC_CHAIN_INCOMING_REGNUM) */
 rtx pic_offset_table_rtx;      /* (REG:Pmode PIC_OFFSET_TABLE_REGNUM) */
@@ -206,7 +209,7 @@ int split_branch_probability = -1;
 static hashval_t
 const_int_htab_hash (const void *x)
 {
-  return (hashval_t) INTVAL ((struct rtx_def *) x);
+  return (hashval_t) INTVAL ((rtx) x);
 }
 
 /* Returns nonzero if the value represented by X (which is really a
@@ -772,7 +775,7 @@ gen_rtvec (int n, ...)
   if (n == 0)
     return NULL_RTVEC;         /* Don't allocate an empty rtvec...     */
 
-  vector = (rtx *) alloca (n * sizeof (rtx));
+  vector = alloca (n * sizeof (rtx));
 
   for (i = 0; i < n; i++)
     vector[i] = va_arg (p, rtx);
@@ -845,8 +848,8 @@ gen_reg_rtx (enum machine_mode mode)
       memset (new + old_size, 0, old_size);
       f->emit->regno_pointer_align = (unsigned char *) new;
 
-      new1 = (rtx *) ggc_realloc (f->emit->x_regno_reg_rtx,
-                                 old_size * 2 * sizeof (rtx));
+      new1 = ggc_realloc (f->emit->x_regno_reg_rtx,
+                         old_size * 2 * sizeof (rtx));
       memset (new1 + old_size, 0, old_size * sizeof (rtx));
       regno_reg_rtx = new1;
 
@@ -858,7 +861,7 @@ gen_reg_rtx (enum machine_mode mode)
   return val;
 }
 
-/* Generate an register with same attributes as REG,
+/* Generate a register with same attributes as REG,
    but offsetted by OFFSET.  */
 
 rtx
@@ -912,7 +915,7 @@ set_decl_rtl (tree t, rtx x)
 
   if (!x)
     return;
-  /* For register, we maitain the reverse information too.  */
+  /* For register, we maintain the reverse information too.  */
   if (GET_CODE (x) == REG)
     REG_ATTRS (x) = get_reg_attrs (t, 0);
   else if (GET_CODE (x) == SUBREG)
@@ -1915,11 +1918,14 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
       else if (TREE_CODE (t) == ARRAY_REF)
        {
          tree off_tree = size_zero_node;
+         /* We can't modify t, because we use it at the end of the
+            function.  */
+         tree t2 = t;
 
          do
            {
-             tree index = TREE_OPERAND (t, 1);
-             tree array = TREE_OPERAND (t, 0);
+             tree index = TREE_OPERAND (t2, 1);
+             tree array = TREE_OPERAND (t2, 0);
              tree domain = TYPE_DOMAIN (TREE_TYPE (array));
              tree low_bound = (domain ? TYPE_MIN_VALUE (domain) : 0);
              tree unit_size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (array)));
@@ -1936,7 +1942,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
                 WITH_RECORD_EXPR; if the component size is, pass our
                 component to one.  */
              if (CONTAINS_PLACEHOLDER_P (index))
-               index = build (WITH_RECORD_EXPR, TREE_TYPE (index), index, t);
+               index = build (WITH_RECORD_EXPR, TREE_TYPE (index), index, t2);
              if (CONTAINS_PLACEHOLDER_P (unit_size))
                unit_size = build (WITH_RECORD_EXPR, sizetype,
                                   unit_size, array);
@@ -1947,28 +1953,28 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
                                            index,
                                            unit_size)),
                               off_tree));
-             t = TREE_OPERAND (t, 0);
+             t2 = TREE_OPERAND (t2, 0);
            }
-         while (TREE_CODE (t) == ARRAY_REF);
+         while (TREE_CODE (t2) == ARRAY_REF);
 
-         if (DECL_P (t))
+         if (DECL_P (t2))
            {
-             expr = t;
+             expr = t2;
              offset = NULL;
              if (host_integerp (off_tree, 1))
                {
                  HOST_WIDE_INT ioff = tree_low_cst (off_tree, 1);
                  HOST_WIDE_INT aoff = (ioff & -ioff) * BITS_PER_UNIT;
-                 align = DECL_ALIGN (t);
+                 align = DECL_ALIGN (t2);
                  if (aoff && (unsigned HOST_WIDE_INT) aoff < align)
                    align = aoff;
                  offset = GEN_INT (ioff);
                  apply_bitpos = bitpos;
                }
            }
-         else if (TREE_CODE (t) == COMPONENT_REF)
+         else if (TREE_CODE (t2) == COMPONENT_REF)
            {
-             expr = component_ref_for_mem_expr (t);
+             expr = component_ref_for_mem_expr (t2);
              if (host_integerp (off_tree, 1))
                {
                  offset = GEN_INT (tree_low_cst (off_tree, 1));
@@ -1978,10 +1984,10 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
                 the size we got from the type?  */
            }
          else if (flag_argument_noalias > 1
-                  && TREE_CODE (t) == INDIRECT_REF
-                  && TREE_CODE (TREE_OPERAND (t, 0)) == PARM_DECL)
+                  && TREE_CODE (t2) == INDIRECT_REF
+                  && TREE_CODE (TREE_OPERAND (t2, 0)) == PARM_DECL)
            {
-             expr = t;
+             expr = t2;
              offset = NULL;
            }
        }
@@ -2241,7 +2247,7 @@ offset_address (rtx memref, rtx offset, unsigned HOST_WIDE_INT pow2)
   new = simplify_gen_binary (PLUS, Pmode, addr, offset);
 
   /* At this point we don't know _why_ the address is invalid.  It
-     could have secondary memory refereces, multiplies or anything.
+     could have secondary memory references, multiplies or anything.
 
      However, if we did go and rearrange things, we can wind up not
      being able to recognize the magic around pic_offset_table_rtx.
@@ -2623,8 +2629,7 @@ copy_most_rtx (rtx orig, rtx may_share)
          break;
 
        case '0':
-         /* Copy this through the wide int field; that's safest.  */
-         X0WINT (copy, i) = X0WINT (orig, i);
+         X0ANY (copy, i) = X0ANY (orig, i);
          break;
 
        default:
@@ -2711,9 +2716,7 @@ copy_rtx_if_shared (rtx orig)
       rtx copy;
 
       copy = rtx_alloc (code);
-      memcpy (copy, x,
-            (sizeof (*copy) - sizeof (copy->fld)
-             + sizeof (copy->fld[0]) * GET_RTX_LENGTH (code)));
+      memcpy (copy, x, RTX_SIZE (code));
       x = copy;
       copied = 1;
     }
@@ -4665,35 +4668,31 @@ emit_barrier (void)
   return barrier;
 }
 
-/* Make an insn of code NOTE
-   with data-fields specified by FILE and LINE
-   and add it to the end of the doubly-linked list,
-   but only if line-numbers are desired for debugging info.  */
+/* Make line numbering NOTE insn for LOCATION add it to the end
+   of the doubly-linked list, but only if line-numbers are desired for
+   debugging info and it doesn't match the previous one.  */
 
 rtx
-emit_line_note (const char *file, int line)
+emit_line_note (location_t location)
 {
   rtx note;
-
-  if (line < 0)
-    abort ();
-
-  set_file_and_line_for_stmt (file, line);
-
-  if (file && last_location.file && !strcmp (file, last_location.file)
-      && line == last_location.line)
+  
+  set_file_and_line_for_stmt (location);
+  
+  if (location.file && last_location.file
+      && !strcmp (location.file, last_location.file)
+      && location.line == last_location.line)
     return NULL_RTX;
-  last_location.file = file;
-  last_location.line = line;
-
+  last_location = location;
+  
   if (no_line_numbers)
     {
       cur_insn_uid++;
       return NULL_RTX;
     }
 
-  note = emit_note (line);
-  NOTE_SOURCE_FILE (note) = file;
+  note = emit_note (location.line);
+  NOTE_SOURCE_FILE (note) = location.file;
   
   return note;
 }
@@ -4733,23 +4732,14 @@ emit_note (int note_no)
   note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
   NOTE_LINE_NUMBER (note) = note_no;
-  NOTE_DATA (note) = 0;
+  memset (&NOTE_DATA (note), 0, sizeof (NOTE_DATA (note)));
   BLOCK_FOR_INSN (note) = NULL;
   add_insn (note);
   return note;
 }
 
-/* Emit a NOTE, and don't omit it even if LINE is the previous note.  */
-
-rtx
-emit_line_note_force (const char *file, int line)
-{
-  last_location.line = -1;
-  return emit_line_note (file, line);
-}
-
 /* Cause next statement to emit a line note even if the line number
-   has not changed.  This is used at the beginning of a function.  */
+   has not changed.  */
 
 void
 force_next_line_note (void)
@@ -4884,7 +4874,7 @@ start_sequence (void)
       free_sequence_stack = tem->next;
     }
   else
-    tem = (struct sequence_stack *) ggc_alloc (sizeof (struct sequence_stack));
+    tem = ggc_alloc (sizeof (struct sequence_stack));
 
   tem->next = seq_stack;
   tem->first = first_insn;
@@ -5117,7 +5107,7 @@ copy_insn_1 (rtx orig)
      all fields need copying, and then clear the fields that should
      not be copied.  That is the sensible default behavior, and forces
      us to explicitly document why we are *not* copying a flag.  */
-  memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion));
+  memcpy (copy, orig, RTX_HDR_SIZE);
 
   /* We do not copy the USED flag, which is used as a mark bit during
      walks over the RTL.  */
@@ -5135,7 +5125,7 @@ copy_insn_1 (rtx orig)
 
   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
     {
-      copy->fld[i] = orig->fld[i];
+      copy->u.fld[i] = orig->u.fld[i];
       switch (*format_ptr++)
        {
        case 'e':
@@ -5215,7 +5205,7 @@ init_emit (void)
 {
   struct function *f = cfun;
 
-  f->emit = (struct emit_status *) ggc_alloc (sizeof (struct emit_status));
+  f->emit = ggc_alloc (sizeof (struct emit_status));
   first_insn = NULL;
   last_insn = NULL;
   seq_rtl_expr = NULL;
@@ -5232,11 +5222,11 @@ init_emit (void)
   f->emit->regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101;
 
   f->emit->regno_pointer_align
-    = (unsigned char *) ggc_alloc_cleared (f->emit->regno_pointer_align_length
-                                          * sizeof (unsigned char));
+    = ggc_alloc_cleared (f->emit->regno_pointer_align_length
+                        * sizeof (unsigned char));
 
   regno_reg_rtx
-    = (rtx *) ggc_alloc (f->emit->regno_pointer_align_length * sizeof (rtx));
+    = ggc_alloc (f->emit->regno_pointer_align_length * sizeof (rtx));
 
   /* Put copies of all the hard registers into regno_reg_rtx.  */
   memcpy (regno_reg_rtx,
@@ -5327,6 +5317,9 @@ init_emit_once (int line_numbers)
   enum machine_mode mode;
   enum machine_mode double_mode;
 
+  /* We need reg_raw_mode, so initialize the modes now.  */
+  init_reg_modes_once ();
+
   /* Initialize the CONST_INT, CONST_DOUBLE, and memory attribute hash
      tables.  */
   const_int_htab = htab_create_ggc (37, const_int_htab_hash,
@@ -5423,13 +5416,24 @@ init_emit_once (int line_numbers)
   REAL_VALUE_FROM_INT (dconst0,   0,  0, double_mode);
   REAL_VALUE_FROM_INT (dconst1,   1,  0, double_mode);
   REAL_VALUE_FROM_INT (dconst2,   2,  0, double_mode);
+  REAL_VALUE_FROM_INT (dconst3,   3,  0, double_mode);
+  REAL_VALUE_FROM_INT (dconst10, 10,  0, double_mode);
   REAL_VALUE_FROM_INT (dconstm1, -1, -1, double_mode);
   REAL_VALUE_FROM_INT (dconstm2, -2, -1, double_mode);
 
   dconsthalf = dconst1;
   dconsthalf.exp--;
 
-  for (i = 0; i <= 2; i++)
+  real_arithmetic (&dconstthird, RDIV_EXPR, &dconst1, &dconst3);
+
+  /* Initialize mathematical constants for constant folding builtins.
+     These constants need to be given to at least 160 bits precision.  */
+  real_from_string (&dconstpi,
+    "3.1415926535897932384626433832795028841971693993751058209749445923078");
+  real_from_string (&dconste,
+    "2.7182818284590452353602874713526624977572470936999595749669676277241");
+
+  for (i = 0; i < (int) ARRAY_SIZE (const_tiny_rtx); i++)
     {
       REAL_VALUE_TYPE *r =
        (i == 0 ? &dconst0 : i == 1 ? &dconst1 : &dconst2);
@@ -5474,23 +5478,6 @@ init_emit_once (int line_numbers)
     = gen_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM);
 #endif
 
-#ifdef STRUCT_VALUE
-  struct_value_rtx = STRUCT_VALUE;
-#else
-  struct_value_rtx = gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM);
-#endif
-
-#ifdef STRUCT_VALUE_INCOMING
-  struct_value_incoming_rtx = STRUCT_VALUE_INCOMING;
-#else
-#ifdef STRUCT_VALUE_INCOMING_REGNUM
-  struct_value_incoming_rtx
-    = gen_rtx_REG (Pmode, STRUCT_VALUE_INCOMING_REGNUM);
-#else
-  struct_value_incoming_rtx = struct_value_rtx;
-#endif
-#endif
-
 #ifdef STATIC_CHAIN_REGNUM
   static_chain_rtx = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);