OSDN Git Service

2004-02-07 Paolo Bonzini <bonzini@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / config / s390 / s390.c
index 3531d87..7e7489a 100644 (file)
@@ -73,7 +73,6 @@ static int s390_adjust_priority (rtx, int);
 static int s390_issue_rate (void);
 static int s390_use_dfa_pipeline_interface (void);
 static int s390_first_cycle_multipass_dfa_lookahead (void);
-static int s390_sched_reorder2 (FILE *, int, rtx *, int *, int);
 static bool s390_rtx_costs (rtx, int, int, int *);
 static int s390_address_cost (rtx);
 static void s390_reorg (void);
@@ -132,8 +131,6 @@ static tree s390_build_builtin_va_list (void);
 #define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE s390_use_dfa_pipeline_interface
 #undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
 #define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD s390_first_cycle_multipass_dfa_lookahead
-#undef TARGET_SCHED_REORDER2
-#define TARGET_SCHED_REORDER2 s390_sched_reorder2
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS s390_rtx_costs
@@ -154,9 +151,6 @@ static tree s390_build_builtin_va_list (void);
 #undef TARGET_PROMOTE_FUNCTION_RETURN
 #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
 
-#undef TARGET_STRUCT_VALUE_RTX
-#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
-
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 extern int reload_completed;
@@ -473,7 +467,7 @@ s390_alc_comparison (rtx op, enum machine_mode mode)
   if (mode != VOIDmode && mode != GET_MODE (op))
     return 0;
 
-  if (GET_RTX_CLASS (GET_CODE (op)) != '<')
+  if (!COMPARISON_P (op))
     return 0;
 
   if (GET_CODE (XEXP (op, 0)) != REG
@@ -515,7 +509,7 @@ s390_slb_comparison (rtx op, enum machine_mode mode)
   if (mode != VOIDmode && mode != GET_MODE (op))
     return 0;
 
-  if (GET_RTX_CLASS (GET_CODE (op)) != '<')
+  if (!COMPARISON_P (op))
     return 0;
 
   if (GET_CODE (XEXP (op, 0)) != REG
@@ -2081,8 +2075,6 @@ s390_decompose_address (register rtx addr, struct s390_address *out)
              && frame_pointer_needed
              && REGNO (base) == HARD_FRAME_POINTER_REGNUM)
          || REGNO (base) == ARG_POINTER_REGNUM
-         || (REGNO (base) >= FIRST_VIRTUAL_REGISTER
-             && REGNO (base) <= LAST_VIRTUAL_REGISTER)
           || (flag_pic
               && REGNO (base) == PIC_OFFSET_TABLE_REGNUM))
         pointer = base_ptr = TRUE;
@@ -2108,8 +2100,6 @@ s390_decompose_address (register rtx addr, struct s390_address *out)
              && frame_pointer_needed
              && REGNO (indx) == HARD_FRAME_POINTER_REGNUM)
          || REGNO (indx) == ARG_POINTER_REGNUM
-         || (REGNO (indx) >= FIRST_VIRTUAL_REGISTER
-             && REGNO (indx) <= LAST_VIRTUAL_REGISTER)
           || (flag_pic
               && REGNO (indx) == PIC_OFFSET_TABLE_REGNUM))
         pointer = indx_ptr = TRUE;
@@ -2523,7 +2513,7 @@ legitimize_pic_address (rtx orig, rtx reg)
                           int even = INTVAL (op1) - 1;
                           op0 = gen_rtx_PLUS (Pmode, op0, GEN_INT (even));
                          op0 = gen_rtx_CONST (Pmode, op0);
-                          op1 = GEN_INT (1);
+                          op1 = const1_rtx;
                         }
 
                       emit_move_insn (temp, op0);
@@ -3311,98 +3301,63 @@ get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED)
   return 0;
 }
 
-/* Output symbolic constant X in assembler syntax to
-   stdio stream FILE.  */
+/* Output machine-dependent UNSPECs occurring in address constant X 
+   in assembler syntax to stdio stream FILE.  Returns true if the
+   constant X could be recognized, false otherwise.  */
 
-void
-s390_output_symbolic_const (FILE *file, rtx x)
+bool
+s390_output_addr_const_extra (FILE *file, rtx x)
 {
-  switch (GET_CODE (x))
-    {
-    case CONST:
-    case ZERO_EXTEND:
-    case SIGN_EXTEND:
-      s390_output_symbolic_const (file, XEXP (x, 0));
-      break;
-
-    case PLUS:
-      s390_output_symbolic_const (file, XEXP (x, 0));
-      fprintf (file, "+");
-      s390_output_symbolic_const (file, XEXP (x, 1));
-      break;
-
-    case MINUS:
-      s390_output_symbolic_const (file, XEXP (x, 0));
-      fprintf (file, "-");
-      s390_output_symbolic_const (file, XEXP (x, 1));
-      break;
-
-    case CONST_INT:
-    case LABEL_REF:
-    case CODE_LABEL:
-    case SYMBOL_REF:
-      output_addr_const (file, x);
-      break;
-
-    case UNSPEC:
-      if (XVECLEN (x, 0) != 1)
-        output_operand_lossage ("invalid UNSPEC as operand (1)");
-      switch (XINT (x, 1))
-        {
-       case UNSPEC_GOTENT:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@GOTENT");
-         break;
-       case UNSPEC_GOT:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@GOT");
-         break;
-       case UNSPEC_GOTOFF:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@GOTOFF");
-         break;
-       case UNSPEC_PLT:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@PLT");
-         break;
-       case UNSPEC_PLTOFF:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@PLTOFF");
-         break;
-       case UNSPEC_TLSGD:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@TLSGD");
-         break;
-       case UNSPEC_TLSLDM:
-         assemble_name (file, get_some_local_dynamic_name ());
-         fprintf (file, "@TLSLDM");
-         break;
-       case UNSPEC_DTPOFF:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@DTPOFF");
-         break;
-       case UNSPEC_NTPOFF:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@NTPOFF");
-         break;
-       case UNSPEC_GOTNTPOFF:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@GOTNTPOFF");
-         break;
-       case UNSPEC_INDNTPOFF:
-         s390_output_symbolic_const (file, XVECEXP (x, 0, 0));
-         fprintf (file, "@INDNTPOFF");
-         break;
-       default:
-         output_operand_lossage ("invalid UNSPEC as operand (2)");
-         break;
-        }
-      break;
+  if (GET_CODE (x) == UNSPEC && XVECLEN (x, 0) == 1)
+    switch (XINT (x, 1))
+      {
+      case UNSPEC_GOTENT:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@GOTENT");
+       return true;
+      case UNSPEC_GOT:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@GOT");
+       return true;
+      case UNSPEC_GOTOFF:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@GOTOFF");
+       return true;
+      case UNSPEC_PLT:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@PLT");
+       return true;
+      case UNSPEC_PLTOFF:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@PLTOFF");
+       return true;
+      case UNSPEC_TLSGD:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@TLSGD");
+       return true;
+      case UNSPEC_TLSLDM:
+       assemble_name (file, get_some_local_dynamic_name ());
+       fprintf (file, "@TLSLDM");
+       return true;
+      case UNSPEC_DTPOFF:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@DTPOFF");
+       return true;
+      case UNSPEC_NTPOFF:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@NTPOFF");
+       return true;
+      case UNSPEC_GOTNTPOFF:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@GOTNTPOFF");
+       return true;
+      case UNSPEC_INDNTPOFF:
+       output_addr_const (file, XVECEXP (x, 0, 0));
+       fprintf (file, "@INDNTPOFF");
+       return true;
+      }
 
-    default:
-      fatal_insn ("UNKNOWN in s390_output_symbolic_const !?", x);
-      break;
-    }
+  return false;
 }
 
 /* Output address operand ADDR in assembler syntax to
@@ -3419,7 +3374,7 @@ print_operand_address (FILE *file, rtx addr)
     output_operand_lossage ("Cannot decompose address.");
 
   if (ad.disp)
-    s390_output_symbolic_const (file, ad.disp);
+    output_addr_const (file, ad.disp);
   else
     fprintf (file, "0");
 
@@ -3493,7 +3448,7 @@ print_operand (FILE *file, rtx x, int code)
           abort ();
 
         if (ad.disp)
-          s390_output_symbolic_const (file, ad.disp);
+          output_addr_const (file, ad.disp);
         else
           fprintf (file, "0");
       }
@@ -3553,7 +3508,7 @@ print_operand (FILE *file, rtx x, int code)
     case CODE_LABEL:
     case LABEL_REF:
     case SYMBOL_REF:
-      s390_output_symbolic_const (file, x);
+      output_addr_const (file, x);
       break;
 
     case CONST_INT:
@@ -3832,19 +3787,6 @@ s390_first_cycle_multipass_dfa_lookahead (void)
   return s390_use_dfa_pipeline_interface () ? 4 : 0;
 }
 
-/* Called after issuing each insn.
-   Triggers default sort algorithm to better slot instructions.  */
-
-static int
-s390_sched_reorder2 (FILE *dump ATTRIBUTE_UNUSED,
-                    int sched_verbose ATTRIBUTE_UNUSED,
-                    rtx *ready ATTRIBUTE_UNUSED,
-                    int *pn_ready ATTRIBUTE_UNUSED,
-                    int clock_var ATTRIBUTE_UNUSED)
-{
-    return s390_issue_rate();
-}
-
 
 /* Split all branches that exceed the maximum distance.
    Returns true if this created a new literal pool entry.  */
@@ -4431,6 +4373,10 @@ s390_mainpool_start (void)
 
   if (pool->size >= 4096)
     {
+      /* We're going to chunkify the pool, so remove the main
+        pool placeholder insn.  */
+      remove_insn (pool->pool_insn);
+
       s390_free_pool (pool);
       pool = NULL;
     }
@@ -4938,12 +4884,10 @@ s390_chunkify_cancel (struct constant_pool *pool_list)
 }
 
 
-/* Output to FILE the constant pool entry EXP in mode MODE
-   with alignment ALIGN.  */
+/* Output the constant pool entry EXP in mode MODE with alignment ALIGN.  */
 
 void
-s390_output_pool_entry (FILE *file, rtx exp, enum machine_mode mode, 
-                       unsigned int align)
+s390_output_pool_entry (rtx exp, enum machine_mode mode, unsigned int align)
 {
   REAL_VALUE_TYPE r;
 
@@ -4958,18 +4902,7 @@ s390_output_pool_entry (FILE *file, rtx exp, enum machine_mode mode,
       break;
 
     case MODE_INT:
-      if (GET_CODE (exp) == CONST
-         || GET_CODE (exp) == SYMBOL_REF
-         || GET_CODE (exp) == LABEL_REF)
-       {
-         fputs (integer_asm_op (GET_MODE_SIZE (mode), TRUE), file);
-         s390_output_symbolic_const (file, exp);
-         fputc ('\n', file);
-       }
-      else
-       {
-         assemble_integer (exp, GET_MODE_SIZE (mode), align, 1);
-       }
+      assemble_integer (exp, GET_MODE_SIZE (mode), align, 1);
       break;
 
     default:
@@ -6135,7 +6068,7 @@ s390_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
       if (cum->fprs + 1 > (TARGET_64BIT? 4 : 2))
        return 0;
       else
-       return gen_rtx (REG, mode, cum->fprs + 16);
+       return gen_rtx_REG (mode, cum->fprs + 16);
     }
   else if (s390_function_arg_integer (mode, type))
     {
@@ -6145,7 +6078,7 @@ s390_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
       if (cum->gprs + n_gprs > 5)
        return 0;
       else
-       return gen_rtx (REG, mode, cum->gprs + 2);
+       return gen_rtx_REG (mode, cum->gprs + 2);
     }
 
   /* After the real arguments, expand_call calls us once again
@@ -6681,12 +6614,10 @@ s390_trampoline_template (FILE *file)
 void
 s390_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt)
 {
-  emit_move_insn (gen_rtx
-                 (MEM, Pmode,
+  emit_move_insn (gen_rtx_MEM (Pmode,
                   memory_address (Pmode,
                   plus_constant (addr, (TARGET_64BIT ? 20 : 12) ))), cxt);
-  emit_move_insn (gen_rtx
-                 (MEM, Pmode,
+  emit_move_insn (gen_rtx_MEM (Pmode,
                   memory_address (Pmode,
                   plus_constant (addr, (TARGET_64BIT ? 28 : 16) ))), fnaddr);
 }