OSDN Git Service

2006-01-16 Gabor Loki <loki@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / rtl.h
index 333c95d..d076b1d 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1,6 +1,6 @@
 /* Register Transfer Language (RTL) definitions for GCC
    Copyright (C) 1987, 1991, 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,17 +16,16 @@ 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.  */
 
 #ifndef GCC_RTL_H
 #define GCC_RTL_H
-#include "statistics.h"
-
-struct function;
 
+#include "statistics.h"
 #include "machmode.h"
 #include "input.h"
+#include "real.h"
 
 #undef FFS  /* Some systems predefine this symbol; don't let it interfere.  */
 #undef FLOAT /* Likewise.  */
@@ -92,8 +91,6 @@ enum rtx_class  {
 #define RTX_COMMUTATIVE_MASK (~2)
 #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
 #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
-#define RTX_EXPR_FIRST (RTX_COMPARE)
-#define RTX_EXPR_LAST (RTX_UNARY)
 
 extern const unsigned char rtx_length[NUM_RTX_CODE];
 #define GET_RTX_LENGTH(CODE)           (rtx_length[(int) (CODE)])
@@ -161,19 +158,19 @@ typedef struct reg_attrs GTY(())
 
 union rtunion_def
 {
-  int rtint;
-  unsigned int rtuint;
-  const char *rtstr;
-  rtx rtx;
-  rtvec rtvec;
-  enum machine_mode rttype;
+  int rt_int;
+  unsigned int rt_uint;
+  const char *rt_str;
+  rtx rt_rtx;
+  rtvec rt_rtvec;
+  enum machine_mode rt_type;
   addr_diff_vec_flags rt_addr_diff_vec_flags;
   struct cselib_val_struct *rt_cselib;
-  struct bitmap_head_def *rtbit;
-  tree rttree;
-  struct basic_block_def *bb;
-  mem_attrs *rtmem;
-  reg_attrs *rtreg;
+  struct bitmap_head_def *rt_bit;
+  tree rt_tree;
+  struct basic_block_def *rt_bb;
+  mem_attrs *rt_mem;
+  reg_attrs *rt_reg;
 };
 typedef union rtunion_def rtunion;
 
@@ -222,16 +219,11 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
      promoted mode.
      1 in a CODE_LABEL if the label is used for nonlocal gotos
      and must not be deleted even if its count is zero.
-     1 in a LABEL_REF if this is a reference to a label outside the
-     current loop.
      1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
      together with the preceding insn.  Valid only within sched.
      1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
      from the target of a branch.  Valid from reorg until end of compilation;
-     cleared before used.
-     1 in an INSN, JUMP_INSN or CALL_INSN or related rtx if this insn is
-     dead code.  Valid only during dead-code elimination phase; cleared
-     before use.  */
+     cleared before used.  */
   unsigned int in_struct : 1;
   /* At the end of RTL generation, 1 if this rtx is used.  This is used for
      copying shared structure.  See `unshare_all_rtl'.
@@ -240,10 +232,6 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
      1 in a SYMBOL_REF, means that emit_library_call
      has used it as the function.  */
   unsigned int used : 1;
-  /* FIXME.  This should be unused now that we do inlinining on trees,
-     but it is now being used for MEM_SCALAR_P.  It should be renamed,
-     or some other field should be overloaded.  */
-  unsigned integrated : 1;
   /* 1 in an INSN or a SET if this rtx is related to the call frame,
      either changing how we compute the frame address or saving and
      restoring registers in the prologue and epilogue.
@@ -252,6 +240,7 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
      constant string pool.  */
   unsigned frame_related : 1;
   /* 1 in a REG or PARALLEL that is the current function's return value.
+     1 in a MEM if it refers to a scalar.
      1 in a SYMBOL_REF for a weak symbol.  */
   unsigned return_val : 1;
 
@@ -261,6 +250,7 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
   union u {
     rtunion fld[1];
     HOST_WIDE_INT hwint[1];
+    struct real_value rv;
   } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
 };
 
@@ -279,12 +269,10 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
 
 /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
  */
-#define RTX_PREV(X) ((GET_CODE (X) == INSN              \
-                      || GET_CODE (X) == CALL_INSN      \
-                      || GET_CODE (X) == JUMP_INSN      \
-                      || GET_CODE (X) == NOTE           \
-                      || GET_CODE (X) == BARRIER        \
-                      || GET_CODE (X) == CODE_LABEL)    \
+#define RTX_PREV(X) ((INSN_P (X)                               \
+                      || NOTE_P (X)                    \
+                      || BARRIER_P (X)                 \
+                      || LABEL_P (X))                  \
                      && PREV_INSN (X) != NULL           \
                      && NEXT_INSN (PREV_INSN (X)) == X  \
                      ? PREV_INSN (X) : NULL)
@@ -394,8 +382,7 @@ struct rtvec_def GTY(()) {
 /* 1 if X is a constant value that is an integer.  */
 
 #define CONSTANT_P(X)   \
-  (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ                       \
-   || GET_CODE (X) == CONST_VECTOR)
+  (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
 
 /* 1 if X can be used to represent an object.  */
 #define OBJECT_P(X)                                                    \
@@ -469,6 +456,20 @@ struct rtvec_def GTY(()) {
                               __FUNCTION__);                           \
      &_rtx->u.hwint[N]; }))
 
+#define XCMWINT(RTX, N, C, M) __extension__                            \
+(*({ rtx const _rtx = (RTX);                                           \
+     if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M))             \
+       rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__,    \
+                                  __LINE__, __FUNCTION__);             \
+     &_rtx->u.hwint[N]; }))
+
+#define XCNMPRV(RTX, C, M) __extension__                               \
+({ rtx const _rtx = (RTX);                                             \
+   if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M))               \
+     rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__,       \
+                                __LINE__, __FUNCTION__);               \
+   &_rtx->u.rv; })
+
 extern void rtl_check_failed_bounds (rtx, int, const char *, int,
                                     const char *)
     ATTRIBUTE_NORETURN;
@@ -484,6 +485,9 @@ extern void rtl_check_failed_code1 (rtx, enum rtx_code, const char *,
 extern void rtl_check_failed_code2 (rtx, enum rtx_code, enum rtx_code,
                                    const char *, int, const char *)
     ATTRIBUTE_NORETURN;
+extern void rtl_check_failed_code_mode (rtx, enum rtx_code, enum machine_mode,
+                                       bool, const char *, int, const char *)
+    ATTRIBUTE_NORETURN;
 extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
                                       const char *)
     ATTRIBUTE_NORETURN;
@@ -497,6 +501,9 @@ extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
 #define RTVEC_ELT(RTVEC, I)        ((RTVEC)->elem[I])
 #define XWINT(RTX, N)              ((RTX)->u.hwint[N])
 #define XCWINT(RTX, N, C)          ((RTX)->u.hwint[N])
+#define XCMWINT(RTX, N, C, M)      ((RTX)->u.hwint[N])
+#define XCNMWINT(RTX, N, C, M)     ((RTX)->u.hwint[N])
+#define XCNMPRV(RTX, C, M)         (&(RTX)->u.rv)
 
 #endif
 
@@ -594,28 +601,15 @@ extern void rtl_check_failed_flag (const char *, rtx, const char *,
 #define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8)     (RTX)
 #endif
 
-#define CLEAR_RTX_FLAGS(RTX)   \
-do {                           \
-  rtx const _rtx = (RTX);      \
-  _rtx->call = 0;              \
-  _rtx->frame_related = 0;     \
-  _rtx->in_struct = 0;         \
-  _rtx->jump = 0;              \
-  _rtx->unchanging = 0;                \
-  _rtx->used = 0;              \
-  _rtx->volatil = 0;           \
-  _rtx->unused_flag = 0;       \
-} while (0)
-
-#define XINT(RTX, N)   (RTL_CHECK2 (RTX, N, 'i', 'n').rtint)
-#define XSTR(RTX, N)   (RTL_CHECK2 (RTX, N, 's', 'S').rtstr)
-#define XEXP(RTX, N)   (RTL_CHECK2 (RTX, N, 'e', 'u').rtx)
-#define XVEC(RTX, N)   (RTL_CHECK2 (RTX, N, 'E', 'V').rtvec)
-#define XMODE(RTX, N)  (RTL_CHECK1 (RTX, N, 'M').rttype)
-#define XBITMAP(RTX, N) (RTL_CHECK1 (RTX, N, 'b').rtbit)
-#define XTREE(RTX, N)   (RTL_CHECK1 (RTX, N, 't').rttree)
-#define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').bb)
-#define XTMPL(RTX, N)  (RTL_CHECK1 (RTX, N, 'T').rtstr)
+#define XINT(RTX, N)   (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
+#define XSTR(RTX, N)   (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
+#define XEXP(RTX, N)   (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
+#define XVEC(RTX, N)   (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
+#define XMODE(RTX, N)  (RTL_CHECK1 (RTX, N, 'M').rt_type)
+#define XBITMAP(RTX, N) (RTL_CHECK1 (RTX, N, 'b').rt_bit)
+#define XTREE(RTX, N)   (RTL_CHECK1 (RTX, N, 't').rt_tree)
+#define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
+#define XTMPL(RTX, N)  (RTL_CHECK1 (RTX, N, 'T').rt_str)
 
 #define XVECEXP(RTX, N, M)     RTVEC_ELT (XVEC (RTX, N), M)
 #define XVECLEN(RTX, N)                GET_NUM_ELEM (XVEC (RTX, N))
@@ -623,39 +617,38 @@ do {                              \
 /* These are like XINT, etc. except that they expect a '0' field instead
    of the normal type code.  */
 
-#define X0INT(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rtint)
-#define X0UINT(RTX, N)    (RTL_CHECK1 (RTX, N, '0').rtuint)
-#define X0STR(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rtstr)
-#define X0EXP(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rtx)
-#define X0VEC(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rtvec)
-#define X0MODE(RTX, N)    (RTL_CHECK1 (RTX, N, '0').rttype)
-#define X0BITMAP(RTX, N)   (RTL_CHECK1 (RTX, N, '0').rtbit)
-#define X0TREE(RTX, N)    (RTL_CHECK1 (RTX, N, '0').rttree)
-#define X0BBDEF(RTX, N)           (RTL_CHECK1 (RTX, N, '0').bb)
+#define X0INT(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rt_int)
+#define X0UINT(RTX, N)    (RTL_CHECK1 (RTX, N, '0').rt_uint)
+#define X0STR(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rt_str)
+#define X0EXP(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rt_rtx)
+#define X0VEC(RTX, N)     (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
+#define X0MODE(RTX, N)    (RTL_CHECK1 (RTX, N, '0').rt_type)
+#define X0BITMAP(RTX, N)   (RTL_CHECK1 (RTX, N, '0').rt_bit)
+#define X0TREE(RTX, N)    (RTL_CHECK1 (RTX, N, '0').rt_tree)
+#define X0BBDEF(RTX, N)           (RTL_CHECK1 (RTX, N, '0').rt_bb)
 #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
 #define X0CSELIB(RTX, N)   (RTL_CHECK1 (RTX, N, '0').rt_cselib)
-#define X0MEMATTR(RTX, N)  (RTL_CHECKC1 (RTX, N, MEM).rtmem)
-#define X0REGATTR(RTX, N)  (RTL_CHECKC1 (RTX, N, REG).rtreg)
+#define X0MEMATTR(RTX, N)  (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
+#define X0REGATTR(RTX, N)  (RTL_CHECKC1 (RTX, N, REG).rt_reg)
 
 /* Access a '0' field with any type.  */
 #define X0ANY(RTX, N)     RTL_CHECK1 (RTX, N, '0')
 
-#define XCINT(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rtint)
-#define XCUINT(RTX, N, C)     (RTL_CHECKC1 (RTX, N, C).rtuint)
-#define XCSTR(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rtstr)
-#define XCEXP(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rtx)
-#define XCVEC(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rtvec)
-#define XCMODE(RTX, N, C)     (RTL_CHECKC1 (RTX, N, C).rttype)
-#define XCBITMAP(RTX, N, C)   (RTL_CHECKC1 (RTX, N, C).rtbit)
-#define XCTREE(RTX, N, C)     (RTL_CHECKC1 (RTX, N, C).rttree)
-#define XCBBDEF(RTX, N, C)    (RTL_CHECKC1 (RTX, N, C).bb)
-#define XCADVFLAGS(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_addr_diff_vec_flags)
+#define XCINT(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rt_int)
+#define XCUINT(RTX, N, C)     (RTL_CHECKC1 (RTX, N, C).rt_uint)
+#define XCSTR(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rt_str)
+#define XCEXP(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rt_rtx)
+#define XCVEC(RTX, N, C)      (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
+#define XCMODE(RTX, N, C)     (RTL_CHECKC1 (RTX, N, C).rt_type)
+#define XCBITMAP(RTX, N, C)   (RTL_CHECKC1 (RTX, N, C).rt_bit)
+#define XCTREE(RTX, N, C)     (RTL_CHECKC1 (RTX, N, C).rt_tree)
+#define XCBBDEF(RTX, N, C)    (RTL_CHECKC1 (RTX, N, C).rt_bb)
 #define XCCSELIB(RTX, N, C)   (RTL_CHECKC1 (RTX, N, C).rt_cselib)
 
 #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
 #define XCVECLEN(RTX, N, C)    GET_NUM_ELEM (XCVEC (RTX, N, C))
 
-#define XC2EXP(RTX, N, C1, C2)      (RTL_CHECKC2 (RTX, N, C1, C2).rtx)
+#define XC2EXP(RTX, N, C1, C2)      (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
 \f
 /* ACCESS MACROS for particular fields of insns.  */
 
@@ -683,8 +676,6 @@ do {                                \
    They are always in the same basic block as this insn.  */
 #define LOG_LINKS(INSN)        XEXP(INSN, 7)
 
-#define RTX_UNCHANGING_P(RTX)                                          \
-  (RTL_FLAG_CHECK3("RTX_UNCHANGING_P", (RTX), REG, MEM, CONCAT)->unchanging)
 #define RTX_FRAME_RELATED_P(RTX)                                       \
   (RTL_FLAG_CHECK5("RTX_FRAME_RELATED_P", (RTX), INSN, CALL_INSN,      \
                   JUMP_INSN, BARRIER, SET)->frame_related)
@@ -707,11 +698,6 @@ do {                               \
 #define INSN_ANNULLED_BRANCH_P(RTX)                                    \
   (RTL_FLAG_CHECK3("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN, CALL_INSN, INSN)->unchanging)
 
-/* 1 if RTX is an insn that is dead code.  Valid only for dead-code
-   elimination phase.  */
-#define INSN_DEAD_CODE_P(RTX)                                          \
-  (RTL_FLAG_CHECK3("INSN_DEAD_CODE_P", (RTX), INSN, CALL_INSN, JUMP_INSN)->in_struct)
-
 /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
    If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
    executed if the branch is taken.  For annulled branches with this bit
@@ -719,8 +705,12 @@ do {                               \
 #define INSN_FROM_TARGET_P(RTX)                                                \
   (RTL_FLAG_CHECK3("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, CALL_INSN)->in_struct)
 
+/* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
+   See the comments for ADDR_DIFF_VEC in rtl.def.  */
 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS(RTX, 4)
 
+/* In a VALUE, the value cselib has assigned to RTX.
+   This is a "struct cselib_val_struct", see cselib.h.  */
 #define CSELIB_VAL_PTR(RTX) X0CSELIB(RTX, 0)
 
 /* Holds a list of notes on what this insn does to various REGs.
@@ -728,158 +718,16 @@ do {                             \
    chain pointer and the first operand is the REG being described.
    The mode field of the EXPR_LIST contains not a real machine mode
    but a value from enum reg_note.  */
-
 #define REG_NOTES(INSN)        XEXP(INSN, 8)
 
-/* Don't forget to change reg_note_name in rtl.c.  */
 enum reg_note
 {
-  /* The value in REG dies in this insn (i.e., it is not needed past
-     this insn).  If REG is set in this insn, the REG_DEAD note may,
-     but need not, be omitted.  */
-  REG_DEAD = 1,
-
-  /* The REG is autoincremented or autodecremented.  */
-  REG_INC,
-
-  /* Describes the insn as a whole; it says that the insn sets a register
-     to a constant value or to be equivalent to a memory address.  If the
-     register is spilled to the stack then the constant value should be
-     substituted for it.  The contents of the REG_EQUIV is the constant
-     value or memory address, which may be different from the source of
-     the SET although it has the same value.  A REG_EQUIV note may also
-     appear on an insn which copies a register parameter to a pseudo-register,
-     if there is a memory address which could be used to hold that
-     pseudo-register throughout the function.  */
-  REG_EQUIV,
-
-  /* Like REG_EQUIV except that the destination is only momentarily equal
-     to the specified rtx.  Therefore, it cannot be used for substitution;
-     but it can be used for cse.  */
-  REG_EQUAL,
-
-  /* This insn copies the return-value of a library call out of the hard reg
-     for return values.  This note is actually an INSN_LIST and it points to
-     the first insn involved in setting up arguments for the call.  flow.c
-     uses this to delete the entire library call when its result is dead.  */
-  REG_RETVAL,
-
-  /* The inverse of REG_RETVAL: it goes on the first insn of the library call
-     and points at the one that has the REG_RETVAL.  This note is also an
-     INSN_LIST.  */
-  REG_LIBCALL,
-
-  /* The register is always nonnegative during the containing loop.  This is
-     used in branches so that decrement and branch instructions terminating
-     on zero can be matched.  There must be an insn pattern in the md file
-     named `decrement_and_branch_until_zero' or else this will never be added
-     to any instructions.  */
-  REG_NONNEG,
-
-  /* There is no conflict *after this insn* between the register in the note
-     and the destination of this insn.  */
-  REG_NO_CONFLICT,
-
-  /* Identifies a register set in this insn and never used.  */
-  REG_UNUSED,
-
-  /* REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use CC0,
-     respectively.  Normally, these are required to be consecutive insns, but
-     we permit putting a cc0-setting insn in the delay slot of a branch as
-     long as only one copy of the insn exists.  In that case, these notes
-     point from one to the other to allow code generation to determine what
-     any require information and to properly update CC_STATUS.  These notes
-     are INSN_LISTs.  */
-  REG_CC_SETTER, REG_CC_USER,
-
-  /* Points to a CODE_LABEL.  Used by non-JUMP_INSNs to say that the
-     CODE_LABEL contained in the REG_LABEL note is used by the insn.
-     This note is an INSN_LIST.  */
-  REG_LABEL,
-
-  /* REG_DEP_ANTI and REG_DEP_OUTPUT are used in LOG_LINKS to represent
-     write-after-read and write-after-write dependencies respectively.
-     Data dependencies, which are the only type of LOG_LINK created by
-     flow, are represented by a 0 reg note kind.  */
-  REG_DEP_ANTI, REG_DEP_OUTPUT,
-
-  /* REG_BR_PROB is attached to JUMP_INSNs and CALL_INSNs.
-     It has an integer value.  For jumps, it is the probability that this is a
-     taken branch.  For calls, it is the probability that this call won't
-     return.  */
-  REG_BR_PROB,
-
-  /* REG_VALUE_PROFILE is attached when the profile is read in to an insn
-     before that the code to profile the value is inserted.  It contains
-     the results of profiling.  */
-  REG_VALUE_PROFILE,
-
-  /* Attached to a call insn; indicates that the call is malloc-like and
-     that the pointer returned cannot alias anything else.  */
-  REG_NOALIAS,
-
-  /* Used to optimize rtl generated by dynamic stack allocations for targets
-     where SETJMP_VIA_SAVE_AREA is true.  */
-  REG_SAVE_AREA,
-
-  /* REG_BR_PRED is attached to JUMP_INSNs and CALL_INSNSs.  It contains
-     CONCAT of two integer value.  First specifies the branch predictor
-     that added the note, second specifies the predicted hitrate of branch
-     in the same format as REG_BR_PROB note uses.  */
-  REG_BR_PRED,
-
-  /* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex
-     for DWARF to interpret what they imply.  The attached rtx is used
-     instead of intuition.  */
-  REG_FRAME_RELATED_EXPR,
-
-  /* Indicates that REG holds the exception context for the function.
-     This context is shared by inline functions, so the code to acquire
-     the real exception context is delayed until after inlining.  */
-  REG_EH_CONTEXT,
-
-  /* Indicates what exception region an INSN belongs in.  This is used to
-     indicate what region to which a call may throw.  REGION 0 indicates
-     that a call cannot throw at all.  REGION -1 indicates that it cannot
-     throw, nor will it execute a non-local goto.  */
-  REG_EH_REGION,
-
-  /* Used by haifa-sched to save NOTE_INSN notes across scheduling.  */
-  REG_SAVE_NOTE,
-
-  /* Indicates that this insn (which is part of the prologue) computes
-     a value which might not be used later, and if so it's OK to delete
-     the insn.  Normally, deleting any insn in the prologue is an error.
-     At present the parameter is unused and set to (const_int 0).  */
-  REG_MAYBE_DEAD,
-
-  /* Indicates that a call does not return.  */
-  REG_NORETURN,
-
-  /* Indicates that an indirect jump is a non-local goto instead of a
-     computed goto.  */
-  REG_NON_LOCAL_GOTO,
-
-  /* Indicates that a jump crosses between hot and cold sections
-     in a (partitioned) assembly or .o file, and therefore should not be
-     reduced to a simpler jump by optimizations.  */
-  REG_CROSSING_JUMP,
-
-  /* This kind of note is generated at each to `setjmp',
-     and similar functions that can return twice.  */
-  REG_SETJMP,
-
-  /* Indicate calls that always returns.  */
-  REG_ALWAYS_RETURN,
-
-  /* Indicate that the memory load references a vtable.  The expression
-     is of the form (plus (symbol_ref vtable_sym) (const_int offset)).  */
-  REG_VTABLE_REF
+#define DEF_REG_NOTE(NAME) NAME,
+#include "reg-notes.def"
+#undef DEF_REG_NOTE
+  REG_NOTE_MAX
 };
 
-/* The base value for branch probability notes.  */
-#define REG_BR_PROB_BASE  10000
-
 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST.  */
 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
 #define PUT_REG_NOTE_KIND(LINK, KIND) \
@@ -904,8 +752,6 @@ extern const char * const reg_note_name[];
    Label numbers are unique in a compilation.  */
 #define CODE_LABEL_NUMBER(INSN)        XINT (INSN, 6)
 
-#define LINE_NUMBER NOTE
-
 /* In a NOTE that is a line number, this is a string for the file name that the
    line is in.  We use the same field to record block numbers temporarily in
    NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes.  (We avoid lots of casts
@@ -914,13 +760,26 @@ extern const char * const reg_note_name[];
 
 /* Opaque data.  */
 #define NOTE_DATA(INSN)                RTL_CHECKC1 (INSN, 4, NOTE)
+#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
+#ifdef USE_MAPPED_LOCATION
+#define NOTE_SOURCE_LOCATION(INSN) XCUINT (INSN, 5, NOTE)
+#define NOTE_EXPANDED_LOCATION(XLOC, INSN)     \
+  (XLOC) = expand_location (NOTE_SOURCE_LOCATION (INSN))
+#define SET_INSN_DELETED(INSN) \
+  (PUT_CODE (INSN, NOTE), NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
+#else
+#define NOTE_EXPANDED_LOCATION(XLOC, INSN)     \
+  ((XLOC).file = NOTE_SOURCE_FILE (INSN),      \
+   (XLOC).line = NOTE_LINE_NUMBER (INSN))
 #define NOTE_SOURCE_FILE(INSN) XCSTR (INSN, 4, NOTE)
+#define SET_INSN_DELETED(INSN) \
+  (PUT_CODE (INSN, NOTE),  NOTE_SOURCE_FILE (INSN) = 0, \
+   NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
+#endif
 #define NOTE_BLOCK(INSN)       XCTREE (INSN, 4, NOTE)
 #define NOTE_EH_HANDLER(INSN)  XCINT (INSN, 4, NOTE)
 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 4, NOTE)
 #define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 4, NOTE)
-#define NOTE_PREDICTION(INSN)   XCINT (INSN, 4, NOTE)
-#define NOTE_PRECONDITIONED(INSN)   XCINT (INSN, 4, NOTE)
 #define NOTE_VAR_LOCATION(INSN)        XCEXP (INSN, 4, NOTE)
 
 /* In a NOTE that is a line number, this is the line number.
@@ -932,106 +791,29 @@ extern const char * const reg_note_name[];
   (GET_CODE (INSN) == NOTE                             \
    && NOTE_LINE_NUMBER (INSN) == NOTE_INSN_BASIC_BLOCK)
 
-/* Algorithm and flags for prediction.  */
-#define NOTE_PREDICTION_ALG(INSN)   (XCINT(INSN, 4, NOTE)>>8)
-#define NOTE_PREDICTION_FLAGS(INSN) (XCINT(INSN, 4, NOTE)&0xff)
-#define NOTE_PREDICT(ALG,FLAGS)     ((ALG<<8)+(FLAGS))
-
 /* Variable declaration and the location of a variable.  */
 #define NOTE_VAR_LOCATION_DECL(INSN)   (XCTREE (XCEXP (INSN, 4, NOTE), \
                                                 0, VAR_LOCATION))
 #define NOTE_VAR_LOCATION_LOC(INSN)    (XCEXP (XCEXP (INSN, 4, NOTE),  \
                                                1, VAR_LOCATION))
-  
-/* Codes that appear in the NOTE_LINE_NUMBER field
-   for kinds of notes that are not line numbers.
 
+/* Codes that appear in the NOTE_LINE_NUMBER field for kinds of notes
+   that are not line numbers.  These codes are all negative.
+   
    Notice that we do not try to use zero here for any of
    the special note codes because sometimes the source line
    actually can be zero!  This happens (for example) when we
    are generating code for the per-translation-unit constructor
-   and destructor routines for some C++ translation unit.
-
-   If you should change any of the following values, or if you
-   should add a new value here, don't forget to change the
-   note_insn_name array in rtl.c.  */
+   and destructor routines for some C++ translation unit.  */
 
 enum insn_note
 {
   /* Keep all of these numbers negative.  Adjust as needed.  */
   NOTE_INSN_BIAS = -100,
 
-  /* This note is used to get rid of an insn
-     when it isn't safe to patch the insn out of the chain.  */
-  NOTE_INSN_DELETED,
-
-  /* These are used to mark the beginning and end of a lexical block.
-     See NOTE_BLOCK, identify_blocks and reorder_blocks.  */
-  NOTE_INSN_BLOCK_BEG,
-  NOTE_INSN_BLOCK_END,
-
-  /* These mark the extremes of a loop.  */
-  NOTE_INSN_LOOP_BEG,
-  NOTE_INSN_LOOP_END,
-
-  /* Generated at the place in a loop that `continue' jumps to.  */
-  NOTE_INSN_LOOP_CONT,
-  /* Generated at the start of a duplicated exit test.  */
-  NOTE_INSN_LOOP_VTOP,
-
-  /* Generated at the end of a conditional at the top of the loop.
-     This is used to perform a lame form of loop rotation in lieu
-     of actually understanding the loop structure.  The note is
-     discarded after rotation is complete.  */
-  NOTE_INSN_LOOP_END_TOP_COND,
-
-  /* This kind of note is generated at the end of the function body,
-     just before the return insn or return label.  In an optimizing
-     compilation it is deleted by the first jump optimization, after
-     enabling that optimizer to determine whether control can fall
-     off the end of the function body without a return statement.  */
-  NOTE_INSN_FUNCTION_END,
-
-  /* This marks the point immediately after the last prologue insn.  */
-  NOTE_INSN_PROLOGUE_END,
-
-  /* This marks the point immediately prior to the first epilogue insn.  */
-  NOTE_INSN_EPILOGUE_BEG,
-
-  /* Generated in place of user-declared labels when they are deleted.  */
-  NOTE_INSN_DELETED_LABEL,
-
-  /* This note indicates the start of the real body of the function,
-     i.e. the point just after all of the parms have been moved into
-     their homes, etc.  */
-  NOTE_INSN_FUNCTION_BEG,
-
-  /* These note where exception handling regions begin and end.
-     Uses NOTE_EH_HANDLER to identify the region in question.  */
-  NOTE_INSN_EH_REGION_BEG,
-  NOTE_INSN_EH_REGION_END,
-
-  /* Generated whenever a duplicate line number note is output.  For example,
-     one is output after the end of an inline function, in order to prevent
-     the line containing the inline call from being counted twice in gcov.  */
-  NOTE_INSN_REPEATED_LINE_NUMBER,
-
-  /* Record the struct for the following basic block.  Uses NOTE_BASIC_BLOCK.  */
-  NOTE_INSN_BASIC_BLOCK,
-
-  /* Record the expected value of a register at a location.  Uses
-     NOTE_EXPECTED_VALUE; stored as (eq (reg) (const_int)).  */
-  NOTE_INSN_EXPECTED_VALUE,
-
-  /* Record a prediction.  Uses NOTE_PREDICTION.  */
-  NOTE_INSN_PREDICTION,
-
-  /* Record that the current basic block is unlikely to be executed and
-     should be moved to the UNLIKELY_EXECUTED_TEXT_SECTION.  */
-  NOTE_INSN_UNLIKELY_EXECUTED_CODE,
-
-  /* The location of a variable.  */
-  NOTE_INSN_VAR_LOCATION,
+#define DEF_INSN_NOTE(NAME) NAME,
+#include "insn-notes.def"
+#undef DEF_INSN_NOTE
 
   NOTE_INSN_MAX
 };
@@ -1100,12 +882,6 @@ enum label_kind
 
 #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
 
-/* The original regno this ADDRESSOF was built for.  */
-#define ADDRESSOF_REGNO(RTX) XCUINT (RTX, 1, ADDRESSOF)
-
-/* The variable in the register we took the address of.  */
-#define ADDRESSOF_DECL(RTX) XCTREE (RTX, 2, ADDRESSOF)
-
 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
    so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
    be decremented and possibly the label can be deleted.  */
@@ -1119,15 +895,11 @@ enum label_kind
 \f
 /* This is the field in the LABEL_REF through which the circular chain
    of references to a particular label is linked.
-   This chain is set up in flow.c.  */
-
+   FIXME: This chain is used in loop.c and in the SH backend.
+         Since loop.c is about to go away, it could be a win to replace
+         the uses of this in the SH backend with something else.  */
 #define LABEL_NEXTREF(REF) XCEXP (REF, 1, LABEL_REF)
 
-/* Once basic blocks are found in flow.c,
-   Each LABEL_REF points to its containing instruction with this field.  */
-
-#define CONTAINING_INSN(RTX) XCEXP (RTX, 2, LABEL_REF)
-
 /* For a REG rtx, REGNO extracts the register number.  ORIGINAL_REGNO holds
    the number the register originally had; for a pseudo register turned into
    a hard reg this will hold the old pseudo register number.  */
@@ -1159,17 +931,17 @@ enum label_kind
 #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
 
 /* For a CONST_INT rtx, INTVAL extracts the integer.  */
-
 #define INTVAL(RTX) XCWINT(RTX, 0, CONST_INT)
 
 /* For a CONST_DOUBLE:
-   For a DImode, there are two integers CONST_DOUBLE_LOW is the
+   For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
      low-order word and ..._HIGH the high-order.
    For a float, there is a REAL_VALUE_TYPE structure, and
      CONST_DOUBLE_REAL_VALUE(r) is a pointer to it.  */
-#define CONST_DOUBLE_LOW(r) XCWINT (r, 0, CONST_DOUBLE)
-#define CONST_DOUBLE_HIGH(r) XCWINT (r, 1, CONST_DOUBLE)
-#define CONST_DOUBLE_REAL_VALUE(r) ((struct real_value *)&CONST_DOUBLE_LOW(r))
+#define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
+#define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
+#define CONST_DOUBLE_REAL_VALUE(r) \
+  ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
 
 /* For a CONST_VECTOR, return element #n.  */
 #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
@@ -1193,6 +965,7 @@ enum label_kind
    not to use an rtx with this cost under any circumstances.  */
 #define MAX_COST INT_MAX
 
+extern void init_rtlanal (void);
 extern int rtx_cost (rtx, enum rtx_code);
 extern int address_cost (rtx, enum machine_mode);
 extern unsigned int subreg_lsb (rtx);
@@ -1247,8 +1020,16 @@ do {                                                                     \
   XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
 #define ASM_OPERANDS_INPUT_MODE(RTX, N)  \
   GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
+#ifdef USE_MAPPED_LOCATION
+#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 5, ASM_OPERANDS)
+#else
 #define ASM_OPERANDS_SOURCE_FILE(RTX) XCSTR (RTX, 5, ASM_OPERANDS)
 #define ASM_OPERANDS_SOURCE_LINE(RTX) XCINT (RTX, 6, ASM_OPERANDS)
+#endif
+
+/* 1 if RTX is a mem that is statically allocated in read-only memory.  */
+#define MEM_READONLY_P(RTX) \
+  (RTL_FLAG_CHECK1("MEM_READONLY_P", (RTX), MEM)->unchanging)
 
 /* 1 if RTX is a mem and we should keep the alias set for this mem
    unchanged when we access a component.  Set to 1, or example, when we
@@ -1262,15 +1043,15 @@ do {                                                                    \
                   ASM_INPUT)->volatil)
 
 /* 1 if RTX is a mem that refers to an aggregate, either to the
-   aggregate itself of to a field of the aggregate.  If zero, RTX may
+   aggregate itself or to a field of the aggregate.  If zero, RTX may
    or may not be such a reference.  */
 #define MEM_IN_STRUCT_P(RTX)                                           \
   (RTL_FLAG_CHECK1("MEM_IN_STRUCT_P", (RTX), MEM)->in_struct)
 
-/* 1 if RTX is a mem that refers to a scalar.  If zero, RTX may or may
+/* 1 if RTX is a MEM that refers to a scalar.  If zero, RTX may or may
    not refer to a scalar.  */
 #define MEM_SCALAR_P(RTX)                                              \
-  (RTL_FLAG_CHECK1("MEM_SCALAR_P", (RTX), MEM)->integrated)
+  (RTL_FLAG_CHECK1("MEM_SCALAR_P", (RTX), MEM)->return_val)
 
 /* 1 if RTX is a mem that cannot trap.  */
 #define MEM_NOTRAP_P(RTX) \
@@ -1346,7 +1127,7 @@ do {                                              \
    MEM_IN_STRUCT_P (LHS) = MEM_IN_STRUCT_P (RHS),              \
    MEM_SCALAR_P (LHS) = MEM_SCALAR_P (RHS),                    \
    MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS),                    \
-   RTX_UNCHANGING_P (LHS) = RTX_UNCHANGING_P (RHS),            \
+   MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS),                        \
    MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS),    \
    MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
 
@@ -1365,10 +1146,6 @@ do {                                             \
 #define LABEL_PRESERVE_P(RTX)                                          \
   (RTL_FLAG_CHECK2("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
 
-/* 1 if RTX is a reg that is used only in an exit test of a loop.  */
-#define REG_LOOP_TEST_P(RTX)                                           \
-  (RTL_FLAG_CHECK1("REG_LOOP_TEST_P", (RTX), REG)->in_struct)
-
 /* During sched, 1 if RTX is an insn that must be scheduled together
    with the preceding insn.  */
 #define SCHED_GROUP_P(RTX)                                             \
@@ -1545,33 +1322,24 @@ do {                                            \
 #define USE_STORE_PRE_DECREMENT(MODE)   HAVE_PRE_DECREMENT
 #endif
 \f
-/* Nonzero if we need to distinguish between the return value of this function
-   and the return value of a function called by this function.  This helps
-   integrate.c.
-   This is 1 until after the rtl generation pass.
-   ??? It appears that this is 1 only when expanding trees to RTL.  */
-extern int rtx_equal_function_value_matters;
-
 /* Nonzero when we are generating CONCATs.  */
 extern int generating_concat_p;
 
+/* Nonzero when we are expanding trees to RTL.  */
+extern int currently_expanding_to_rtl;
+
 /* Generally useful functions.  */
 
 /* In expmed.c */
 extern int ceil_log2 (unsigned HOST_WIDE_INT);
 
-#define plus_constant(X, C) plus_constant_wide ((X), (HOST_WIDE_INT) (C))
-
 /* In builtins.c */
 extern rtx expand_builtin_expect_jump (tree, rtx, rtx);
-extern void purge_builtin_constant_p (void);
 
 /* In explow.c */
 extern void set_stack_check_libfunc (rtx);
 extern HOST_WIDE_INT trunc_int_for_mode        (HOST_WIDE_INT, enum machine_mode);
-extern rtx plus_constant_wide (rtx, HOST_WIDE_INT);
-extern rtx plus_constant_for_output_wide (rtx, HOST_WIDE_INT);
-extern void optimize_save_area_alloca (rtx);
+extern rtx plus_constant (rtx, HOST_WIDE_INT);
 
 /* In emit-rtl.c */
 extern rtvec gen_rtvec (int, ...);
@@ -1582,7 +1350,6 @@ extern rtx emit_copy_of_insn_after (rtx, rtx);
 extern void set_reg_attrs_from_mem (rtx, rtx);
 extern void set_mem_attrs_from_reg (rtx, rtx);
 extern void set_reg_attrs_for_parm (rtx, rtx);
-extern void set_reg_pointer_align (rtx, unsigned int);
 extern int mem_expr_equal_p (tree, tree);
 
 /* In rtl.c */
@@ -1597,7 +1364,6 @@ extern void dump_rtx_statistics (void);
 extern rtx copy_rtx_if_shared (rtx);
 
 /* In rtl.c */
-extern rtx copy_most_rtx (rtx, rtx);
 extern rtx shallow_copy_rtx_stat (rtx MEM_STAT_DECL);
 #define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
 extern int rtx_equal_p (rtx, rtx);
@@ -1607,7 +1373,6 @@ extern rtvec gen_rtvec_v (int, rtx *);
 extern rtx gen_reg_rtx (enum machine_mode);
 extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int);
 extern rtx gen_label_rtx (void);
-extern int subreg_hard_regno (rtx, int);
 extern rtx gen_lowpart_common (enum machine_mode, rtx);
 
 /* In cse.c */
@@ -1616,8 +1381,6 @@ extern rtx gen_lowpart_if_possible (enum machine_mode, rtx);
 /* In emit-rtl.c */
 extern rtx gen_highpart (enum machine_mode, rtx);
 extern rtx gen_highpart_mode (enum machine_mode, enum machine_mode, rtx);
-extern rtx gen_realpart (enum machine_mode, rtx);
-extern rtx gen_imagpart (enum machine_mode, rtx);
 extern rtx operand_subword (rtx, unsigned int, int, enum machine_mode);
 
 /* In emit-rtl.c */
@@ -1638,20 +1401,23 @@ extern rtx get_last_nonnote_insn (void);
 extern void start_sequence (void);
 extern void push_to_sequence (rtx);
 extern void end_sequence (void);
-extern void push_to_full_sequence (rtx, rtx);
 extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
                               enum machine_mode);
 
+/* In loop-iv.c  */
+
+extern rtx lowpart_subreg (enum machine_mode, rtx, enum machine_mode);
+
 /* In varasm.c  */
 extern rtx force_const_mem (enum machine_mode, rtx);
 
 /* In varasm.c  */
+
+struct function;
 extern rtx get_pool_constant (rtx);
 extern rtx get_pool_constant_mark (rtx, bool *);
 extern enum machine_mode get_pool_mode (rtx);
 extern rtx get_pool_constant_for_function (struct function *, rtx);
-extern enum machine_mode get_pool_mode_for_function (struct function *, rtx);
-extern int get_pool_offset (rtx);
 extern rtx simplify_subtraction (rtx);
 
 /* In function.c  */
@@ -1663,19 +1429,25 @@ extern rtx assign_temp (tree, int, int, int);
 
 /* In emit-rtl.c */
 extern rtx emit_insn_before (rtx, rtx);
+extern rtx emit_insn_before_noloc (rtx, rtx);
 extern rtx emit_insn_before_setloc (rtx, rtx, int);
 extern rtx emit_jump_insn_before (rtx, rtx);
+extern rtx emit_jump_insn_before_noloc (rtx, rtx);
 extern rtx emit_jump_insn_before_setloc (rtx, rtx, int);
 extern rtx emit_call_insn_before (rtx, rtx);
+extern rtx emit_call_insn_before_noloc (rtx, rtx);
 extern rtx emit_call_insn_before_setloc (rtx, rtx, int);
 extern rtx emit_barrier_before (rtx);
 extern rtx emit_label_before (rtx, rtx);
 extern rtx emit_note_before (int, rtx);
 extern rtx emit_insn_after (rtx, rtx);
+extern rtx emit_insn_after_noloc (rtx, rtx);
 extern rtx emit_insn_after_setloc (rtx, rtx, int);
 extern rtx emit_jump_insn_after (rtx, rtx);
+extern rtx emit_jump_insn_after_noloc (rtx, rtx);
 extern rtx emit_jump_insn_after_setloc (rtx, rtx, int);
 extern rtx emit_call_insn_after (rtx, rtx);
+extern rtx emit_call_insn_after_noloc (rtx, rtx);
 extern rtx emit_call_insn_after_setloc (rtx, rtx, int);
 extern rtx emit_barrier_after (rtx);
 extern rtx emit_label_after (rtx, rtx);
@@ -1690,6 +1462,7 @@ extern rtx emit_note (int);
 extern rtx emit_note_copy (rtx);
 extern rtx emit_line_note (location_t);
 extern rtx make_insn_raw (rtx);
+extern rtx make_jump_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
 extern rtx last_call_insn (void);
 extern rtx previous_insn (rtx);
@@ -1707,21 +1480,7 @@ extern rtx skip_consecutive_labels (rtx);
 extern rtx next_cc0_user (rtx);
 extern rtx prev_cc0_setter (rtx);
 
-#define emit_insn_before_sameloc(INSN, BEFORE) \
-  emit_insn_before_setloc (INSN, BEFORE, INSN_LOCATOR (BEFORE))
-#define emit_jump_insn_before_sameloc(INSN, BEFORE) \
-  emit_jump_insn_before_setloc (INSN, BEFORE, INSN_LOCATOR (BEFORE))
-#define emit_call_insn_before_sameloc(INSN, BEFORE) \
-  emit_call_insn_before_setloc (INSN, BEFORE, INSN_LOCATOR (BEFORE))
-#define emit_insn_after_sameloc(INSN, AFTER) \
-  emit_insn_after_setloc (INSN, AFTER, INSN_LOCATOR (AFTER))
-#define emit_jump_insn_after_sameloc(INSN, AFTER) \
-  emit_jump_insn_after_setloc (INSN, AFTER, INSN_LOCATOR (AFTER))
-#define emit_call_insn_after_sameloc(INSN, AFTER) \
-  emit_call_insn_after_setloc (INSN, AFTER, INSN_LOCATOR (AFTER))
-
 /* In cfglayout.c  */
-extern tree choose_inner_scope (tree, tree);
 extern int insn_line (rtx);
 extern const char * insn_file (rtx);
 extern int locator_line (int);
@@ -1741,7 +1500,6 @@ extern void cleanup_barriers (void);
 extern bool squeeze_notes (rtx *, rtx *);
 extern rtx delete_related_insns (rtx);
 extern void delete_jump (rtx);
-extern void delete_barrier (rtx);
 extern rtx get_label_before (rtx);
 extern rtx get_label_after (rtx);
 extern rtx follow_jumps (rtx);
@@ -1757,8 +1515,12 @@ extern int split_branch_probability;
 extern rtx split_insns (rtx, rtx);
 
 /* In simplify-rtx.c  */
+extern rtx simplify_const_unary_operation (enum rtx_code, enum machine_mode,
+                                          rtx, enum machine_mode);
 extern rtx simplify_unary_operation (enum rtx_code, enum machine_mode, rtx,
                                     enum machine_mode);
+extern rtx simplify_const_binary_operation (enum rtx_code, enum machine_mode,
+                                           rtx, rtx);
 extern rtx simplify_binary_operation (enum rtx_code, enum machine_mode, rtx,
                                      rtx);
 extern rtx simplify_ternary_operation (enum rtx_code, enum machine_mode,
@@ -1781,9 +1543,8 @@ extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
 extern rtx simplify_replace_rtx (rtx, rtx, rtx);
 extern rtx simplify_rtx (rtx);
 extern rtx avoid_constant_pool_reference (rtx);
-
-/* In function.c  */
-extern rtx gen_mem_addressof (rtx, tree, int);
+extern bool constant_pool_reference_p (rtx x);
+extern bool mode_signbit_p (enum machine_mode, rtx);
 
 /* In regclass.c  */
 extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
@@ -1816,22 +1577,17 @@ extern int rtx_varies_p (rtx, int);
 extern int rtx_addr_varies_p (rtx, int);
 extern HOST_WIDE_INT get_integer_term (rtx);
 extern rtx get_related_value (rtx);
-extern rtx get_jump_table_offset (rtx, rtx *);
 extern int global_reg_mentioned_p (rtx);
 extern int reg_mentioned_p (rtx, rtx);
 extern int count_occurrences (rtx, rtx, int);
 extern int reg_referenced_p (rtx, rtx);
 extern int reg_used_between_p (rtx, rtx, rtx);
-extern int reg_referenced_between_p (rtx, rtx, rtx);
 extern int reg_set_between_p (rtx, rtx, rtx);
-extern int regs_set_between_p (rtx, rtx, rtx);
 extern int commutative_operand_precedence (rtx);
 extern int swap_commutative_operands_p (rtx, rtx);
 extern int modified_between_p (rtx, rtx, rtx);
 extern int no_labels_between_p (rtx, rtx);
-extern int no_jumps_between_p (rtx, rtx);
 extern int modified_in_p (rtx, rtx);
-extern int insn_dependent_p (rtx, rtx);
 extern int reg_set_p (rtx, rtx);
 extern rtx single_set_2 (rtx, rtx);
 extern int multiple_sets (rtx);
@@ -1856,6 +1612,7 @@ extern int side_effects_p (rtx);
 extern int volatile_refs_p (rtx);
 extern int volatile_insn_p (rtx);
 extern int may_trap_p (rtx);
+extern int may_trap_or_fault_p (rtx);
 extern int inequality_comparisons_p (rtx);
 extern rtx replace_rtx (rtx, rtx, rtx);
 extern rtx replace_regs (rtx, rtx *, unsigned int, int);
@@ -1874,6 +1631,16 @@ extern int loc_mentioned_in_p (rtx *, rtx);
 extern rtx find_first_parameter_load (rtx, rtx);
 extern bool keep_with_call_p (rtx);
 extern bool label_is_jump_target_p (rtx, rtx);
+extern int insn_rtx_cost (rtx);
+
+/* Given an insn and condition, return a canonical description of
+   the test being made.  */
+extern rtx canonicalize_condition (rtx, rtx, int, rtx *, rtx, int, int);
+
+/* Given a JUMP_INSN, return a canonical description of the test
+   being made.  */
+extern rtx get_condition (rtx, rtx *, int, int);
+
 
 /* flow.c */
 
@@ -1907,8 +1674,6 @@ extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
 extern enum reg_class reg_preferred_class (int);
 extern enum reg_class reg_alternate_class (int);
 
-extern rtx get_first_nonparm_insn (void);
-
 extern void split_all_insns (int);
 extern void split_all_insns_noflow (void);
 
@@ -1999,8 +1764,13 @@ extern GTY(()) rtx return_address_pointer_rtx;
 
 /* Include the RTL generation functions.  */
 
-#ifndef NO_GENRTL_H
+#ifndef GENERATOR_FILE
 #include "genrtl.h"
+#ifndef USE_MAPPED_LOCATION
+#undef gen_rtx_ASM_OPERANDS
+#define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, LOC) \
+  gen_rtx_fmt_ssiEEsi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (LOC).file, (LOC).line)
+#endif
 #endif
 
 /* There are some RTL codes that require special attention; the
@@ -2014,9 +1784,7 @@ extern rtx gen_rtx_REG (enum machine_mode, unsigned);
 extern rtx gen_rtx_SUBREG (enum machine_mode, rtx, int);
 extern rtx gen_rtx_MEM (enum machine_mode, rtx);
 
-/* We need the cast here to ensure that we get the same result both with
-   and without prototypes.  */
-#define GEN_INT(N)  gen_rtx_CONST_INT (VOIDmode, (HOST_WIDE_INT) (N))
+#define GEN_INT(N)  gen_rtx_CONST_INT (VOIDmode, (N))
 
 /* Virtual registers are used during RTL generation to refer to locations into
    the stack frame when the actual location isn't known until RTL generation
@@ -2122,17 +1890,15 @@ extern int rtx_to_tree_code (enum rtx_code);
 
 /* In cse.c */
 extern int delete_trivially_dead_insns (rtx, int);
-#ifdef BUFSIZ
-extern int cse_main (rtx, int, int, FILE *);
-#endif
-extern void cse_condition_code_reg (void);
+extern int cse_main (rtx, int, FILE *);
+extern int exp_equiv_p (rtx, rtx, int, bool);
+extern unsigned hash_rtx (rtx x, enum machine_mode, int *, int *, bool);
 
 /* In jump.c */
 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
 extern int condjump_p (rtx);
 extern int any_condjump_p (rtx);
 extern int any_uncondjump_p (rtx);
-extern int safe_to_remove_jump_p (rtx);
 extern rtx pc_set (rtx);
 extern rtx condjump_label (rtx);
 extern int simplejump_p (rtx);
@@ -2146,14 +1912,16 @@ extern int rtx_renumbered_equal_p (rtx, rtx);
 extern int true_regnum (rtx);
 extern unsigned int reg_or_subregno (rtx);
 extern int redirect_jump_1 (rtx, rtx);
+extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
 extern int redirect_jump (rtx, rtx, int);
 extern void rebuild_jump_labels (rtx);
+extern rtx reversed_comparison (rtx, enum machine_mode);
 extern enum rtx_code reversed_comparison_code (rtx, rtx);
 extern enum rtx_code reversed_comparison_code_parts (enum rtx_code,
                                                     rtx, rtx, rtx);
 extern void delete_for_peephole (rtx, rtx);
 extern int condjump_in_parallel_p (rtx);
-extern void purge_line_number_notes (rtx);
+extern void purge_line_number_notes (void);
 
 /* In emit-rtl.c.  */
 extern int max_reg_num (void);
@@ -2174,9 +1942,7 @@ extern void init_emit (void);
 extern void init_emit_once (int);
 extern void push_topmost_sequence (void);
 extern void pop_topmost_sequence (void);
-extern void reverse_comparison (rtx);
 extern void set_new_first_and_last_insn (rtx, rtx);
-extern void set_new_last_label_num (int);
 extern void unshare_all_rtl (void);
 extern void unshare_all_rtl_again (rtx);
 extern void unshare_all_rtl_in_chain (rtx);
@@ -2189,13 +1955,7 @@ extern void add_insn_before (rtx, rtx);
 extern void add_insn_after (rtx, rtx);
 extern void remove_insn (rtx);
 extern void emit_insn_after_with_line_notes (rtx, rtx, rtx);
-extern enum rtx_code classify_insn (rtx);
 extern rtx emit (rtx);
-/* Query and clear/ restore no_line_numbers.  This is used by the
-   switch / case handling in stmt.c to give proper line numbers in
-   warnings about unreachable code.  */
-int force_line_numbers (void);
-void restore_line_number_status (int old_value);
 extern void renumber_insns (FILE *);
 extern void remove_unnecessary_notes (void);
 extern rtx delete_insn (rtx);
@@ -2205,27 +1965,23 @@ extern rtx unlink_insn_chain (rtx, rtx);
 extern rtx delete_insn_and_edges (rtx);
 extern void delete_insn_chain_and_edges (rtx, rtx);
 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
+extern rtx gen_const_mem (enum machine_mode, rtx);
+extern rtx gen_frame_mem (enum machine_mode, rtx);
+extern rtx gen_tmp_stack_mem (enum machine_mode, rtx);
+extern bool validate_subreg (enum machine_mode, enum machine_mode,
+                            rtx, unsigned int);
 
 /* In combine.c */
-extern int combine_instructions (rtx, unsigned int);
 extern unsigned int extended_count (rtx, enum machine_mode, int);
 extern rtx remove_death (unsigned int, rtx);
-#ifdef BUFSIZ
 extern void dump_combine_stats (FILE *);
 extern void dump_combine_total_stats (FILE *);
-#endif
-/* In web.c */
-extern void web_main (void);
 
 /* In sched-rgn.c.  */
-#ifdef BUFSIZ
 extern void schedule_insns (FILE *);
-#endif
 
 /* In sched-ebb.c.  */
-#ifdef BUFSIZ
 extern void schedule_ebbs (FILE *);
-#endif
 
 /* In haifa-sched.c.  */
 extern void fix_sched_param (const char *, const char *);
@@ -2236,19 +1992,17 @@ extern void debug_rtx (rtx);
 extern void debug_rtx_list (rtx, int);
 extern void debug_rtx_range (rtx, rtx);
 extern rtx debug_rtx_find (rtx, int);
-#ifdef BUFSIZ
 extern void print_mem_expr (FILE *, tree);
 extern void print_rtl (FILE *, rtx);
 extern void print_simple_rtl (FILE *, rtx);
 extern int print_rtl_single (FILE *, rtx);
 extern void print_inline_rtx (FILE *, rtx, int);
-#endif
 
 /* In loop.c */
 extern void init_loop (void);
-#ifdef BUFSIZ
 extern void loop_optimize (rtx, FILE *, int);
-#endif
+
+/* In bt-load.c */
 extern void branch_target_load_optimize (bool);
 
 /* In function.c */
@@ -2256,54 +2010,41 @@ extern void reposition_prologue_and_epilogue_notes (rtx);
 extern void thread_prologue_and_epilogue_insns (rtx);
 extern int prologue_epilogue_contains (rtx);
 extern int sibcall_epilogue_contains (rtx);
-extern void preserve_rtl_expr_result (rtx);
 extern void mark_temp_addr_taken (rtx);
 extern void update_temp_slot_address (rtx, rtx);
-extern void purge_addressof (rtx);
-extern void purge_hard_subreg_sets (rtx);
 
 /* In stmt.c */
-extern void set_file_and_line_for_stmt (location_t);
 extern void expand_null_return (void);
 extern void expand_naked_return (void);
 extern void emit_jump (rtx);
-extern int preserve_subexpressions_p (void);
 
 /* In expr.c */
 extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
                           unsigned int, int);
 
 /* In flow.c */
-extern void recompute_reg_usage (rtx, int);
+extern void recompute_reg_usage (void);
 extern int initialize_uninitialized_subregs (void);
 extern void delete_dead_jumptables (void);
-#ifdef BUFSIZ
 extern void print_rtl_with_bb (FILE *, rtx);
 extern void dump_flow_info (FILE *);
-#endif
 
 /* In expmed.c */
 extern void init_expmed (void);
 extern void expand_inc (rtx, rtx);
 extern void expand_dec (rtx, rtx);
-extern rtx expand_mult_highpart (enum machine_mode, rtx,
-                                unsigned HOST_WIDE_INT, rtx, int, int);
 
 /* In gcse.c */
 extern bool can_copy_p (enum machine_mode);
 extern rtx fis_get_condition (rtx);
-#ifdef BUFSIZ
-extern int gcse_main (rtx, FILE *);
-extern int bypass_jumps (FILE *);
-extern void gcse_after_reload_main (rtx, FILE *);
-#endif
+
+/* In postreload-gcse.c */
+extern void gcse_after_reload_main (rtx);
 
 /* In global.c */
 extern void mark_elimination (int, int);
-#ifdef BUFSIZ
 extern int global_alloc (FILE *);
 extern void dump_global_regs (FILE *);
-#endif
 #ifdef HARD_CONST
 /* Yes, this ifdef is silly, but HARD_REG_SET is not always defined.  */
 extern void retry_global_alloc (int, HARD_REG_SET);
@@ -2318,12 +2059,13 @@ extern void init_reg_modes_once (void);
 extern void init_regs (void);
 extern void init_fake_stack_mems (void);
 extern void init_reg_sets (void);
-extern void regset_release_memory (void);
 extern void regclass_init (void);
 extern void regclass (rtx, int, FILE *);
-extern void reg_scan (rtx, unsigned int, int);
+extern void reg_scan (rtx, unsigned int);
 extern void reg_scan_update (rtx, rtx, unsigned int);
 extern void fix_register (const char *, int, int);
+extern void init_subregs_of_mode (void);
+extern void record_subregs_of_mode (rtx);
 #ifdef HARD_CONST
 extern void cannot_change_mode_set_regs (HARD_REG_SET *,
                                         enum machine_mode, unsigned int);
@@ -2332,26 +2074,21 @@ extern bool invalid_mode_change_p (unsigned int, enum reg_class,
                                   enum machine_mode);
 
 /* In regmove.c */
-#ifdef BUFSIZ
 extern void regmove_optimize (rtx, int, FILE *);
-#endif
 extern void combine_stack_adjustments (void);
 
 /* In reorg.c */
-#ifdef BUFSIZ
 extern void dbr_schedule (rtx, FILE *);
-#endif
 
 /* In local-alloc.c */
-#ifdef BUFSIZ
 extern void dump_local_alloc (FILE *);
-#endif
 extern int local_alloc (void);
 
+/* In reload1.c */
+extern int function_invariant_p (rtx);
+
 /* In reg-stack.c */
-#ifdef BUFSIZ
 extern bool reg_to_stack (FILE *);
-#endif
 
 /* In calls.c */
 enum libcall_type
@@ -2363,8 +2100,7 @@ enum libcall_type
   LCT_PURE_MAKE_BLOCK = 4,
   LCT_NORETURN = 5,
   LCT_THROW = 6,
-  LCT_ALWAYS_RETURN = 7,
-  LCT_RETURNS_TWICE = 8
+  LCT_RETURNS_TWICE = 7
 };
 
 extern void emit_library_call (rtx, enum libcall_type, enum machine_mode, int,
@@ -2372,36 +2108,24 @@ extern void emit_library_call (rtx, enum libcall_type, enum machine_mode, int,
 extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
                                    enum machine_mode, int, ...);
 
-/* In unroll.c */
-extern int set_dominates_use (int, int, int, rtx, rtx);
-
 /* In varasm.c */
-extern int in_data_section (void);
 extern void init_varasm_once (void);
-
+extern enum tls_model decl_default_tls_model (tree);
+  
 /* In rtl.c */
-extern void init_rtl (void);
 extern void traverse_md_constants (int (*) (void **, void *), void *);
 struct md_constant { char *name, *value; };
 
-#ifdef BUFSIZ
+/* In read-rtl.c */
 extern int read_skip_spaces (FILE *);
-extern rtx read_rtx (FILE *);
-#endif
-
+extern bool read_rtx (FILE *, rtx *, int *);
+extern void copy_rtx_ptr_loc (const void *, const void *);
+extern void print_rtx_ptr_loc (const void *);
+extern const char *join_c_conditions (const char *, const char *);
+extern void print_c_condition (const char *);
 extern const char *read_rtx_filename;
 extern int read_rtx_lineno;
 
-/* Redefine abort to report an internal error w/o coredump, and
-   reporting the location of the error in the source file.  This logic
-   is duplicated in rtl.h and tree.h because every file that needs the
-   special abort includes one or both.  toplev.h gets too few files,
-   system.h gets too many.  */
-
-extern void fancy_abort (const char *, int, const char *)
-    ATTRIBUTE_NORETURN;
-#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
-
 /* In alias.c */
 extern void clear_reg_alias_info (rtx);
 extern rtx canon_rtx (rtx);
@@ -2412,12 +2136,10 @@ extern int canon_true_dependence (rtx, enum machine_mode, rtx, rtx,
 extern int read_dependence (rtx, rtx);
 extern int anti_dependence (rtx, rtx);
 extern int output_dependence (rtx, rtx);
-extern int unchanging_anti_dependence (rtx, rtx);
 extern void mark_constant_function (void);
 extern void init_alias_once (void);
 extern void init_alias_analysis (void);
 extern void end_alias_analysis (void);
-extern rtx addr_side_effect_eval (rtx, int, int);
 extern bool memory_modified_in_insn_p (rtx, rtx);
 extern rtx find_base_term (rtx);
 extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
@@ -2442,7 +2164,7 @@ extern void if_convert (int);
 extern void invert_br_probabilities (rtx);
 extern bool expensive_function_p (int);
 /* In tracer.c */
-extern void tracer (void);
+extern void tracer (unsigned int);
 
 /* In var-tracking.c */
 extern void variable_tracking_main (void);
@@ -2463,13 +2185,12 @@ extern void simplify_using_condition (rtx, rtx *, struct bitmap_head_def *);
 extern void reg_alloc (void);
 
 /* In modulo-sched.c.  */
-#ifdef BUFSIZ
 extern void sms_schedule (FILE *);
-#endif
 \f
 struct rtl_hooks
 {
   rtx (*gen_lowpart) (enum machine_mode, rtx);
+  rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx);
   rtx (*reg_nonzero_bits) (rtx, enum machine_mode, rtx, enum machine_mode,
                           unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *);
   rtx (*reg_num_sign_bit_copies) (rtx, enum machine_mode, rtx, enum machine_mode,