OSDN Git Service

* config/host-hpux.c: Change copyright header to refer to version 3 of the GNU
[pf3gnuchains/gcc-fork.git] / gcc / config / iq2000 / iq2000.c
index 90efc4b..ceb2d79 100644 (file)
@@ -1,11 +1,11 @@
 /* Subroutines used for code generation on Vitesse IQ2000 processors
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -14,9 +14,8 @@ 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 GCC; 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 COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
 #include "system.h"
@@ -45,6 +44,7 @@ Boston, MA 02111-1307, USA.  */
 #include "debug.h"
 #include "target.h"
 #include "target-def.h"
+#include "langhooks.h"
 
 /* Enumeration for all of the relational tests, so that we can build
    arrays indexed by the test type, and not worry about the order
@@ -124,11 +124,6 @@ rtx branch_cmp[2];
 /* What type of branch to use.  */
 enum cmp_type branch_type;
 
-/* Strings to hold which cpu and instruction set architecture to use.  */
-const char * iq2000_cpu_string;          /* For -mcpu=<xxx>.  */
-const char * iq2000_arch_string;  /* For -march=<xxx>.  */
-
-
 /* Local variables.  */
 
 /* The next branch instruction is a branch likely, not branch normal.  */
@@ -142,7 +137,7 @@ static int dslots_jump_total;
 /* # of nops needed by previous insn.  */
 static int dslots_number_nops;
 
-/* Number of 1/2/3 word references to data items (ie, not jal's).  */
+/* Number of 1/2/3 word references to data items (i.e., not jal's).  */
 static int num_refs[3];
 
 /* Registers to check for load delay.  */
@@ -151,16 +146,15 @@ static rtx iq2000_load_reg2;
 static rtx iq2000_load_reg3;
 static rtx iq2000_load_reg4;
 
-/* The target cpu for code generation.  */
-static enum processor_type iq2000_arch;
-
 /* Mode used for saving/restoring general purpose registers.  */
 static enum machine_mode gpr_mode;
 
 \f
 /* Initialize the GCC target structure.  */
 static struct machine_function* iq2000_init_machine_status (void);
-static void iq2000_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT);
+static bool iq2000_handle_option      (size_t, const char *, int);
+static section *iq2000_select_rtx_section (enum machine_mode, rtx,
+                                          unsigned HOST_WIDE_INT);
 static void iq2000_init_builtins      (void);
 static rtx  iq2000_expand_builtin     (tree, rtx, rtx, enum machine_mode, int);
 static bool iq2000_return_in_memory   (tree, tree);
@@ -169,8 +163,12 @@ static void iq2000_setup_incoming_varargs (CUMULATIVE_ARGS *,
                                           int);
 static bool iq2000_rtx_costs          (rtx, int, int, int *);
 static int  iq2000_address_cost       (rtx);
-static void iq2000_select_section     (tree, int, unsigned HOST_WIDE_INT);
+static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
 static bool iq2000_return_in_memory   (tree, tree);
+static bool iq2000_pass_by_reference  (CUMULATIVE_ARGS *, enum machine_mode,
+                                      tree, bool);
+static int  iq2000_arg_partial_bytes  (CUMULATIVE_ARGS *, enum machine_mode,
+                                      tree, bool);
 
 #undef  TARGET_INIT_BUILTINS
 #define TARGET_INIT_BUILTINS           iq2000_init_builtins
@@ -178,6 +176,8 @@ static bool iq2000_return_in_memory   (tree, tree);
 #define TARGET_EXPAND_BUILTIN          iq2000_expand_builtin
 #undef  TARGET_ASM_SELECT_RTX_SECTION
 #define TARGET_ASM_SELECT_RTX_SECTION  iq2000_select_rtx_section
+#undef  TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION           iq2000_handle_option
 #undef  TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS               iq2000_rtx_costs
 #undef  TARGET_ADDRESS_COST
@@ -185,6 +185,11 @@ static bool iq2000_return_in_memory   (tree, tree);
 #undef  TARGET_ASM_SELECT_SECTION
 #define TARGET_ASM_SELECT_SECTION      iq2000_select_section
 
+/* The assembler supports switchable .bss sections, but
+   iq2000_select_section doesn't yet make use of them.  */
+#undef  TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
+#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS false
+
 #undef  TARGET_PROMOTE_FUNCTION_ARGS
 #define TARGET_PROMOTE_FUNCTION_ARGS   hook_bool_tree_true
 #undef  TARGET_PROMOTE_FUNCTION_RETURN
@@ -194,6 +199,12 @@ static bool iq2000_return_in_memory   (tree, tree);
 
 #undef  TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY                iq2000_return_in_memory
+#undef  TARGET_PASS_BY_REFERENCE
+#define TARGET_PASS_BY_REFERENCE       iq2000_pass_by_reference
+#undef  TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES           hook_callee_copies_named
+#undef  TARGET_ARG_PARTIAL_BYTES
+#define TARGET_ARG_PARTIAL_BYTES       iq2000_arg_partial_bytes
 
 #undef  TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS  iq2000_setup_incoming_varargs
@@ -202,217 +213,6 @@ static bool iq2000_return_in_memory   (tree, tree);
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
-/* Return 1 if OP can be used as an operand where a register or 16 bit unsigned
-   integer is needed.  */
-
-int
-uns_arith_operand (rtx op, enum machine_mode mode)
-{
-  if (GET_CODE (op) == CONST_INT && SMALL_INT_UNSIGNED (op))
-    return 1;
-
-  return register_operand (op, mode);
-}
-
-/* Return 1 if OP can be used as an operand where a 16 bit integer is needed.  */
-
-int
-arith_operand (rtx op, enum machine_mode mode)
-{
-  if (GET_CODE (op) == CONST_INT && SMALL_INT (op))
-    return 1;
-
-  return register_operand (op, mode);
-}
-
-/* Return 1 if OP is a integer which fits in 16 bits.  */
-
-int
-small_int (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  return (GET_CODE (op) == CONST_INT && SMALL_INT (op));
-}
-
-/* Return 1 if OP is a 32 bit integer which is too big to be loaded with one
-   instruction.  */
-
-int
-large_int (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  HOST_WIDE_INT value;
-
-  if (GET_CODE (op) != CONST_INT)
-    return 0;
-
-  value = INTVAL (op);
-
-  /* IOR reg,$r0,value.  */
-  if ((value & ~ ((HOST_WIDE_INT) 0x0000ffff)) == 0)
-    return 0;
-
-  /* SUBU reg,$r0,value.  */
-  if (((unsigned HOST_WIDE_INT) (value + 32768)) <= 32767)
-    return 0;
-
-  /* LUI reg,value >> 16.  */
-  if ((value & 0x0000ffff) == 0)
-    return 0;
-
-  return 1;
-}
-
-/* Return 1 if OP is a register or the constant 0.  */
-
-int
-reg_or_0_operand (rtx op, enum machine_mode mode)
-{
-  switch (GET_CODE (op))
-    {
-    case CONST_INT:
-      return INTVAL (op) == 0;
-
-    case CONST_DOUBLE:
-      return op == CONST0_RTX (mode);
-
-    case REG:
-    case SUBREG:
-      return register_operand (op, mode);
-
-    default:
-      break;
-    }
-
-  return 0;
-}
-
-/* Return 1 if OP is a memory operand that fits in a single instruction
-   (ie, register + small offset).  */
-
-int
-simple_memory_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  rtx addr, plus0, plus1;
-
-  /* Eliminate non-memory operations.  */
-  if (GET_CODE (op) != MEM)
-    return 0;
-
-  /* Dword operations really put out 2 instructions, so eliminate them.  */
-  if (GET_MODE_SIZE (GET_MODE (op)) > (unsigned) UNITS_PER_WORD)
-    return 0;
-
-  /* Decode the address now.  */
-  addr = XEXP (op, 0);
-  switch (GET_CODE (addr))
-    {
-    case REG:
-    case LO_SUM:
-      return 1;
-
-    case CONST_INT:
-      return SMALL_INT (addr);
-
-    case PLUS:
-      plus0 = XEXP (addr, 0);
-      plus1 = XEXP (addr, 1);
-      if (GET_CODE (plus0) == REG
-         && GET_CODE (plus1) == CONST_INT && SMALL_INT (plus1)
-         && SMALL_INT_UNSIGNED (plus1) /* No negative offsets.  */)
-       return 1;
-
-      else if (GET_CODE (plus1) == REG
-              && GET_CODE (plus0) == CONST_INT && SMALL_INT (plus0)
-              && SMALL_INT_UNSIGNED (plus1) /* No negative offsets.  */)
-       return 1;
-
-      else
-       return 0;
-
-    case SYMBOL_REF:
-      return 0;
-
-    default:
-      break;
-    }
-
-  return 0;
-}
-
-/* Return nonzero if the code of this rtx pattern is EQ or NE.  */
-
-int
-equality_op (rtx op, enum machine_mode mode)
-{
-  if (mode != GET_MODE (op))
-    return 0;
-
-  return GET_CODE (op) == EQ || GET_CODE (op) == NE;
-}
-
-/* Return nonzero if the code is a relational operations (EQ, LE, etc).  */
-
-int
-cmp_op (rtx op, enum machine_mode mode)
-{
-  if (mode != GET_MODE (op))
-    return 0;
-
-  return GET_RTX_CLASS (GET_CODE (op)) == '<';
-}
-
-/* Return nonzero if the operand is either the PC or a label_ref.  */
-
-int
-pc_or_label_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  if (op == pc_rtx)
-    return 1;
-
-  if (GET_CODE (op) == LABEL_REF)
-    return 1;
-
-  return 0;
-}
-
-/* Return nonzero if OP is a valid operand for a call instruction.  */
-
-int
-call_insn_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  return (CONSTANT_ADDRESS_P (op)
-         || (GET_CODE (op) == REG && op != arg_pointer_rtx
-             && ! (REGNO (op) >= FIRST_PSEUDO_REGISTER
-                   && REGNO (op) <= LAST_VIRTUAL_REGISTER)));
-}
-
-/* Return nonzero if OP is valid as a source operand for a move instruction.  */
-
-int
-move_operand (rtx op, enum machine_mode mode)
-{
-  /* Accept any general operand after reload has started; doing so
-     avoids losing if reload does an in-place replacement of a register
-     with a SYMBOL_REF or CONST.  */
-  return (general_operand (op, mode)
-         && (! (iq2000_check_split (op, mode))
-             || reload_in_progress || reload_completed));
-}
-
-/* Return nonzero if OP is a constant power of 2.  */
-
-int
-power_of_2_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  int intval;
-
-  if (GET_CODE (op) != CONST_INT)
-    return 0;
-  else
-    intval = INTVAL (op);
-
-  return ((intval & ((unsigned)(intval) - 1)) == 0);
-}
-
 /* Return nonzero if we split the address into high and low parts.  */
 
 int
@@ -705,7 +505,7 @@ abort_with_insn (rtx insn, const char * reason)
 {
   error (reason);
   debug_rtx (insn);
-  abort ();
+  fancy_abort (__FILE__, __LINE__, __FUNCTION__);
 }
 \f
 /* Return the appropriate instructions to move one operand to another.  */
@@ -1077,8 +877,7 @@ gen_int_relational (enum rtx_code test_code, rtx result, rtx cmp0, rtx cmp1,
   rtx reg2;
 
   test = map_test_to_internal_test (test_code);
-  if (test == ITEST_MAX)
-    abort ();
+  gcc_assert (test != ITEST_MAX);
 
   p_info = &info[(int) test];
   eqne_p = (p_info->test_code == XOR);
@@ -1330,7 +1129,7 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
               "function_adv({gp reg found = %d, arg # = %2d, words = %2d}, %4s, ",
               cum->gp_reg_found, cum->arg_number, cum->arg_words,
               GET_MODE_NAME (mode));
-      fprintf (stderr, HOST_PTR_PRINTF, (const PTR) type);
+      fprintf (stderr, "%p", (void *) type);
       fprintf (stderr, ", %d )\n\n", named);
     }
 
@@ -1341,9 +1140,8 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
       break;
 
     default:
-      if (GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
-         && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
-       abort ();
+      gcc_assert (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT
+                 || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT);
 
       cum->gp_reg_found = 1;
       cum->arg_words += ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1)
@@ -1404,7 +1202,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
               "function_arg( {gp reg found = %d, arg # = %2d, words = %2d}, %4s, ",
               cum->gp_reg_found, cum->arg_number, cum->arg_words,
               GET_MODE_NAME (mode));
-      fprintf (stderr, HOST_PTR_PRINTF, (const PTR) type);
+      fprintf (stderr, "%p", (void *) type);
       fprintf (stderr, ", %d ) = ", named);
     }
 
@@ -1423,9 +1221,8 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
       break;
 
     default:
-      if (GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
-         && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
-       abort ();
+      gcc_assert (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT
+                 || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT);
 
       /* Drops through.  */
     case BLKmode:
@@ -1455,8 +1252,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
     }
   else
     {
-      if (regbase == -1)
-       abort ();
+      gcc_assert (regbase != -1);
 
       if (! type || TREE_CODE (type) != RECORD_TYPE
          || ! named  || ! TYPE_SIZE_UNIT (type)
@@ -1545,18 +1341,16 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
   return ret;
 }
 
-int
-function_arg_partial_nregs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
-                           tree type ATTRIBUTE_UNUSED,
-                           int named ATTRIBUTE_UNUSED)
+static int
+iq2000_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+                         tree type ATTRIBUTE_UNUSED,
+                         bool named ATTRIBUTE_UNUSED)
 {
-  if (mode == DImode
-          && cum->arg_words == MAX_ARGS_IN_REGISTERS - (unsigned)1)
+  if (mode == DImode && cum->arg_words == MAX_ARGS_IN_REGISTERS - 1)
     {
       if (TARGET_DEBUG_D_MODE)
-       fprintf (stderr, "function_arg_partial_nregs = 1\n");
-
-      return 1;
+       fprintf (stderr, "iq2000_arg_partial_bytes=%d\n", UNITS_PER_WORD);
+      return UNITS_PER_WORD;
     }
 
   return 0;
@@ -1584,204 +1378,6 @@ iq2000_va_start (tree valist, rtx nextarg)
   nextarg = plus_constant (nextarg, - gpr_save_area_size);
   std_expand_builtin_va_start (valist, nextarg);
 }
-
-/* Implement va_arg.  */
-
-rtx
-iq2000_va_arg (tree valist, tree type)
-{
-  HOST_WIDE_INT size, rsize;
-  rtx addr_rtx;
-  tree t;
-  int indirect;
-  rtx r, lab_over = NULL_RTX, lab_false;
-  tree f_ovfl, f_gtop, f_ftop, f_goff, f_foff;
-  tree ovfl, gtop, ftop, goff, foff;
-
-  size = int_size_in_bytes (type);
-  rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;
-  indirect
-    = function_arg_pass_by_reference (NULL, TYPE_MODE (type), type, 0);
-  if (indirect)
-    {
-      size = POINTER_SIZE / BITS_PER_UNIT;
-      rsize = UNITS_PER_WORD;
-    }
-
-  addr_rtx = gen_reg_rtx (Pmode);
-
-  {
-    /* Case of all args in a merged stack. No need to check bounds,
-       just advance valist along the stack.  */
-    tree gpr = valist;
-
-    if (! indirect
-       && TYPE_ALIGN (type) > (unsigned) BITS_PER_WORD)
-      {
-       t = build (PLUS_EXPR, TREE_TYPE (gpr), gpr,
-                  build_int_2 (2*UNITS_PER_WORD - 1, 0));
-       t = build (BIT_AND_EXPR, TREE_TYPE (t), t,
-                  build_int_2 (-2*UNITS_PER_WORD, -1));
-       t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, t);
-       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
-      }
-
-    t = build (POSTINCREMENT_EXPR, TREE_TYPE (gpr), gpr,
-              size_int (rsize));
-    r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL);
-    if (r != addr_rtx)
-      emit_move_insn (addr_rtx, r);
-
-    /* Flush the POSTINCREMENT.  */
-    emit_queue();
-
-    if (indirect)
-      {
-       r = gen_rtx_MEM (Pmode, addr_rtx);
-       set_mem_alias_set (r, get_varargs_alias_set ());
-       emit_move_insn (addr_rtx, r);
-      }
-    else
-      {
-       if (BYTES_BIG_ENDIAN && rsize != size)
-         addr_rtx = plus_constant (addr_rtx, rsize - size);
-      }
-    return addr_rtx;
-  }
-
-  /* Not a simple merged stack.  Need ptrs and indexes left by va_start.  */
-  f_ovfl  = TYPE_FIELDS (va_list_type_node);
-  f_gtop = TREE_CHAIN (f_ovfl);
-  f_ftop = TREE_CHAIN (f_gtop);
-  f_goff = TREE_CHAIN (f_ftop);
-  f_foff = TREE_CHAIN (f_goff);
-
-  ovfl = build (COMPONENT_REF, TREE_TYPE (f_ovfl), valist, f_ovfl);
-  gtop = build (COMPONENT_REF, TREE_TYPE (f_gtop), valist, f_gtop);
-  ftop = build (COMPONENT_REF, TREE_TYPE (f_ftop), valist, f_ftop);
-  goff = build (COMPONENT_REF, TREE_TYPE (f_goff), valist, f_goff);
-  foff = build (COMPONENT_REF, TREE_TYPE (f_foff), valist, f_foff);
-
-  lab_false = gen_label_rtx ();
-  lab_over = gen_label_rtx ();
-
-  if (TREE_CODE (type) == REAL_TYPE)
-    {
-      /* Emit code to branch if foff == 0.  */
-      r = expand_expr (foff, NULL_RTX, TYPE_MODE (TREE_TYPE (foff)),
-                      EXPAND_NORMAL);
-      emit_cmp_and_jump_insns (r, const0_rtx, EQ,
-                              const1_rtx, GET_MODE (r), 1, lab_false);
-
-      /* Emit code for addr_rtx = ftop - foff.  */
-      t = build (MINUS_EXPR, TREE_TYPE (ftop), ftop, foff );
-      r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL);
-      if (r != addr_rtx)
-       emit_move_insn (addr_rtx, r);
-
-      /* Emit code for foff-=8.
-        Advances the offset up FPR save area by one double.  */
-      t = build (MINUS_EXPR, TREE_TYPE (foff), foff, build_int_2 (8, 0));
-      t = build (MODIFY_EXPR, TREE_TYPE (foff), foff, t);
-      expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
-      emit_queue ();
-      emit_jump (lab_over);
-      emit_barrier ();
-      emit_label (lab_false);
-
-      /* If a 4-byte int is followed by an 8-byte float, then
-        natural alignment causes a 4 byte gap.
-        So, dynamically adjust ovfl up to a multiple of 8.  */
-      t = build (BIT_AND_EXPR, TREE_TYPE (ovfl), ovfl,
-                build_int_2 (7, 0));
-      t = build (PLUS_EXPR, TREE_TYPE (ovfl), ovfl, t);
-      t = build (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t);
-      expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
-      /* Emit code for addr_rtx = the ovfl pointer into overflow area.
-        Postincrement the ovfl pointer by 8.  */
-      t = build (POSTINCREMENT_EXPR, TREE_TYPE(ovfl), ovfl,
-                size_int (8));
-      r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL);
-      if (r != addr_rtx)
-       emit_move_insn (addr_rtx, r);
-
-      emit_queue();
-      emit_label (lab_over);
-      return addr_rtx;
-    }
-  else
-    {
-      /* Not REAL_TYPE.  */
-      int step_size;
-
-      if (TREE_CODE (type) == INTEGER_TYPE
-         && TYPE_PRECISION (type) == 64)
-       {
-         /* int takes 32 bits of the GPR save area, but
-            longlong takes an aligned 64 bits.  So, emit code
-            to zero the low order bits of goff, thus aligning
-            the later calculation of (gtop-goff) upwards.  */
-         t = build (BIT_AND_EXPR, TREE_TYPE (goff), goff,
-                    build_int_2 (-8, -1));
-         t = build (MODIFY_EXPR, TREE_TYPE (goff), goff, t);
-         expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
-       }
-
-      /* Emit code to branch if goff == 0.  */
-      r = expand_expr (goff, NULL_RTX, TYPE_MODE (TREE_TYPE (goff)),
-                      EXPAND_NORMAL);
-      emit_cmp_and_jump_insns (r, const0_rtx, EQ,
-                              const1_rtx, GET_MODE (r), 1, lab_false);
-
-      /* Emit code for addr_rtx = gtop - goff.  */
-      t = build (MINUS_EXPR, TREE_TYPE (gtop), gtop, goff);
-      r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL);
-      if (r != addr_rtx)
-       emit_move_insn (addr_rtx, r);
-      
-      if (TYPE_PRECISION (type) == 64)
-       step_size = 8;
-      else
-       step_size = UNITS_PER_WORD;
-
-      /* Emit code for goff = goff - step_size.
-        Advances the offset up GPR save area over the item.  */
-      t = build (MINUS_EXPR, TREE_TYPE (goff), goff,
-                build_int_2 (step_size, 0));
-      t = build (MODIFY_EXPR, TREE_TYPE (goff), goff, t);
-      expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
-      
-      emit_queue();
-      emit_jump (lab_over);
-      emit_barrier ();
-      emit_label (lab_false);
-
-      /* Emit code for addr_rtx -> overflow area, postinc by step_size.  */
-      t = build (POSTINCREMENT_EXPR, TREE_TYPE(ovfl), ovfl,
-                size_int (step_size));
-      r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL);
-      if (r != addr_rtx)
-       emit_move_insn (addr_rtx, r);
-
-      emit_queue();
-      emit_label (lab_over);
-
-      if (indirect)
-       {
-         r = gen_rtx_MEM (Pmode, addr_rtx);
-         set_mem_alias_set (r, get_varargs_alias_set ());
-         emit_move_insn (addr_rtx, r);
-       }
-      else
-       {
-         if (BYTES_BIG_ENDIAN && rsize != size)
-           addr_rtx = plus_constant (addr_rtx, rsize - size);
-       }
-      return addr_rtx;
-    }
-}
 \f
 /* Allocate a chunk of memory for per-function machine-dependent data.  */
 
@@ -1795,26 +1391,31 @@ iq2000_init_machine_status (void)
   return f;
 }
 
-static enum processor_type
-iq2000_parse_cpu (const char * cpu_string)
-{
-  const char *p = cpu_string;
-  enum processor_type cpu;
+/* Implement TARGET_HANDLE_OPTION.  */
 
-  cpu = PROCESSOR_DEFAULT;
-  switch (p[2])
+static bool
+iq2000_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
+{
+  switch (code)
     {
-    case '1':
-      if (!strcmp (p, "iq10"))
-       cpu = PROCESSOR_IQ10;
-      break;
-    case '2':
-      if (!strcmp (p, "iq2000"))
-       cpu = PROCESSOR_IQ2000;
-      break;
-    }
+    case OPT_mcpu_:
+      if (strcmp (arg, "iq10") == 0)
+       iq2000_tune = PROCESSOR_IQ10;
+      else if (strcmp (arg, "iq2000") == 0)
+       iq2000_tune = PROCESSOR_IQ2000;
+      else
+       return false;
+      return true;
+
+    case OPT_march_:
+      /* This option has no effect at the moment.  */
+      return (strcmp (arg, "default") == 0
+             || strcmp (arg, "DEFAULT") == 0
+             || strcmp (arg, "iq2000") == 0);
 
-  return cpu;
+    default:
+      return true;
+    }
 }
 
 /* Detect any conflicts in the switches.  */
@@ -1822,53 +1423,12 @@ iq2000_parse_cpu (const char * cpu_string)
 void
 override_options (void)
 {
-  enum processor_type iq2000_cpu;
-
   target_flags &= ~MASK_GPOPT;
 
   iq2000_isa = IQ2000_ISA_DEFAULT;
 
   /* Identify the processor type.  */
 
-  if (iq2000_cpu_string != 0)
-    {
-      iq2000_cpu = iq2000_parse_cpu (iq2000_cpu_string);
-      if (iq2000_cpu == PROCESSOR_DEFAULT)
-       {
-         error ("bad value (%s) for -mcpu= switch", iq2000_arch_string);
-         iq2000_cpu_string = "default";
-       }
-      iq2000_arch = iq2000_cpu;
-      iq2000_tune = iq2000_cpu;
-    }
-
-  if (iq2000_arch_string == 0
-      || ! strcmp (iq2000_arch_string, "default")
-      || ! strcmp (iq2000_arch_string, "DEFAULT"))
-    {
-      switch (iq2000_isa)
-       {
-       default:
-         iq2000_arch_string = "iq2000";
-         iq2000_arch = PROCESSOR_IQ2000;
-         break;
-       }
-    }
-  else
-    {
-      iq2000_arch = iq2000_parse_cpu (iq2000_arch_string);
-      if (iq2000_arch == PROCESSOR_DEFAULT)
-       {
-         error ("bad value (%s) for -march= switch", iq2000_arch_string);
-         iq2000_arch_string = "default";
-       }
-      if (iq2000_arch == PROCESSOR_IQ10)
-       {
-         error ("The compiler does not support -march=%s.", iq2000_arch_string);
-         iq2000_arch_string = "default";
-       }
-    }
-
   iq2000_print_operand_punct['?'] = 1;
   iq2000_print_operand_punct['#'] = 1;
   iq2000_print_operand_punct['&'] = 1;
@@ -2222,9 +1782,8 @@ save_restore_insns (int store_p)
   HOST_WIDE_INT gp_offset;
   HOST_WIDE_INT end_offset;
 
-  if (frame_pointer_needed
-      && ! BITSET_P (mask, HARD_FRAME_POINTER_REGNUM - GP_REG_FIRST))
-    abort ();
+  gcc_assert (!frame_pointer_needed
+             || BITSET_P (mask, HARD_FRAME_POINTER_REGNUM - GP_REG_FIRST));
 
   if (mask == 0)
     {
@@ -2251,7 +1810,7 @@ save_restore_insns (int store_p)
 
   if (gp_offset < 0 || end_offset < 0)
     internal_error
-      ("gp_offset (%ld) or end_offset (%ld) is less than zero.",
+      ("gp_offset (%ld) or end_offset (%ld) is less than zero",
        (long) gp_offset, (long) end_offset);
 
   else if (gp_offset < 32768)
@@ -2277,9 +1836,6 @@ save_restore_insns (int store_p)
                       gen_rtx_PLUS (Pmode, base_reg_rtx,
                                GEN_INT (gp_offset - base_offset)));
 
-         if (! current_function_calls_eh_return)
-           RTX_UNCHANGING_P (mem_rtx) = 1;
-
          reg_rtx = gen_rtx_REG (gpr_mode, regno);
 
          if (store_p)
@@ -2367,8 +1923,7 @@ iq2000_expand_prologue (void)
            {
              int words;
 
-             if (GET_CODE (entry_parm) != REG)
-               abort ();
+             gcc_assert (GET_CODE (entry_parm) == REG);
 
              /* Passed in a register, so will get homed automatically.  */
              if (GET_MODE (entry_parm) == BLKmode)
@@ -2408,13 +1963,6 @@ iq2000_expand_prologue (void)
          PUT_CODE (SET_SRC (pattern), ASHIFTRT);
 
          insn = emit_insn (pattern);
-
-         /* Global life information isn't valid at this point, so we
-            can't check whether these shifts are actually used.  Mark
-            them MAYBE_DEAD so that flow2 will remove them, and not
-            complain about dead code in the prologue.  */
-         REG_NOTES(insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, NULL_RTX,
-                                              REG_NOTES (insn));
        }
     }
 
@@ -2491,7 +2039,7 @@ iq2000_expand_epilogue (void)
 
   if (iq2000_can_use_return_insn ())
     {
-      emit_insn (gen_return ());
+      emit_jump_insn (gen_return ());
       return;
     }
 
@@ -2563,7 +2111,7 @@ iq2000_can_use_return_insn (void)
   if (! reload_completed)
     return 0;
 
-  if (regs_ever_live[31] || profile_flag)
+  if (df_regs_ever_live_p (31) || profile_flag)
     return 0;
 
   if (cfun->machine->initialized)
@@ -2583,11 +2131,10 @@ symbolic_expression_p (rtx x)
   if (GET_CODE (x) == CONST)
     return symbolic_expression_p (XEXP (x, 0));
 
-  if (GET_RTX_CLASS (GET_CODE (x)) == '1')
+  if (UNARY_P (x))
     return symbolic_expression_p (XEXP (x, 0));
 
-  if (GET_RTX_CLASS (GET_CODE (x)) == 'c'
-      || GET_RTX_CLASS (GET_CODE (x)) == '2')
+  if (ARITHMETIC_P (x))
     return (symbolic_expression_p (XEXP (x, 0))
            || symbolic_expression_p (XEXP (x, 1)));
 
@@ -2597,15 +2144,13 @@ symbolic_expression_p (rtx x)
 /* Choose the section to use for the constant rtx expression X that has
    mode MODE.  */
 
-static void
+static section *
 iq2000_select_rtx_section (enum machine_mode mode, rtx x ATTRIBUTE_UNUSED,
                           unsigned HOST_WIDE_INT align)
 {
   /* For embedded applications, always put constants in read-only data,
      in order to reduce RAM usage.  */
-      /* For embedded applications, always put constants in read-only data,
-         in order to reduce RAM usage.  */
-  mergeable_constant_section (mode, align, 0);
+  return mergeable_constant_section (mode, align, 0);
 }
 
 /* Choose the section to use for DECL.  RELOC is true if its value contains
@@ -2615,7 +2160,7 @@ iq2000_select_rtx_section (enum machine_mode mode, rtx x ATTRIBUTE_UNUSED,
    ENCODE_SECTION_INFO in iq2000.h so that references to these symbols
    are done correctly.  */
 
-static void
+static section *
 iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
                       unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
 {
@@ -2623,35 +2168,31 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
     {
       /* For embedded applications, always put an object in read-only data
         if possible, in order to reduce RAM usage.  */
-      if (((TREE_CODE (decl) == VAR_DECL
-           && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
-           && DECL_INITIAL (decl)
-           && (DECL_INITIAL (decl) == error_mark_node
-               || TREE_CONSTANT (DECL_INITIAL (decl))))
-          /* Deal with calls from output_constant_def_contents.  */
-          || (TREE_CODE (decl) != VAR_DECL
-              && (TREE_CODE (decl) != STRING_CST
-                  || !flag_writable_strings))))
-       readonly_data_section ();
+      if ((TREE_CODE (decl) == VAR_DECL
+          && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
+          && DECL_INITIAL (decl)
+          && (DECL_INITIAL (decl) == error_mark_node
+              || TREE_CONSTANT (DECL_INITIAL (decl))))
+         /* Deal with calls from output_constant_def_contents.  */
+         || TREE_CODE (decl) != VAR_DECL)
+       return readonly_data_section;
       else
-       data_section ();
+       return data_section;
     }
   else
     {
       /* For hosted applications, always put an object in small data if
         possible, as this gives the best performance.  */
-      if (((TREE_CODE (decl) == VAR_DECL
-                && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
-                && DECL_INITIAL (decl)
-                && (DECL_INITIAL (decl) == error_mark_node
-                    || TREE_CONSTANT (DECL_INITIAL (decl))))
-               /* Deal with calls from output_constant_def_contents.  */
-               || (TREE_CODE (decl) != VAR_DECL
-                   && (TREE_CODE (decl) != STRING_CST
-                       || !flag_writable_strings))))
-       readonly_data_section ();
+      if ((TREE_CODE (decl) == VAR_DECL
+          && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
+          && DECL_INITIAL (decl)
+          && (DECL_INITIAL (decl) == error_mark_node
+              || TREE_CONSTANT (DECL_INITIAL (decl))))
+         /* Deal with calls from output_constant_def_contents.  */
+         || TREE_CODE (decl) != VAR_DECL)
+       return readonly_data_section;
       else
-       data_section ();
+       return data_section;
     }
 }
 /* Return register to use for a function return value with VALTYPE for function
@@ -2662,7 +2203,7 @@ iq2000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
 {
   int reg = GP_RETURN;
   enum machine_mode mode = TYPE_MODE (valtype);
-  int unsignedp = TREE_UNSIGNED (valtype);
+  int unsignedp = TYPE_UNSIGNED (valtype);
 
   /* Since we define TARGET_PROMOTE_FUNCTION_RETURN that returns true,
      we must promote the mode just as PROMOTE_MODE does.  */
@@ -2671,20 +2212,18 @@ iq2000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
   return gen_rtx_REG (mode, reg);
 }
 \f
-/* The implementation of FUNCTION_ARG_PASS_BY_REFERENCE.  Return
-   nonzero when an argument must be passed by reference.  */
+/* Return true when an argument must be passed by reference.  */
 
-int
-function_arg_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
-                               enum machine_mode mode, tree type,
-                               int named ATTRIBUTE_UNUSED)
+static bool
+iq2000_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+                         tree type, bool named ATTRIBUTE_UNUSED)
 {
   int size;
 
   /* We must pass by reference if we would be both passing in registers
      and the stack.  This is because any subsequent partial arg would be
      handled incorrectly in this case.  */
-  if (cum && MUST_PASS_IN_STACK (mode, type))
+  if (cum && targetm.calls.must_pass_in_stack (mode, type))
      {
        /* Don't pass the actual CUM to FUNCTION_ARG, because we would
          get double copies of any offsets generated for small structs
@@ -2881,15 +2420,16 @@ iq2000_output_conditional_branch (rtx insn, rtx * operands, int two_operands_p,
       }
 
     default:
-      abort ();
+      gcc_unreachable ();
     }
 
   /* NOTREACHED */
   return 0;
 }
 
-#define def_builtin(NAME, TYPE, CODE) \
-  builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, NULL, NULL_TREE)
+#define def_builtin(NAME, TYPE, CODE)                                  \
+  add_builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,   \
+                      NULL, NULL_TREE)
 
 static void
 iq2000_init_builtins (void)
@@ -3021,11 +2561,11 @@ void_ftype_int_int_int
   def_builtin ("__builtin_syscall", void_ftype, IQ2000_BUILTIN_SYSCALL);
 }
 
-/* Builtin for ICODE having ARGCOUNT args in ARGLIST where each arg
+/* Builtin for ICODE having ARGCOUNT args in EXP where each arg
    has an rtx CODE.  */
 
 static rtx
-expand_one_builtin (enum insn_code icode, rtx target, tree arglist,
+expand_one_builtin (enum insn_code icode, rtx target, tree exp,
                    enum rtx_code *code, int argcount)
 {
   rtx pat;
@@ -3037,12 +2577,11 @@ expand_one_builtin (enum insn_code icode, rtx target, tree arglist,
   mode[0] = insn_data[icode].operand[0].mode;
   for (i = 0; i < argcount; i++)
     {
-      arg[i] = TREE_VALUE (arglist);
-      arglist = TREE_CHAIN (arglist);
+      arg[i] = CALL_EXPR_ARG (exp, i);
       op[i] = expand_expr (arg[i], NULL_RTX, VOIDmode, 0);
       mode[i] = insn_data[icode].operand[i].mode;
       if (code[i] == CONST_INT && GET_CODE (op[i]) != CONST_INT)
-       error ("argument `%d' is not a constant", i + 1);
+       error ("argument %qd is not a constant", i + 1);
       if (code[i] == REG
          && ! (*insn_data[icode].operand[i].predicate) (op[i], mode[i]))
        op[i] = copy_to_mode_reg (mode[i], op[i]);
@@ -3087,7 +2626,7 @@ expand_one_builtin (enum insn_code icode, rtx target, tree arglist,
        pat = GEN_FCN (icode) (op[0], op[1], op[2], op[3]);
       break;
     default:
-      abort ();
+      gcc_unreachable ();
     }
   
   if (! pat)
@@ -3107,8 +2646,7 @@ iq2000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
                       enum machine_mode mode ATTRIBUTE_UNUSED,
                       int ignore ATTRIBUTE_UNUSED)
 {
-  tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
-  tree arglist = TREE_OPERAND (exp, 1);
+  tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
   int fcode = DECL_FUNCTION_CODE (fndecl);
   enum rtx_code code [5];
 
@@ -3123,162 +2661,162 @@ iq2000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
       break;
       
     case IQ2000_BUILTIN_ADO16:
-      return expand_one_builtin (CODE_FOR_ado16, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_ado16, target, exp, code, 2);
 
     case IQ2000_BUILTIN_RAM:
       code[1] = CONST_INT;
       code[2] = CONST_INT;
       code[3] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_ram, target, arglist, code, 4);
+      return expand_one_builtin (CODE_FOR_ram, target, exp, code, 4);
       
     case IQ2000_BUILTIN_CHKHDR:
-      return expand_one_builtin (CODE_FOR_chkhdr, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_chkhdr, target, exp, code, 2);
       
     case IQ2000_BUILTIN_PKRL:
-      return expand_one_builtin (CODE_FOR_pkrl, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_pkrl, target, exp, code, 2);
 
     case IQ2000_BUILTIN_CFC0:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_cfc0, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_cfc0, target, exp, code, 1);
 
     case IQ2000_BUILTIN_CFC1:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_cfc1, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_cfc1, target, exp, code, 1);
 
     case IQ2000_BUILTIN_CFC2:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_cfc2, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_cfc2, target, exp, code, 1);
 
     case IQ2000_BUILTIN_CFC3:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_cfc3, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_cfc3, target, exp, code, 1);
 
     case IQ2000_BUILTIN_CTC0:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_ctc0, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_ctc0, target, exp, code, 2);
 
     case IQ2000_BUILTIN_CTC1:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_ctc1, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_ctc1, target, exp, code, 2);
 
     case IQ2000_BUILTIN_CTC2:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_ctc2, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_ctc2, target, exp, code, 2);
 
     case IQ2000_BUILTIN_CTC3:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_ctc3, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_ctc3, target, exp, code, 2);
 
     case IQ2000_BUILTIN_MFC0:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mfc0, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_mfc0, target, exp, code, 1);
 
     case IQ2000_BUILTIN_MFC1:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mfc1, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_mfc1, target, exp, code, 1);
 
     case IQ2000_BUILTIN_MFC2:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mfc2, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_mfc2, target, exp, code, 1);
 
     case IQ2000_BUILTIN_MFC3:
       code[0] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mfc3, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_mfc3, target, exp, code, 1);
 
     case IQ2000_BUILTIN_MTC0:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mtc0, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_mtc0, target, exp, code, 2);
 
     case IQ2000_BUILTIN_MTC1:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mtc1, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_mtc1, target, exp, code, 2);
 
     case IQ2000_BUILTIN_MTC2:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mtc2, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_mtc2, target, exp, code, 2);
 
     case IQ2000_BUILTIN_MTC3:
       code[1] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mtc3, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_mtc3, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUR:
-      return expand_one_builtin (CODE_FOR_lur, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_lur, target, exp, code, 2);
 
     case IQ2000_BUILTIN_RB:
-      return expand_one_builtin (CODE_FOR_rb, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_rb, target, exp, code, 2);
 
     case IQ2000_BUILTIN_RX:
-      return expand_one_builtin (CODE_FOR_rx, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_rx, target, exp, code, 2);
 
     case IQ2000_BUILTIN_SRRD:
-      return expand_one_builtin (CODE_FOR_srrd, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_srrd, target, exp, code, 1);
 
     case IQ2000_BUILTIN_SRWR:
-      return expand_one_builtin (CODE_FOR_srwr, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_srwr, target, exp, code, 2);
 
     case IQ2000_BUILTIN_WB:
-      return expand_one_builtin (CODE_FOR_wb, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_wb, target, exp, code, 2);
 
     case IQ2000_BUILTIN_WX:
-      return expand_one_builtin (CODE_FOR_wx, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_wx, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUC32L:
-      return expand_one_builtin (CODE_FOR_luc32l, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_luc32l, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUC64:
-      return expand_one_builtin (CODE_FOR_luc64, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_luc64, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUC64L:
-      return expand_one_builtin (CODE_FOR_luc64l, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_luc64l, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUK:
-      return expand_one_builtin (CODE_FOR_luk, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_luk, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LULCK:
-      return expand_one_builtin (CODE_FOR_lulck, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_lulck, target, exp, code, 1);
 
     case IQ2000_BUILTIN_LUM32:
-      return expand_one_builtin (CODE_FOR_lum32, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_lum32, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUM32L:
-      return expand_one_builtin (CODE_FOR_lum32l, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_lum32l, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUM64:
-      return expand_one_builtin (CODE_FOR_lum64, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_lum64, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LUM64L:
-      return expand_one_builtin (CODE_FOR_lum64l, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_lum64l, target, exp, code, 2);
 
     case IQ2000_BUILTIN_LURL:
-      return expand_one_builtin (CODE_FOR_lurl, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_lurl, target, exp, code, 2);
 
     case IQ2000_BUILTIN_MRGB:
       code[2] = CONST_INT;
-      return expand_one_builtin (CODE_FOR_mrgb, target, arglist, code, 3);
+      return expand_one_builtin (CODE_FOR_mrgb, target, exp, code, 3);
 
     case IQ2000_BUILTIN_SRRDL:
-      return expand_one_builtin (CODE_FOR_srrdl, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_srrdl, target, exp, code, 1);
 
     case IQ2000_BUILTIN_SRULCK:
-      return expand_one_builtin (CODE_FOR_srulck, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_srulck, target, exp, code, 1);
 
     case IQ2000_BUILTIN_SRWRU:
-      return expand_one_builtin (CODE_FOR_srwru, target, arglist, code, 2);
+      return expand_one_builtin (CODE_FOR_srwru, target, exp, code, 2);
 
     case IQ2000_BUILTIN_TRAPQFL:
-      return expand_one_builtin (CODE_FOR_trapqfl, target, arglist, code, 0);
+      return expand_one_builtin (CODE_FOR_trapqfl, target, exp, code, 0);
 
     case IQ2000_BUILTIN_TRAPQNE:
-      return expand_one_builtin (CODE_FOR_trapqne, target, arglist, code, 0);
+      return expand_one_builtin (CODE_FOR_trapqne, target, exp, code, 0);
 
     case IQ2000_BUILTIN_TRAPREL:
-      return expand_one_builtin (CODE_FOR_traprel, target, arglist, code, 1);
+      return expand_one_builtin (CODE_FOR_traprel, target, exp, code, 1);
 
     case IQ2000_BUILTIN_WBU:
-      return expand_one_builtin (CODE_FOR_wbu, target, arglist, code, 3);
+      return expand_one_builtin (CODE_FOR_wbu, target, exp, code, 3);
 
     case IQ2000_BUILTIN_SYSCALL:
-      return expand_one_builtin (CODE_FOR_syscall, target, arglist, code, 0);
+      return expand_one_builtin (CODE_FOR_syscall, target, exp, code, 0);
     }
   
   return NULL_RTX;
@@ -3592,15 +3130,7 @@ print_operand (FILE *file, rtx op, int letter)
 
   else if (letter == 'Z')
     {
-      int regnum;
-
-      if (code != REG)
-       abort ();
-
-      regnum = REGNO (op);
-      abort ();
-
-      fprintf (file, "%s,", reg_names[regnum]);
+      gcc_unreachable ();
     }
 
   else if (code == REG || code == SUBREG)