OSDN Git Service

* config/iq2000/iq2000.c (function_arg): Handle TImode values.
[pf3gnuchains/gcc-fork.git] / gcc / config / iq2000 / iq2000.c
index b66a485..d853b1f 100644 (file)
@@ -1,5 +1,6 @@
 /* Subroutines used for code generation on Vitesse IQ2000 processors
-   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -88,7 +89,7 @@ struct iq2000_frame_info
   int  num_gp;                 /* Number of gp registers saved.  */
 } iq2000_frame_info;
 
-struct machine_function GTY(())
+struct GTY(()) machine_function
 {
   /* Current frame information, calculated by compute_frame_size.  */
   long total_size;             /* # bytes that the entire frame takes up.  */
@@ -161,8 +162,8 @@ static bool iq2000_return_in_memory   (const_tree, const_tree);
 static void iq2000_setup_incoming_varargs (CUMULATIVE_ARGS *,
                                           enum machine_mode, tree, int *,
                                           int);
-static bool iq2000_rtx_costs          (rtx, int, int, int *);
-static int  iq2000_address_cost       (rtx);
+static bool iq2000_rtx_costs          (rtx, int, int, int *, bool);
+static int  iq2000_address_cost       (rtx, bool);
 static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
 static bool iq2000_pass_by_reference  (CUMULATIVE_ARGS *, enum machine_mode,
                                       const_tree, bool);
@@ -744,7 +745,7 @@ iq2000_move_1word (rtx operands[], rtx insn, int unsignedp)
 /* Provide the costs of an addressing mode that contains ADDR.  */
 
 static int
-iq2000_address_cost (rtx addr)
+iq2000_address_cost (rtx addr, bool speed)
 {
   switch (GET_CODE (addr))
     {
@@ -795,7 +796,7 @@ iq2000_address_cost (rtx addr)
          case LABEL_REF:
          case HIGH:
          case LO_SUM:
-           return iq2000_address_cost (plus1) + 1;
+           return iq2000_address_cost (plus1, speed) + 1;
 
          default:
            break;
@@ -937,15 +938,15 @@ gen_int_relational (enum rtx_code test_code, rtx result, rtx cmp0, rtx cmp1,
     {
       if (p_info->const_add != 0)
        {
-         HOST_WIDE_INT new = INTVAL (cmp1) + p_info->const_add;
+         HOST_WIDE_INT new_const = INTVAL (cmp1) + p_info->const_add;
 
          /* If modification of cmp1 caused overflow,
             we would get the wrong answer if we follow the usual path;
             thus, x > 0xffffffffU would turn into x > 0U.  */
          if ((p_info->unsignedp
-              ? (unsigned HOST_WIDE_INT) new >
+              ? (unsigned HOST_WIDE_INT) new_const >
               (unsigned HOST_WIDE_INT) INTVAL (cmp1)
-              : new > INTVAL (cmp1))
+              : new_const > INTVAL (cmp1))
              != (p_info->const_add > 0))
            {
              /* This test is always true, but if INVERT is true then
@@ -955,7 +956,7 @@ gen_int_relational (enum rtx_code test_code, rtx result, rtx cmp0, rtx cmp1,
              return result;
            }
          else
-           cmp1 = GEN_INT (new);
+           cmp1 = GEN_INT (new_const);
        }
     }
 
@@ -1174,6 +1175,11 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
       cum->arg_words += 2;
       break;
 
+    case TImode:
+      cum->gp_reg_found = 1;
+      cum->arg_words += 4;
+      break;
+
     case QImode:
     case HImode:
     case SImode:
@@ -1244,6 +1250,12 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type,
     case DImode:
       cum->arg_words += (cum->arg_words & 1);
       regbase = GP_ARG_FIRST;
+      break;
+
+    case TImode:
+      cum->arg_words += (cum->arg_words & 3);
+      regbase = GP_ARG_FIRST;
+      break;
     }
 
   if (*arg_words >= (unsigned) MAX_ARGS_IN_REGISTERS)
@@ -3203,7 +3215,8 @@ print_operand (FILE *file, rtx op, int letter)
 }
 
 static bool
-iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total)
+iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total,
+                 bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);