Makefile.in (TARGET_H, [...]): New.
[gcc.git] / gcc / config / m68k / m68k.c
index 8a798b7df656ddaecb395b7a14275e0842e35d83..e377e77c15efec964e107db9430383d33efb1462 100644 (file)
@@ -1,5 +1,6 @@
 /* Subroutines for insn-output.c for Motorola 68000 family.
-   Copyright (C) 1987, 93-98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -28,11 +29,13 @@ Boston, MA 02111-1307, USA.  */
 #include "real.h"
 #include "insn-config.h"
 #include "conditions.h"
-#include "insn-flags.h"
 #include "output.h"
 #include "insn-attr.h"
 #include "recog.h"
 #include "toplev.h"
+#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Needed for use_return_insn.  */
 #include "flags.h"
@@ -51,9 +54,8 @@ enum reg_class regno_reg_class[]
    if SGS_SWITCH_TABLE.  */
 int switch_table_difference_label_flag;
 
-static rtx find_addr_reg ();
-rtx legitimize_pic_address ();
-void print_operand_address ();
+static rtx find_addr_reg PARAMS ((rtx));
+static const char *singlemove_string PARAMS ((rtx *));
 \f
 
 /* Alignment to use for loops and jumps */
@@ -75,7 +77,11 @@ int m68k_align_funcs;
    sCC expanders peek at this to determine what to do for the
    68060, which has no fsCC instructions.  */
 int m68k_last_compare_had_fp_operands;
+\f
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+\f
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
@@ -89,41 +95,43 @@ void
 override_options ()
 {
   int def_align;
+  int i;
 
   def_align = 1;
 
   /* Validate -malign-loops= value, or provide default */
+  m68k_align_loops = def_align;
   if (m68k_align_loops_string)
     {
-      m68k_align_loops = atoi (m68k_align_loops_string);
-      if (m68k_align_loops < 1 || m68k_align_loops > MAX_CODE_ALIGN)
-       fatal ("-malign-loops=%d is not between 1 and %d",
-              m68k_align_loops, MAX_CODE_ALIGN);
+      i = atoi (m68k_align_loops_string);
+      if (i < 1 || i > MAX_CODE_ALIGN)
+       error ("-malign-loops=%d is not between 1 and %d", i, MAX_CODE_ALIGN);
+      else
+       m68k_align_loops = i;
     }
-  else
-    m68k_align_loops = def_align;
 
   /* Validate -malign-jumps= value, or provide default */
+  m68k_align_jumps = def_align;
   if (m68k_align_jumps_string)
     {
-      m68k_align_jumps = atoi (m68k_align_jumps_string);
-      if (m68k_align_jumps < 1 || m68k_align_jumps > MAX_CODE_ALIGN)
-       fatal ("-malign-jumps=%d is not between 1 and %d",
-              m68k_align_jumps, MAX_CODE_ALIGN);
+      i = atoi (m68k_align_jumps_string);
+      if (i < 1 || i > MAX_CODE_ALIGN)
+       error ("-malign-jumps=%d is not between 1 and %d", i, MAX_CODE_ALIGN);
+      else
+       m68k_align_jumps = i;
     }
-  else
-    m68k_align_jumps = def_align;
 
   /* Validate -malign-functions= value, or provide default */
+  m68k_align_funcs = def_align;
   if (m68k_align_funcs_string)
     {
-      m68k_align_funcs = atoi (m68k_align_funcs_string);
-      if (m68k_align_funcs < 1 || m68k_align_funcs > MAX_CODE_ALIGN)
-       fatal ("-malign-functions=%d is not between 1 and %d",
-              m68k_align_funcs, MAX_CODE_ALIGN);
+      i = atoi (m68k_align_funcs_string);
+      if (i < 1 || i > MAX_CODE_ALIGN)
+       error ("-malign-functions=%d is not between 1 and %d",
+              i, MAX_CODE_ALIGN);
+      else
+       m68k_align_funcs = i;
     }
-  else
-    m68k_align_funcs = def_align;
 }
 \f
 /* This function generates the assembly code for function entry.
@@ -217,8 +225,8 @@ output_function_prologue (stream, size)
           l = (char *) dwarf2out_cfi_label ();   
          cfa_store_offset += 4;
          cfa_offset = cfa_store_offset;
-         dwarf2out_def_cfa (l, FRAME_POINTER_REGNUM, cfa_offset);
          dwarf2out_reg_save (l, FRAME_POINTER_REGNUM, -cfa_store_offset);
+         dwarf2out_def_cfa (l, FRAME_POINTER_REGNUM, cfa_offset);
          cfa_store_offset += fsize;
        }
     }
@@ -1030,7 +1038,7 @@ output_dbcc_and_branch (operands)
     }
 }
 
-char *
+const char *
 output_scc_di(op, operand1, operand2, dest)
      rtx op;
      rtx operand1;
@@ -1217,7 +1225,7 @@ output_scc_di(op, operand1, operand2, dest)
   return "";
 }
 
-char *
+const char *
 output_btst (operands, countop, dataop, insn, signpos)
      rtx *operands;
      rtx countop, dataop;
@@ -1404,9 +1412,11 @@ legitimize_pic_address (orig, mode, reg)
 \f
 typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ } CONST_METHOD;
 
+static CONST_METHOD const_method PARAMS ((rtx));
+
 #define USE_MOVQ(i)    ((unsigned)((i) + 128) <= 255)
 
-CONST_METHOD
+static CONST_METHOD
 const_method (constant)
      rtx constant;
 {
@@ -1462,7 +1472,7 @@ const_int_cost (constant)
     }
 }
 
-char *
+const char *
 output_move_const_into_data_reg (operands)
      rtx *operands;
 {
@@ -1515,7 +1525,7 @@ output_move_const_into_data_reg (operands)
     }
 }
 
-char *
+const char *
 output_move_simode_const (operands)
      rtx *operands;
 {
@@ -1546,7 +1556,7 @@ output_move_simode_const (operands)
   return "move%.l %1,%0";
 }
 
-char *
+const char *
 output_move_simode (operands)
      rtx *operands;
 {
@@ -1563,7 +1573,7 @@ output_move_simode (operands)
   return "move%.l %1,%0";
 }
 
-char *
+const char *
 output_move_himode (operands)
      rtx *operands;
 {
@@ -1632,7 +1642,7 @@ output_move_himode (operands)
   return "move%.w %1,%0";
 }
 
-char *
+const char *
 output_move_qimode (operands)
      rtx *operands;
 {
@@ -1706,7 +1716,7 @@ output_move_qimode (operands)
   return "move%.b %1,%0";
 }
 
-char *
+const char *
 output_move_stricthi (operands)
      rtx *operands;
 {
@@ -1719,7 +1729,7 @@ output_move_stricthi (operands)
   return "move%.w %1,%0";
 }
 
-char *
+const char *
 output_move_strictqi (operands)
      rtx *operands;
 {
@@ -1735,7 +1745,7 @@ output_move_strictqi (operands)
 /* Return the best assembler insn template
    for moving operands[1] into operands[0] as a fullword.  */
 
-static char *
+static const char *
 singlemove_string (operands)
      rtx *operands;
 {
@@ -1752,7 +1762,7 @@ singlemove_string (operands)
 /* Output assembler code to perform a doubleword move insn
    with operands OPERANDS.  */
 
-char *
+const char *
 output_move_double (operands)
      rtx *operands;
 {
@@ -2130,7 +2140,7 @@ find_addr_reg (addr)
 
 /* Output assembler code to perform a 32 bit 3 operand add.  */
 
-char *
+const char *
 output_addsi3 (operands)
      rtx *operands;
 {
@@ -2336,7 +2346,7 @@ notice_update_cc (exp, insn)
     cc_status.flags = CC_IN_68881;
 }
 \f
-char *
+const char *
 output_move_const_double (operands)
      rtx *operands;
 {
@@ -2370,7 +2380,7 @@ output_move_const_double (operands)
     }
 }
 
-char *
+const char *
 output_move_const_single (operands)
      rtx *operands;
 {
@@ -2413,7 +2423,7 @@ output_move_const_single (operands)
   
 static int inited_68881_table = 0;
 
-char *strings_68881[7] = {
+static const char *const strings_68881[7] = {
   "0.0",
   "1.0",
   "10.0",
@@ -2545,7 +2555,7 @@ floating_exact_log2 (x)
 
 static int inited_FPA_table = 0;
 
-char *strings_FPA[38] = {
+static const char *const strings_FPA[38] = {
 /* small rationals */
   "0.0",
   "1.0",
@@ -3329,7 +3339,7 @@ const_uint32_operand (op, mode)
   return (GET_CODE (op) == CONST_INT
          && (INTVAL (op) >= 0 && INTVAL (op) <= 0xffffffffL));
 #else
-  return ((GET_CODE (op) == CONST_INT && INTVAL (op) >= 0)
+  return (GET_CODE (op) == CONST_INT
          || (GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_HIGH (op) == 0));
 #endif
 }
@@ -3464,13 +3474,13 @@ memory_src_operand (op, mode)
 int
 pcrel_address (op, mode)
      rtx op;
-     enum machine_mode mode;
+     enum machine_mode mode ATTRIBUTE_UNUSED;
 {
   return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF
          || GET_CODE (op) == CONST);
 }
 
-char *
+const char *
 output_andsi3 (operands)
      rtx *operands;
 {
@@ -3511,7 +3521,7 @@ output_andsi3 (operands)
   return "and%.l %2,%0";
 }
 
-char *
+const char *
 output_iorsi3 (operands)
      rtx *operands;
 {
@@ -3550,7 +3560,7 @@ output_iorsi3 (operands)
   return "or%.l %2,%0";
 }
 
-char *
+const char *
 output_xorsi3 (operands)
      rtx *operands;
 {