--- /dev/null
+/* Definitions of target machine for GNU compiler.
+ Hitachi H8/300 version generating coff
+ Copyright (C) 2000 Free SoftwareFoundation, Inc.
+ Contributed by Steve Chamberlain (sac@cygnus.com),
+ Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
+
+This file is part of GNU CC.
+
+GNU CC 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)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Declarations for functions used in insn-output.c. */
+#ifdef RTX_CODE
+extern const char *emit_a_shift PARAMS ((rtx, rtx *));
+extern const char *output_adds_subs PARAMS ((rtx *));
+extern const char * output_simode_bld PARAMS ((int, int, rtx[]));
+extern void print_operand_address PARAMS ((FILE *, rtx));
+extern const char *byte_reg PARAMS ((rtx, int));
+extern int const_costs PARAMS ((rtx, enum rtx_code));
+extern void print_operand PARAMS ((FILE *, rtx, int));
+extern void final_prescan_insn PARAMS ((rtx, rtx *, int));
+extern int do_movsi PARAMS ((rtx[]));
+extern void notice_update_cc PARAMS ((rtx, rtx));
+extern int expand_a_shift PARAMS ((enum machine_mode, int, rtx[]));
+extern int fix_bit_operand PARAMS ((rtx *, int, enum rtx_code));
+extern int h8300_adjust_insn_length PARAMS ((rtx, int));
+
+extern int general_operand_src PARAMS ((rtx, enum machine_mode));
+extern int general_operand_dst PARAMS ((rtx, enum machine_mode));
+extern int o_operand PARAMS ((rtx, enum machine_mode));
+extern int p_operand PARAMS ((rtx, enum machine_mode));
+extern int call_insn_operand PARAMS ((rtx, enum machine_mode));
+extern int adds_subs_operand PARAMS ((rtx, enum machine_mode));
+extern int one_insn_adds_subs_operand PARAMS ((rtx, enum machine_mode));
+extern int small_call_insn_operand PARAMS ((rtx, enum machine_mode));
+extern int jump_address_operand PARAMS ((rtx, enum machine_mode));
+extern int bit_operand PARAMS ((rtx, enum machine_mode));
+extern int bit_memory_operand PARAMS ((rtx, enum machine_mode));
+extern int eq_operator PARAMS ((rtx, enum machine_mode));
+extern int bit_operator PARAMS ((rtx, enum machine_mode));
+extern int nshift_operator PARAMS ((rtx, enum machine_mode));
+#endif /* RTX_CODE */
+
+#ifdef TREE_CODE
+extern struct rtx_def *function_arg PARAMS ((CUMULATIVE_ARGS *,
+ enum machine_mode, tree, int));
+extern int h8300_valid_machine_decl_attribute PARAMS ((tree, tree, tree,
+ tree));
+extern int h8300_funcvec_function_p PARAMS ((tree));
+extern int h8300_eightbit_data_p PARAMS ((tree));
+extern int h8300_tiny_data_p PARAMS ((tree));
+extern void h8300_encode_label PARAMS ((tree));
+#endif /* TREE_CODE */
+
+extern int handle_pragma PARAMS ((int (*)(void), void (*)(int), const char *));
+extern void h8300_init_once PARAMS ((void));
+extern void function_prologue PARAMS ((FILE *, int));
+extern void function_epilogue PARAMS ((FILE *, int));
+extern void asm_file_start PARAMS ((FILE *));
+extern void asm_file_end PARAMS ((FILE *));
+extern int ok_for_bclr PARAMS ((int));
+extern int small_power_of_two PARAMS ((int));
+extern int initial_offset PARAMS ((int, int));
/* Subroutines for insn-output.c for Hitachi H8/300.
- Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 1999 Free Software
+ Copyright (C) 1992, 93-99, 2000 Free Software
Foundation, Inc.
Contributed by Steve Chamberlain (sac@cygnus.com),
Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
#include "expr.h"
#include "function.h"
#include "obstack.h"
+#include "toplev.h"
+#include "tm_p.h"
/* Forward declarations. */
-void print_operand_address ();
-
static int h8300_interrupt_function_p PROTO ((tree));
static int h8300_monitor_function_p PROTO ((tree));
static int h8300_os_task_function_p PROTO ((tree));
+static void dosize PROTO ((FILE *, const char *, unsigned int));
+static const char *cond_string PROTO ((enum rtx_code));
/* CPU_TYPE, says what cpu we're compiling for. */
int cpu_type;
/* True if a #pragma saveall has been seen for the current function. */
int pragma_saveall;
-static char *names_big[] =
+static const char *const names_big[] =
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7"};
-static char *names_extended[] =
+static const char *const names_extended[] =
{"er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7"};
-static char *names_upper_extended[] =
+static const char *const names_upper_extended[] =
{"e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7"};
/* Points to one of the above. */
/* ??? The above could be put in an array indexed by CPU_TYPE. */
-char **h8_reg_names;
+const char * const *h8_reg_names;
/* Various operations needed by the following, indexed by CPU_TYPE. */
-static char *h8_push_ops[2] =
-{"push", "push.l"};
-static char *h8_pop_ops[2] =
-{"pop", "pop.l"};
-static char *h8_mov_ops[2] =
-{"mov.w", "mov.l"};
+static const char *const h8_push_ops[2] = {"push", "push.l"};
+static const char *const h8_pop_ops[2] = {"pop", "pop.l"};
+static const char *const h8_mov_ops[2] = {"mov.w", "mov.l"};
-char *h8_push_op, *h8_pop_op, *h8_mov_op;
+const char *h8_push_op, *h8_pop_op, *h8_mov_op;
/* Initialize various cpu specific globals at start up. */
h8_mov_op = h8_mov_ops[cpu_type];
}
-char *
+const char *
byte_reg (x, b)
rtx x;
int b;
{
- static char *names_small[] =
+ static const char *const names_small[] =
{"r0l", "r0h", "r1l", "r1h", "r2l", "r2h", "r3l", "r3h",
"r4l", "r4h", "r5l", "r5h", "r6l", "r6h", "r7l", "r7h"};
static void
dosize (file, op, size)
FILE *file;
- char *op;
+ const char *op;
unsigned int size;
{
/* On the h8300h and h8300s, for sizes <= 8 bytes it is as good or
FILE *file;
int size;
{
- register int mask = 0;
int fsize = (size + STACK_BOUNDARY / 8 - 1) & -STACK_BOUNDARY / 8;
int idx;
FILE *file;
int size;
{
- register int regno;
- register int mask = 0;
int fsize = (size + STACK_BOUNDARY / 8 - 1) & -STACK_BOUNDARY / 8;
int idx;
rtx insn = get_last_insn ();
/* Output assembly code for the start of the file. */
+void
asm_file_start (file)
FILE *file;
{
int
o_operand (operand, mode)
rtx operand;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return (GET_CODE (operand) == CONST_INT
&& CONST_OK_FOR_O (INTVAL (operand)));
int
p_operand (operand, mode)
rtx operand;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return (GET_CODE (operand) == CONST_INT
&& CONST_OK_FOR_P (INTVAL (operand)));
int
call_insn_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
if (GET_CODE (op) == MEM)
{
int
adds_subs_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
if (GET_CODE (op) == CONST_INT)
{
int
one_insn_adds_subs_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
int val = INTVAL (op);
return 0;
}
-char *
+const char *
output_adds_subs (operands)
rtx *operands;
{
int
small_call_insn_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
if (GET_CODE (op) == MEM)
{
int
bit_memory_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return (GET_CODE (op) == MEM
&& EXTRA_CONSTRAINT (op, 'U'));
int
eq_operator (x, mode)
rtx x;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return (GET_CODE (x) == EQ || GET_CODE (x) == NE);
}
int
handle_pragma (p_getc, p_ungetc, pname)
- int (* p_getc) PROTO ((void));
- void (* p_ungetc) PROTO ((int));
- char * pname;
+ int (* ATTRIBUTE_UNUSED p_getc) PROTO ((void));
+ void (* ATTRIBUTE_UNUSED p_ungetc) PROTO ((int));
+ const char *pname;
{
int retval = 0;
the rtx to represent where it is passed. CUM represents the state after
the last argument. NAMED is not used. */
-static char *hand_list[] =
+static const char *const hand_list[] =
{
"__main",
"__cmpsi2",
int named;
{
rtx result = 0;
- char *fname;
+ const char *fname;
int regpass = 0;
/* Never pass unnamed arguments in registers. */
if (cum->libcall)
{
- char **p;
+ const char * const *p;
fname = XSTR (cum->libcall, 0);
/* Return assembly language string which identifies a comparison type. */
-static char *
+static const char *
cond_string (code)
enum rtx_code code;
{
int code;
{
/* This is used for communication between the 'P' and 'U' codes. */
- static char *last_p;
+ static const char *last_p;
/* This is used for communication between codes V,W,Z and Y. */
static int bitint;
case AND:
fprintf (file, "band");
break;
+ default:
+ break;
}
break;
case 'c':
case AND:
fprintf (file, "biand");
break;
+ default:
+ break;
}
break;
case 'd':
REAL_VALUE_TYPE rv;
REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
REAL_VALUE_TO_TARGET_SINGLE (rv, val);
- fprintf (file, "#%d", ((val >> 16) & 0xffff));
+ fprintf (file, "#%ld", ((val >> 16) & 0xffff));
break;
}
default:
REAL_VALUE_TYPE rv;
REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
REAL_VALUE_TO_TARGET_SINGLE (rv, val);
- fprintf (file, "#%d", (val & 0xffff));
+ fprintf (file, "#%ld", (val & 0xffff));
break;
}
default:
REAL_VALUE_TYPE rv;
REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
REAL_VALUE_TO_TARGET_SINGLE (rv, val);
- fprintf (file, "#%d", val);
+ fprintf (file, "#%ld", val);
break;
}
+ default:
+ break;
}
}
}
void
final_prescan_insn (insn, operand, num_operands)
- rtx insn, *operand;
- int num_operands;
+ rtx insn, *operand ATTRIBUTE_UNUSED;
+ int num_operands ATTRIBUTE_UNUSED;
{
/* This holds the last insn address. */
static int last_insn_address = 0;
int
initial_offset (from, to)
+ int from, to;
{
int offset = 0;
/* Update the condition code from the insn. */
-int
+void
notice_update_cc (body, insn)
rtx body;
rtx insn;
int
bit_operator (x, mode)
rtx x;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
enum rtx_code code = GET_CODE (x);
int
nshift_operator (x, mode)
rtx x;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
switch (GET_CODE (x))
{
struct shift_insn
{
- char *assembler;
+ const char *assembler;
int cc_valid;
};
}
};
+static enum shift_alg get_shift_alg PARAMS ((enum attr_cpu, enum shift_type,
+ enum machine_mode, int,
+ const char **, const char **,
+ int *));
+
/* Given CPU, MODE, SHIFT_TYPE, and shift count COUNT, determine the best
algorithm for doing the shift. The assembler code is stored in ASSEMBLER.
We don't achieve maximum efficiency in all cases, but the hooks are here
return SHIFT_SPECIAL;
}
}
- else if (!TARGET_H8300 && (count == 13 || count == 14)
+ else if ((!TARGET_H8300 && (count == 13 || count == 14))
|| count == 15)
{
if (count == 15 && shift_type == SHIFT_ASHIFTRT)
/* Emit the assembler code for doing shifts. */
-char *
+const char *
emit_a_shift (insn, operands)
- rtx insn;
+ rtx insn ATTRIBUTE_UNUSED;
rtx *operands;
{
static int loopend_lab;
- char *assembler;
- char *assembler2;
+ const char *assembler;
+ const char *assembler2;
int cc_valid;
- rtx inside = PATTERN (insn);
rtx shift = operands[3];
enum machine_mode mode = GET_MODE (shift);
enum rtx_code code = GET_CODE (shift);
{
int m = GET_MODE_BITSIZE (mode) - n;
int mask = (shift_type == SHIFT_ASHIFT
- ? ((1 << GET_MODE_BITSIZE (mode) - n) - 1) << n
- : (1 << GET_MODE_BITSIZE (mode) - n) - 1);
+ ? ((1 << (GET_MODE_BITSIZE (mode) - n)) - 1) << n
+ : (1 << (GET_MODE_BITSIZE (mode) - n)) - 1);
char insn_buf[200];
/* Not all possibilities of rotate are supported. They shouldn't
be generated, but let's watch for 'em. */
switch (mode)
{
case QImode:
- sprintf (insn_buf, "and #%d,%%X0",
- mask, n);
+ sprintf (insn_buf, "and #%d,%%X0", mask);
cc_status.value1 = operands[0];
cc_status.flags |= CC_NO_CARRY;
break;
case HImode:
sprintf (insn_buf, "and #%d,%%s0\n\tand #%d,%%t0",
- mask & 255, mask >> 8, n);
+ mask & 255, mask >> 8);
break;
case SImode:
abort ();
+ default:
+ break;
}
}
else
int
fix_bit_operand (operands, what, type)
rtx *operands;
- char what;
+ int what;
enum rtx_code type;
{
/* The bit_operand predicate accepts any memory during RTL generation, but
int
h8300_valid_machine_decl_attribute (decl, attributes, attr, args)
tree decl;
- tree attributes;
+ tree attributes ATTRIBUTE_UNUSED;
tree attr;
tree args;
{
extern struct obstack *saveable_obstack;
+void
h8300_encode_label (decl)
tree decl;
{
- char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+ const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
int len = strlen (str);
char *newstr;
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
}
-char *
+const char *
output_simode_bld (bild, log2, operands)
int bild;
int log2;
We use this to get the lengths of various memory references correct. */
+int
h8300_adjust_insn_length (insn, length)
rtx insn;
- int length;
+ int length ATTRIBUTE_UNUSED;
{
rtx pat;
/* Definitions of target machine for GNU compiler.
Hitachi H8/300 version generating coff
- Copyright (C) 1992, 93-98, 1999 Free SoftwareFoundation, Inc.
+ Copyright (C) 1992, 93-99, 2000 Free SoftwareFoundation, Inc.
Contributed by Steve Chamberlain (sac@cygnus.com),
Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
/* Various globals defined in h8300.c. */
-extern char *h8_push_op,*h8_pop_op,*h8_mov_op;
-extern char **h8_reg_names;
+extern const char *h8_push_op,*h8_pop_op,*h8_mov_op;
+extern const char * const *h8_reg_names;
/* Names to predefine in the preprocessor for this target machine. */
of length N_REG_CLASSES. */
#define REG_CLASS_CONTENTS \
-{ 0, /* No regs */ \
- 0x2ff, /* GENERAL_REGS */ \
- 0x100, /* MAC_REGS */ \
- 0x3ff, /* ALL_REGS */ \
+{ {0}, /* No regs */ \
+ {0x2ff}, /* GENERAL_REGS */ \
+ {0x100}, /* MAC_REGS */ \
+ {0x3ff}, /* ALL_REGS */ \
}
/* The same information, inverted:
case the first 3 arguments are passed in registers.
See function `function_arg'. */
-struct rtx_def *function_arg();
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
function_arg (&CUM, MODE, TYPE, NAMED)
&& REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
|| (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
&& (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (OP, 0)))) \
- || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
- && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \
- && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 0))))
+ || ((GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
+ && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
+ && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
+ && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \
+ && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 0)))))
#define EXTRA_CONSTRAINT(OP, C) \
((C) == 'U' ? OK_FOR_U (OP) : 0)
/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
is a valid machine specific attribute for DECL.
The attributes in ATTRIBUTES have previously been assigned to DECL. */
-extern int h8300_valid_machine_decl_attribute ();
#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
\f
/* Control the assembler format that we output. */
-#define ASM_IDENTIFY_GCC /* nothing */
+#define ASM_IDENTIFY_GCC(FILE) /* nothing */
/* Output at beginning/end of assembler file. */
it should be pointing at the last character after the end of the pragma
(newline or end-of-file). */
#define HANDLE_PRAGMA(GETC, UNGETC, NAME) handle_pragma (GETC, UNGETC, NAME)
-extern int handle_pragma ();
#define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
#define MOVE_RATIO 3
-/* Declarations for functions used in insn-output.c. */
-char *emit_a_shift ();
-int h8300_funcvec_function_p ();
-char *output_adds_subs ();
-char * output_simode_bld ();
-