rx.h (PTRDIFF_TYPE): Define.
authorNick Clifton <nickc@redhat.com>
Mon, 21 Jun 2010 11:27:32 +0000 (11:27 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Mon, 21 Jun 2010 11:27:32 +0000 (11:27 +0000)
        * config/rx/rx.h (PTRDIFF_TYPE): Define.
        (SMALL_REGISTER_CLASS): Define (to zero).
        (PRINT_OPERAND): Delete.
        (PRINT_OPERAND_ADDRESS): Delete.
        * config/rx/rx-protos.h (rx_print_operand): Delete prototype.
        (rx_print_operand_address): Delete prototype.
        * config/rx/rx.c (rx_print_operand): Make static.
        Allow %H and %L to handle CONST_DOUBLEs.
        (rx_print_operand_address): Make static.
        (rx_gen_move_template): Rename local variable 'template' to
        out_template.
        (rx_function_arg): Do not pass unknown sized objects in
        registers.
        (TARGET_PRINT_OPERAND): Define.
        (TARGET_PRINT_OPERAND_ADDRESS): Define.

From-SVN: r161068

gcc/ChangeLog
gcc/config/rx/rx-protos.h
gcc/config/rx/rx.c
gcc/config/rx/rx.h

index f40897a..0a73e94 100644 (file)
@@ -1,3 +1,21 @@
+2010-06-21  Nick Clifton  <nickc@redhat.com>
+
+       * config/rx/rx.h (PTRDIFF_TYPE): Define.
+       (SMALL_REGISTER_CLASS): Define (to zero).
+       (PRINT_OPERAND): Delete.
+       (PRINT_OPERAND_ADDRESS): Delete.
+       * config/rx/rx-protos.h (rx_print_operand): Delete prototype.
+       (rx_print_operand_address): Delete prototype.
+       * config/rx/rx.c (rx_print_operand): Make static.
+       Allow %H and %L to handle CONST_DOUBLEs.
+       (rx_print_operand_address): Make static.
+       (rx_gen_move_template): Rename local variable 'template' to
+       out_template.
+       (rx_function_arg): Do not pass unknown sized objects in
+       registers.
+       (TARGET_PRINT_OPERAND): Define.
+       (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
 2010-06-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * Makefile.in (POD2MAN): Provide --date from $(DATESTAMP).
index f5ef511..a2a28c1 100644 (file)
@@ -41,8 +41,6 @@ extern bool           rx_is_legitimate_constant (rtx);
 extern bool            rx_is_mode_dependent_addr (rtx);
 extern bool            rx_is_restricted_memory_address (rtx, Mmode);
 extern void            rx_notice_update_cc (rtx body, rtx insn);
-extern void            rx_print_operand (FILE *, rtx, int);
-extern void            rx_print_operand_address (FILE *, rtx);
 #endif
 
 #ifdef TREE_CODE
index 633b586..8d9e462 100644 (file)
@@ -50,6 +50,8 @@
 #include "target-def.h"
 #include "langhooks.h"
 \f
+static void rx_print_operand (FILE *, rtx, int);
+
 enum rx_cpu_types  rx_cpu_type = RX600;
 \f
 /* Return true if OP is a reference to an object in a small data area.  */
@@ -254,7 +256,7 @@ rx_is_mode_dependent_addr (rtx addr)
    assembler syntax for an instruction operand that is a memory
    reference whose address is ADDR.  */
 
-void
+static void
 rx_print_operand_address (FILE * file, rtx addr)
 {
   switch (GET_CODE (addr))
@@ -362,10 +364,11 @@ int rx_float_compare_mode;
      %F  Print a condition code flag name.
      %H  Print high part of a DImode register, integer or address.
      %L  Print low part of a DImode register, integer or address.
+     %N  Print the negation of the immediate value.
      %Q  If the operand is a MEM, then correctly generate
          register indirect or register relative addressing.  */
 
-void
+static void
 rx_print_operand (FILE * file, rtx op, int letter)
 {
   switch (letter)
@@ -422,7 +425,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
        case 0xc: fprintf (file, "intb"); break;
        default:
          warning (0, "unreocgnized control register number: %d - using 'psw'",
-                  INTVAL (op));
+                  (int) INTVAL (op));
          fprintf (file, "psw");
          break;
        }
@@ -444,43 +447,57 @@ rx_print_operand (FILE * file, rtx op, int letter)
       break;
 
     case 'H':
-      if (REG_P (op))
-       fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 0 : 1)]);
-      else if (CONST_INT_P (op))
+      switch (GET_CODE (op))
        {
-         HOST_WIDE_INT v = INTVAL (op);
+       case REG:
+         fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 0 : 1)]);
+         break;
+       case CONST_INT:
+         {
+           HOST_WIDE_INT v = INTVAL (op);
 
+           fprintf (file, "#");
+           /* Trickery to avoid problems with shifting 32 bits at a time.  */
+           v = v >> 16;
+           v = v >> 16;          
+           rx_print_integer (file, v);
+           break;
+         }
+       case CONST_DOUBLE:
          fprintf (file, "#");
-         /* Trickery to avoid problems with shifting 32 bits at a time.  */
-         v = v >> 16;
-         v = v >> 16;    
-         rx_print_integer (file, v);
-       }
-      else
-       {
-         gcc_assert (MEM_P (op));
-
+         rx_print_integer (file, CONST_DOUBLE_HIGH (op));
+         break;
+       case MEM:
          if (! WORDS_BIG_ENDIAN)
            op = adjust_address (op, SImode, 4);
          output_address (XEXP (op, 0));
+         break;
+       default:
+         gcc_unreachable ();
        }
       break;
 
     case 'L':
-      if (REG_P (op))
-       fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 1 : 0)]);
-      else if (CONST_INT_P (op))
+      switch (GET_CODE (op))
        {
+       case REG:
+         fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 1 : 0)]);
+         break;
+       case CONST_INT:
          fprintf (file, "#");
          rx_print_integer (file, INTVAL (op) & 0xffffffff);
-       }
-      else
-       {
-         gcc_assert (MEM_P (op));
-
+         break;
+       case CONST_DOUBLE:
+         fprintf (file, "#");
+         rx_print_integer (file, CONST_DOUBLE_LOW (op));
+         break;
+       case MEM:
          if (WORDS_BIG_ENDIAN)
            op = adjust_address (op, SImode, 4);
          output_address (XEXP (op, 0));
+         break;
+       default:
+         gcc_unreachable ();
        }
       break;
 
@@ -634,7 +651,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
 char *
 rx_gen_move_template (rtx * operands, bool is_movu)
 {
-  static char  template [64];
+  static char  out_template [64];
   const char * extension = TARGET_AS100_SYNTAX ? ".L" : "";
   const char * src_template;
   const char * dst_template;
@@ -678,9 +695,9 @@ rx_gen_move_template (rtx * operands, bool is_movu)
   else
     dst_template = "%0";
 
-  sprintf (template, "%s%s\t%s, %s", is_movu ? "movu" : "mov",
+  sprintf (out_template, "%s%s\t%s, %s", is_movu ? "movu" : "mov",
           extension, src_template, dst_template);
-  return template;
+  return out_template;
 }
 
 /* Returns an assembler template for a conditional branch instruction.  */
@@ -690,7 +707,6 @@ rx_gen_cond_branch_template (rtx condition, bool reversed)
 {
   enum rtx_code code = GET_CODE (condition);
 
-
   if ((cc_status.flags & CC_NO_OVERFLOW) && ! rx_float_compare_mode)
     gcc_assert (code != GT && code != GE && code != LE && code != LT);
 
@@ -777,6 +793,9 @@ rx_function_arg (Fargs * cum, Mmode mode, const_tree type, bool named)
 
   /* An exploded version of rx_function_arg_size.  */
   size = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
+  /* If the size is not known it cannot be passed in registers.  */
+  if (size < 1)
+    return NULL_RTX;
 
   rounded_size = rx_round_up (size, UNITS_PER_WORD);
 
@@ -2585,6 +2604,12 @@ rx_trampoline_init (rtx tramp, tree fndecl, rtx chain)
 #undef  TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT                 rx_trampoline_init
 
+#undef  TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND                   rx_print_operand
+
+#undef  TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS           rx_print_operand_address
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* #include "gt-rx.h" */
index 8be66b5..cb63951 100644 (file)
@@ -142,6 +142,8 @@ extern enum rx_cpu_types  rx_cpu_type;
 #define POINTER_SIZE                   32
 #undef  SIZE_TYPE
 #define SIZE_TYPE                      "long unsigned int"
+#undef  PTRDIFF_TYPE
+#define PTRDIFF_TYPE                   "long int"
 #define POINTERS_EXTEND_UNSIGNED       1
 #define FUNCTION_MODE                  QImode
 #define CASE_VECTOR_MODE               Pmode
@@ -196,6 +198,7 @@ enum reg_class
     GR_REGS, LIM_REG_CLASSES                           \
   }
 
+#define SMALL_REGISTER_CLASSES                 0
 #define N_REG_CLASSES                  (int) LIM_REG_CLASSES
 #define CLASS_MAX_NREGS(CLASS, MODE)    ((GET_MODE_SIZE (MODE) \
                                          + UNITS_PER_WORD - 1) \
@@ -607,11 +610,6 @@ typedef unsigned int CUMULATIVE_ARGS;
    they contain are always computed between two same-section symbols.  */
 #define JUMP_TABLES_IN_TEXT_SECTION    (flag_pic)
 \f
-#define PRINT_OPERAND(FILE, X, CODE)           \
-  rx_print_operand (FILE, X, CODE)
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR)      \
-  rx_print_operand_address (FILE, ADDR)
-\f
 #define CC_NO_CARRY                    0400
 #define NOTICE_UPDATE_CC(EXP, INSN)    rx_notice_update_cc (EXP, INSN)