OSDN Git Service

2005-06-28 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / emit-rtl.c
index 793e2df..1c39535 100644 (file)
@@ -1,6 +1,6 @@
 /* Emit RTL for the GCC expander.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -16,8 +16,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 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.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 
 /* Middle-to-low level generation of rtx code and insns.
@@ -1330,9 +1330,10 @@ operand_subword (rtx op, unsigned int offset, int validate_address, enum machine
   return simplify_gen_subreg (word_mode, op, mode, (offset * UNITS_PER_WORD));
 }
 
-/* Similar to `operand_subword', but never return 0.  If we can't extract
-   the required subword, put OP into a register and try again.  If that fails,
-   abort.  We always validate the address in this case.
+/* Similar to `operand_subword', but never return 0.  If we can't
+   extract the required subword, put OP into a register and try again.
+   The second attempt must succeed.  We always validate the address in
+   this case.
 
    MODE is the mode of OP, in case it is CONST_INT.  */
 
@@ -1360,38 +1361,6 @@ operand_subword_force (rtx op, unsigned int offset, enum machine_mode mode)
   return result;
 }
 \f
-/* Given a compare instruction, swap the operands.
-   A test instruction is changed into a compare of 0 against the operand.  */
-
-void
-reverse_comparison (rtx insn)
-{
-  rtx body = PATTERN (insn);
-  rtx comp;
-
-  if (GET_CODE (body) == SET)
-    comp = SET_SRC (body);
-  else
-    comp = SET_SRC (XVECEXP (body, 0, 0));
-
-  if (GET_CODE (comp) == COMPARE)
-    {
-      rtx op0 = XEXP (comp, 0);
-      rtx op1 = XEXP (comp, 1);
-      XEXP (comp, 0) = op1;
-      XEXP (comp, 1) = op0;
-    }
-  else
-    {
-      rtx new = gen_rtx_COMPARE (VOIDmode,
-                                CONST0_RTX (GET_MODE (comp)), comp);
-      if (GET_CODE (body) == SET)
-       SET_SRC (body) = new;
-      else
-       SET_SRC (XVECEXP (body, 0, 0)) = new;
-    }
-}
-\f
 /* Within a MEM_EXPR, we care about either (1) a component ref of a decl,
    or (2) a component ref of something variable.  Represent the later with
    a NULL expression.  */
@@ -1533,7 +1502,12 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
       if (base && DECL_P (base)
          && TREE_READONLY (base)
          && (TREE_STATIC (base) || DECL_EXTERNAL (base)))
-       MEM_READONLY_P (ref) = 1;
+       {
+         tree base_type = TREE_TYPE (base);
+         gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type))
+                     || DECL_ARTIFICIAL (base));
+         MEM_READONLY_P (ref) = 1;
+       }
 
       if (TREE_THIS_VOLATILE (t))
        MEM_VOLATILE_P (ref) = 1;
@@ -1605,8 +1579,8 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
                 index, then convert to sizetype and multiply by the size of
                 the array element.  */
              if (! integer_zerop (low_bound))
-               index = fold (build2 (MINUS_EXPR, TREE_TYPE (index),
-                                     index, low_bound));
+               index = fold_build2 (MINUS_EXPR, TREE_TYPE (index),
+                                    index, low_bound);
 
              off_tree = size_binop (PLUS_EXPR,
                                     size_binop (MULT_EXPR, convert (sizetype,
@@ -2723,7 +2697,7 @@ get_first_nonnote_insn (void)
          continue;
       else
        {
-         if (GET_CODE (insn) == INSN
+         if (NONJUMP_INSN_P (insn)
              && GET_CODE (PATTERN (insn)) == SEQUENCE)
            insn = XVECEXP (PATTERN (insn), 0, 0);
        }
@@ -2749,7 +2723,7 @@ get_last_nonnote_insn (void)
          continue;
       else
        {
-         if (GET_CODE (insn) == INSN
+         if (NONJUMP_INSN_P (insn)
              && GET_CODE (PATTERN (insn)) == SEQUENCE)
            insn = XVECEXP (PATTERN (insn), 0,
                            XVECLEN (PATTERN (insn), 0) - 1);
@@ -3201,7 +3175,6 @@ try_split (rtx pat, rtx trial, int last)
 
        case REG_NORETURN:
        case REG_SETJMP:
-       case REG_ALWAYS_RETURN:
          insn = insn_last;
          while (insn != NULL_RTX)
            {
@@ -3293,7 +3266,7 @@ make_insn_raw (rtx pattern)
          || (GET_CODE (insn) == SET
              && SET_DEST (insn) == pc_rtx)))
     {
-      warning ("ICE: emit_insn used where emit_jump_insn needed:\n");
+      warning (0, "ICE: emit_insn used where emit_jump_insn needed:\n");
       debug_rtx (insn);
     }
 #endif
@@ -3473,7 +3446,7 @@ add_insn_before (rtx insn, rtx before)
       if (INSN_P (insn))
        bb->flags |= BB_DIRTY;
       /* Should not happen as first in the BB is always either NOTE or
-        LABEl.  */
+        LABEL.  */
       gcc_assert (BB_HEAD (bb) != insn
                  /* Avoid clobbering of structure when creating new BB.  */
                  || BARRIER_P (insn)