summaryrefslogtreecommitdiff
path: root/gcc/config/i860
diff options
context:
space:
mode:
authorjle <jle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-23 02:11:38 +0000
committerjle <jle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-23 02:11:38 +0000
commit281e3f553736fc12a0a079905a71e9b11e1c40ad (patch)
treea0f26d09d7351c23cec6b3732970daf4d9d71df4 /gcc/config/i860
parentc286b7d4680472966adcf6fc7b482e46b12e0b3b (diff)
downloadgcc-281e3f553736fc12a0a079905a71e9b11e1c40ad.tar.gz
2003-08-22 Jason Eckhardt <jle@rice.edu>
* config/i860/i860-protos.h (i860_va_start): Remove 'stdarg_p' argument. (tdesc_section): Add prototype. Update copyright dates. * config/i860/i860.c: Include coretypes.h, tm.h, and toplev.h. (TARGET_ASM_FUNCTION_PROLOGUE): Move definition to end of file. (TARGET_ASM_FUNCTION_EPILOGUE): Likewise. (targetm): Likewise. (i860_output_function_prologue): Substitute HOST_WIDE_INT_PRINT_DEC for '%d' where necessary. (i860_va_start): Remove 'stdarg_p' argument. Make conditional checks on 'stdarg_p' unconditional. Divide current_function_args_info.ints by UNITS_PER_WORD when referencing (likewise for .floats). (I860_SVR4_VARARGS): Rename... (I860_SVR4_VA_LIST): ...to this. Call build() with 't' rather than 'field'. (i860_rtx_costs): New function. (TARGET_RTX_COSTS): Define. (i860_internal_label): New function. (TARGET_ASM_INTERNAL_LABEL): Define. (i860_file_start): New function. Update copyright dates. * config/i860/i860.h (CPP_PREDEFINES): Remove. (TARGET_CPU_CPP_BUILTINS): Define. (EXPAND_BUILTIN_VA_START): Remove 'stdarg' argument. (CONST_COSTS): Remove (and move code to i860_rtx_costs). (ASM_FILE_START): Remove. (ASM_FILE_START_1): Remove. (ASM_GLOBALIZE_LABEL): Remove. (ASM_OUTPUT_INTERNAL_LABEL): Remove. (ASM_OUTPUT_CASE_LABEL): Replace call of ASM_OUTPUT_INTERNAL_LABEL with targetm.asm_out.internal_label. Update copyright dates. * config/i860/sysv4.h (USER_LABEL_PREFIX): Define. (CPP_PREDEFINES): Remove. (TARGET_OS_CPP_BUILTINS): Define. (GLOBAL_ASM_OP): Define. (ASM_FILE_START): Remove. (TARGET_ASM_FILE_START_FILE_DIRECTIVE): Define. (TARGET_ASM_FILE_START): Define. Update copyright dates. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70722 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i860')
-rw-r--r--gcc/config/i860/i860-protos.h7
-rw-r--r--gcc/config/i860/i860.c101
-rw-r--r--gcc/config/i860/i860.h63
-rw-r--r--gcc/config/i860/sysv4.h28
4 files changed, 112 insertions, 87 deletions
diff --git a/gcc/config/i860/i860-protos.h b/gcc/config/i860/i860-protos.h
index 42cbe184fae..484f97acf43 100644
--- a/gcc/config/i860/i860-protos.h
+++ b/gcc/config/i860/i860-protos.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler, for Intel 860.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003 Free Software Foundation, Inc.
Hacked substantially by Ron Guilmette (rfg@monkeys.com) to cater to
the whims of the System V Release 4 assembler.
@@ -51,7 +51,7 @@ extern int logic_int PARAMS ((rtx, enum machine_mode));
extern int call_insn_operand PARAMS ((rtx, enum machine_mode));
extern rtx i860_saveregs PARAMS ((void));
#ifdef TREE_CODE
-extern void i860_va_start PARAMS ((int, tree, rtx));
+extern void i860_va_start PARAMS ((tree, rtx));
extern rtx i860_va_arg PARAMS ((tree, tree));
#endif /* TREE_CODE */
#endif /* RTX_CODE */
@@ -59,3 +59,6 @@ extern rtx i860_va_arg PARAMS ((tree, tree));
#ifdef TREE_CODE
extern tree i860_build_va_list PARAMS ((void));
#endif /* TREE_CODE */
+
+extern void tdesc_section (void);
+
diff --git a/gcc/config/i860/i860.c b/gcc/config/i860/i860.c
index 18493976615..ebef1fcd3db 100644
--- a/gcc/config/i860/i860.c
+++ b/gcc/config/i860/i860.c
@@ -1,5 +1,5 @@
/* Subroutines for insn-output.c for Intel 860
- Copyright (C) 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright (C) 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Derived from sparc.c.
@@ -28,6 +28,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "flags.h"
#include "rtl.h"
#include "tree.h"
@@ -41,6 +43,7 @@ Boston, MA 02111-1307, USA. */
#include "insn-attr.h"
#include "function.h"
#include "expr.h"
+#include "toplev.h"
#include "tm_p.h"
#include "target.h"
#include "target-def.h"
@@ -64,14 +67,6 @@ const char *i860_reg_prefix = I860_REG_PREFIX;
rtx i860_compare_op0, i860_compare_op1;
-/* Initialize the GCC target structure. */
-#undef TARGET_ASM_FUNCTION_PROLOGUE
-#define TARGET_ASM_FUNCTION_PROLOGUE i860_output_function_prologue
-#undef TARGET_ASM_FUNCTION_EPILOGUE
-#define TARGET_ASM_FUNCTION_EPILOGUE i860_output_function_epilogue
-
-struct gcc_target targetm = TARGET_INITIALIZER;
-
/* Return non-zero if this pattern, can be evaluated safely, even if it
was not asked for. */
int
@@ -1717,7 +1712,7 @@ i860_output_function_prologue (asm_file, local_bytes)
/* Adjust the stack pointer. The ABI sez to do this using `adds',
but the native C compiler on svr4 uses `addu'. */
- fprintf (asm_file, "\taddu -%d,%ssp,%ssp\n",
+ fprintf (asm_file, "\taddu -" HOST_WIDE_INT_PRINT_DEC ",%ssp,%ssp\n",
frame_upper_bytes, i860_reg_prefix, i860_reg_prefix);
/* Save the old frame pointer. */
@@ -1734,9 +1729,9 @@ i860_output_function_prologue (asm_file, local_bytes)
/* Get the value of frame_lower_bytes into r31. */
- fprintf (asm_file, "\torh %d,%sr0,%sr31\n",
+ fprintf (asm_file, "\torh " HOST_WIDE_INT_PRINT_DEC ",%sr0,%sr31\n",
frame_lower_bytes >> 16, i860_reg_prefix, i860_reg_prefix);
- fprintf (asm_file, "\tor %d,%sr31,%sr31\n",
+ fprintf (asm_file, "\tor " HOST_WIDE_INT_PRINT_DEC ",%sr31,%sr31\n",
frame_lower_bytes & 0xffff, i860_reg_prefix, i860_reg_prefix);
/* Now re-adjust the stack pointer using the value in r31.
@@ -1774,12 +1769,12 @@ i860_output_function_prologue (asm_file, local_bytes)
/* Adjust the stack pointer. The ABI sez to do this using `adds',
but the native C compiler on svr4 uses `addu'. */
- fprintf (asm_file, "\taddu -%d,%ssp,%ssp\n",
+ fprintf (asm_file, "\taddu -" HOST_WIDE_INT_PRINT_DEC ",%ssp,%ssp\n",
total_fsize, i860_reg_prefix, i860_reg_prefix);
/* Save the old frame pointer. */
- fprintf (asm_file, "\tst.l %sfp,%d(%ssp)\n",
+ fprintf (asm_file, "\tst.l %sfp," HOST_WIDE_INT_PRINT_DEC "(%ssp)\n",
i860_reg_prefix, frame_lower_bytes, i860_reg_prefix);
/* Setup the new frame pointer. The ABI sez to do this after
@@ -1787,7 +1782,7 @@ i860_output_function_prologue (asm_file, local_bytes)
(and its saz to do this using adds), but that's not what the
native C compiler on svr4 does. */
- fprintf (asm_file, "\taddu %d,%ssp,%sfp\n",
+ fprintf (asm_file, "\taddu " HOST_WIDE_INT_PRINT_DEC ",%ssp,%sfp\n",
frame_lower_bytes, i860_reg_prefix, i860_reg_prefix);
/* Preserve registers. The ABI sez to do this before setting
@@ -2060,7 +2055,7 @@ i860_output_function_epilogue (asm_file, local_bytes)
/* Get the value we plan to use to restore the stack pointer into r31. */
- fprintf (asm_file, "\tadds %d,%sfp,%sr31\n",
+ fprintf (asm_file, "\tadds " HOST_WIDE_INT_PRINT_DEC ",%sfp,%sr31\n",
frame_upper_bytes, i860_reg_prefix, i860_reg_prefix);
/* Restore the return address and the old frame pointer. */
@@ -2173,10 +2168,7 @@ i860_build_va_list ()
}
void
-i860_va_start (stdarg_p, valist, nextarg)
- int stdarg_p;
- tree valist;
- rtx nextarg;
+i860_va_start (tree valist, rtx nextarg)
{
tree saveregs, t;
@@ -2184,7 +2176,7 @@ i860_va_start (stdarg_p, valist, nextarg)
expand_builtin_saveregs ());
saveregs = build1 (INDIRECT_REF, va_list_type_node, saveregs);
- if (stdarg_p)
+ if (1 /* stdarg_p */)
{
tree field_ireg_used, field_freg_used, field_reg_base, field_mem_ptr;
tree ireg_used, freg_used, reg_base, mem_ptr;
@@ -2210,12 +2202,12 @@ i860_va_start (stdarg_p, valist, nextarg)
mem_ptr = build (COMPONENT_REF, TREE_TYPE (field_mem_ptr),
valist, field_mem_ptr);
- t = build_int_2 (current_function_args_info.ints, 0);
+ t = build_int_2 (current_function_args_info.ints / UNITS_PER_WORD, 0);
t = build (MODIFY_EXPR, TREE_TYPE (ireg_used), ireg_used, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- t = build_int_2 (ROUNDUP (current_function_args_info.floats, 8), 0);
+ t = build_int_2 (ROUNDUP ((current_function_args_info.floats / UNITS_PER_WORD), 8), 0);
t = build (MODIFY_EXPR, TREE_TYPE (freg_used), freg_used, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -2241,7 +2233,7 @@ i860_va_start (stdarg_p, valist, nextarg)
#define NUM_PARM_FREGS 8
#define NUM_PARM_IREGS 12
-#ifdef I860_SVR4_VARARGS
+#ifdef I860_SVR4_VA_LIST
#define FREG_OFFSET 0
#define IREG_OFFSET (NUM_PARM_FREGS * UNITS_PER_WORD)
#else
@@ -2316,7 +2308,7 @@ i860_va_arg (valist, type)
build_int_2 (incr, 0)));
TREE_SIDE_EFFECTS (t) = 1;
- t = fold (build (MULT_EXPR, TREE_TYPE (field), field,
+ t = fold (build (MULT_EXPR, TREE_TYPE (field), t /* field */,
build_int_2 (UNITS_PER_WORD, 0)));
TREE_SIDE_EFFECTS (t) = 1;
@@ -2359,3 +2351,62 @@ i860_va_arg (valist, type)
return ret;
}
+
+
+/* Compute a (partial) cost for rtx X. Return true if the complete
+ cost has been computed, and false if subexpressions should be
+ scanned. In either case, *TOTAL contains the cost result. */
+
+static bool
+i860_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total)
+{
+ switch (code)
+ {
+ case CONST_INT:
+ if (INTVAL (x) == 0)
+ *total = 0;
+ else if (INTVAL (x) < 0x2000 && INTVAL (x) >= -0x2000)
+ *total = 1;
+ return true;
+ case CONST:
+ case LABEL_REF:
+ case SYMBOL_REF:
+ *total = 4;
+ return true;
+ case CONST_DOUBLE:
+ *total = 6;
+ return true;
+ default:
+ return false;
+ }
+}
+
+static void
+i860_internal_label (FILE *stream, const char *prefix, unsigned long labelno)
+{
+ fprintf (stream, ".%s%ld:\n", prefix, labelno);
+}
+
+static void
+i860_file_start (void)
+{
+ output_file_directive (asm_out_file, main_input_filename);
+ fprintf (asm_out_file, "\t.version\t\"01.01\"\n");
+}
+
+
+/* Initialize the GCC target structure. */
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS i860_rtx_costs
+
+#undef TARGET_ASM_INTERNAL_LABEL
+#define TARGET_ASM_INTERNAL_LABEL i860_internal_label
+
+#undef TARGET_ASM_FUNCTION_PROLOGUE
+#define TARGET_ASM_FUNCTION_PROLOGUE i860_output_function_prologue
+
+#undef TARGET_ASM_FUNCTION_EPILOGUE
+#define TARGET_ASM_FUNCTION_EPILOGUE i860_output_function_epilogue
+
+struct gcc_target targetm = TARGET_INITIALIZER;
+
diff --git a/gcc/config/i860/i860.h b/gcc/config/i860/i860.h
index f9fd62c88d6..83f2186aeb1 100644
--- a/gcc/config/i860/i860.h
+++ b/gcc/config/i860/i860.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler, for Intel 860.
Copyright (C) 1989, 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002 Free Software Foundation, Inc.
+ 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked substantially by Ron Guilmette (rfg@monkeys.com) to cater to
the whims of the System V Release 4 assembler.
@@ -27,8 +27,12 @@ Boston, MA 02111-1307, USA. */
/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Di860 -Dunix -Asystem=unix -Asystem=svr4 -Acpu=i860 -Amachine=i860"
+#define TARGET_CPU_CPP_BUILTINS() \
+do { \
+ builtin_define ("i860"); \
+ builtin_assert ("cpu=i860"); \
+ builtin_assert ("machine=i860"); \
+} while (0)
/* Print subsidiary information on the compiler version in use. */
#define TARGET_VERSION fprintf (stderr, " (i860)");
@@ -572,8 +576,8 @@ struct cumulative_args { int ints, floats; };
(VALIST) = i860_build_va_list ()
/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
- i860_va_start (stdarg, valist, nextarg)
+#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
+ i860_va_start (valist, nextarg)
/* Implement `va_arg'. */
#define EXPAND_BUILTIN_VA_ARG(valist, type) \
@@ -885,23 +889,6 @@ struct cumulative_args { int ints, floats; };
but a CALL with constant address is cheap. */
#define NO_FUNCTION_CSE
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE, OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) == 0) \
- return 0; \
- if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 4; \
- case CONST_DOUBLE: \
- return 6;
-
/* Specify the cost of a branch insn; roughly the number of extra insns that
should be added to avoid a branch.
@@ -958,19 +945,6 @@ struct cumulative_args { int ints, floats; };
#define ASM_DOUBLE "\t.double"
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#define ASM_FILE_START(FILE)
-#if 0
-#define ASM_FILE_START(FILE) \
- do { output_file_directive ((FILE), main_input_filename); \
- if (optimize) ASM_FILE_START_1 (FILE); \
- } while (0)
-#endif
-
-#define ASM_FILE_START_1(FILE)
-
/* Output to assembler file text saying following lines
may contain character constants, extra white space, comments, etc. */
@@ -1008,36 +982,21 @@ struct cumulative_args { int ints, floats; };
#define ASM_OUTPUT_LABEL(FILE,NAME) \
do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- } while (0)
-
/* The prefix to add to user-visible assembler symbols.
- This definition is overridden in i860v4.h because under System V
+ This definition is overridden in i860/sysv4.h because under System V
Release 4, user-level symbols are *not* prefixed with underscores in
the generated assembly code. */
#define USER_LABEL_PREFIX "_"
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
/* This is how to output an internal numbered label which
labels a jump table. */
#undef ASM_OUTPUT_CASE_LABEL
#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
do { ASM_OUTPUT_ALIGN ((FILE), 2); \
- ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \
+ (*targetm.asm_out.internal_label) ((FILE), PREFIX, NUM); \
} while (0)
/* Output at the end of a jump table. */
diff --git a/gcc/config/i860/sysv4.h b/gcc/config/i860/sysv4.h
index 753807fe123..9de3c897809 100644
--- a/gcc/config/i860/sysv4.h
+++ b/gcc/config/i860/sysv4.h
@@ -1,5 +1,5 @@
/* Target definitions for GNU compiler for Intel 80860 running System V.4
- Copyright (C) 1991, 1996, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1996, 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Ron Guilmette (rfg@monkeys.com).
This file is part of GNU CC.
@@ -22,6 +22,9 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (i860 System V Release 4)");
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
/* Provide a set of pre-definitions and pre-assertions appropriate for
the i860 running svr4. Note that the symbol `__svr4__' MUST BE
DEFINED! It is needed so that the va_list struct in va-i860.h
@@ -31,8 +34,16 @@ Boston, MA 02111-1307, USA. */
will be selected when we are building gnulib2.c.
__svr4__ is our extension. */
-#define CPP_PREDEFINES \
- "-Di860 -Dunix -DSVR4 -D__svr4__ -Asystem=unix -Asystem=svr4 -Acpu=i860 -Amachine=i860"
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define_std ("unix"); \
+ builtin_define ("SVR4"); \
+ builtin_define ("__svr4__"); \
+ builtin_assert ("system=unix"); \
+ builtin_assert ("system=svr4"); \
+ } \
+ while (0)
/* For the benefit of i860_va_arg, flag it this way too. */
@@ -48,6 +59,8 @@ Boston, MA 02111-1307, USA. */
#undef TYPE_OPERAND_FMT
#define TYPE_OPERAND_FMT "\"%s\""
+#define GLOBAL_ASM_OP ".globl "
+
/* The following macro definition overrides the one in i860.h
because the svr4 i860 assembler requires a different syntax
for getting parts of constant/relocatable values. */
@@ -59,11 +72,10 @@ Boston, MA 02111-1307, USA. */
fprintf (FILE, "]@%s", PART_CODE); \
} while (0)
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
+#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START i860_file_start
/* Output the special word the svr4 SDB wants to see just before
the first word of each function's prologue code. */