summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc/config/a29k
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1998-03-03 21:37:38 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1998-03-03 21:37:38 +0000
commitc826e751760901de543f4640467e3a08df7f49bf (patch)
tree6a2323a78664ba45b78df1709ff3cc077db63ccd /gnu/usr.bin/gcc/config/a29k
parenta4511fe6a5dc69a771b5ffdf64ba574c959cf37d (diff)
GCC 2.8.0 merge
Diffstat (limited to 'gnu/usr.bin/gcc/config/a29k')
-rw-r--r--gnu/usr.bin/gcc/config/a29k/a29k.c67
-rw-r--r--gnu/usr.bin/gcc/config/a29k/a29k.h39
-rw-r--r--gnu/usr.bin/gcc/config/a29k/t-vx29k2
-rw-r--r--gnu/usr.bin/gcc/config/a29k/udi.h94
-rw-r--r--gnu/usr.bin/gcc/config/a29k/unix.h7
-rw-r--r--gnu/usr.bin/gcc/config/a29k/vx29k.h11
6 files changed, 173 insertions, 47 deletions
diff --git a/gnu/usr.bin/gcc/config/a29k/a29k.c b/gnu/usr.bin/gcc/config/a29k/a29k.c
index e30340b49ce..4b28bba00bd 100644
--- a/gnu/usr.bin/gcc/config/a29k/a29k.c
+++ b/gnu/usr.bin/gcc/config/a29k/a29k.c
@@ -1,5 +1,5 @@
/* Subroutines used for code generation on AMD Am29000.
- Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 90-94, 1995, 1997 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@nyu.edu)
This file is part of GNU CC.
@@ -19,8 +19,8 @@ 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. */
-#include <stdio.h>
#include "config.h"
+#include <stdio.h>
#include "rtl.h"
#include "regs.h"
#include "hard-reg-set.h"
@@ -44,6 +44,10 @@ Boston, MA 02111-1307, USA. */
static int a29k_regstack_size;
+/* True if the current procedure has a call instruction. */
+
+static int a29k_makes_calls;
+
/* This points to the last insn of the insn prologue. It is set when
an insn without a filled delay slot is found near the start of the
function. */
@@ -1189,29 +1193,24 @@ print_operand (file, x, code)
/* This page contains routines to output function prolog and epilog code. */
-/* Output function prolog code to file FILE. Memory stack size is SIZE.
-
- Also sets register names for incoming arguments and frame pointer. */
+/* Compute the size of the register stack, and determine if there are any
+ call instructions. */
-void
-output_prolog (file, size)
- FILE *file;
- int size;
+static void
+compute_regstack_size ()
{
- int makes_calls = 0;
- int arg_count = 0;
- rtx insn;
int i;
- unsigned int tag_word;
+ rtx insn;
/* See if we make any calls. We need to set lr1 if so. */
+ a29k_makes_calls = 0;
for (insn = get_insns (); insn; insn = next_insn (insn))
if (GET_CODE (insn) == CALL_INSN
|| (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == SEQUENCE
&& GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == CALL_INSN))
{
- makes_calls = 1;
+ a29k_makes_calls = 1;
break;
}
@@ -1223,21 +1222,24 @@ output_prolog (file, size)
a29k_regstack_size = i - (R_LR (0) - 1);
/* If calling routines, ensure we count lr0 & lr1. */
- if (makes_calls && a29k_regstack_size < 2)
+ if (a29k_makes_calls && a29k_regstack_size < 2)
a29k_regstack_size = 2;
/* Count frame pointer and align to 8 byte boundary (even number of
registers). */
a29k_regstack_size += frame_pointer_needed;
if (a29k_regstack_size & 1) a29k_regstack_size++;
+}
- /* See how many incoming arguments we have in registers. */
- for (i = R_AR (0); i < R_AR (16); i++)
- if (! fixed_regs[i])
- arg_count++;
+/* Sets register names for incoming arguments and frame pointer.
+ This can't be computed until after register allocation. */
- /* The argument count includes the caller's lr0 and lr1. */
- arg_count += 2;
+void
+a29k_compute_reg_names ()
+{
+ int i;
+
+ compute_regstack_size ();
/* Set the names and numbers of the frame pointer and incoming argument
registers. */
@@ -1263,6 +1265,27 @@ output_prolog (file, size)
a29k_debug_reg_map[i] = a29k_debug_reg_map[R_KR (i)];
a29k_debug_reg_map[R_KR (i)] = tem;
}
+}
+
+/* Output function prolog code to file FILE. Memory stack size is SIZE. */
+
+void
+output_prolog (file, size)
+ FILE *file;
+ int size;
+{
+ int i;
+ int arg_count = 0;
+ rtx insn;
+ unsigned int tag_word;
+
+ /* See how many incoming arguments we have in registers. */
+ for (i = R_AR (0); i < R_AR (16); i++)
+ if (! fixed_regs[i])
+ arg_count++;
+
+ /* The argument count includes the caller's lr0 and lr1. */
+ arg_count += 2;
/* Compute memory stack size. Add in number of bytes that the we should
push and pretend the caller did and the size of outgoing arguments.
@@ -1326,7 +1349,7 @@ output_prolog (file, size)
slot (this condition is equivalent to seeing if we have an insn that
needs delay slots before an insn that has a filled delay slot). */
a29k_last_prologue_insn = 0;
- if (makes_calls)
+ if (a29k_makes_calls)
{
i = (a29k_regstack_size + arg_count) * 4;
if (i >= 256)
diff --git a/gnu/usr.bin/gcc/config/a29k/a29k.h b/gnu/usr.bin/gcc/config/a29k/a29k.h
index 8a9cfd7c3d4..db6e378d252 100644
--- a/gnu/usr.bin/gcc/config/a29k/a29k.h
+++ b/gnu/usr.bin/gcc/config/a29k/a29k.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU.
- Copyright (C) 1988, 90-94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1988, 90-96, 1997 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@nyu.edu)
This file is part of GNU CC.
@@ -780,7 +780,7 @@ extern struct rtx_def *a29k_get_reloaded_address ();
for a call to a function whose data type is FNTYPE.
For a library call, FNTYPE is 0. */
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) (CUM) = 0
+#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
/* Same, but called for incoming args.
@@ -928,12 +928,15 @@ extern int a29k_compare_fp_p;
For the 29k, we need the prolog to contain one or two words prior to
the declaration of the function name. So just store away the name and
- write it as part of the prolog. */
+ write it as part of the prolog. This also computes the register names,
+ which can't be done until after register allocation, but must be done
+ before final_start_function is called. */
extern char *a29k_function_name;
#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
- a29k_function_name = NAME;
+ a29k_function_name = NAME; \
+ a29k_compute_reg_names ();
/* This macro generates the assembly code for function entry.
FILE is a stdio stream to output the code to.
@@ -984,13 +987,18 @@ extern char *a29k_function_name;
On the 29k, we must be able to place it in a delay slot, it must
not use sp if the frame pointer cannot be eliminated, and it cannot
- use local regs if we need to push the register stack. */
+ use local regs if we need to push the register stack.
+ If this is a SET with a memory as source, it might load from
+ a stack slot, unless the address is constant. */
#define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N) \
(get_attr_in_delay_slot (INSN) == IN_DELAY_SLOT_YES \
&& ! (frame_pointer_needed \
&& reg_mentioned_p (stack_pointer_rtx, PATTERN (INSN))) \
- && ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN))))
+ && ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN))) \
+ && (GET_CODE (PATTERN (INSN)) != SET \
+ || GET_CODE (SET_SRC (PATTERN (INSN))) != MEM \
+ || ! rtx_varies_p (XEXP (SET_SRC (PATTERN (INSN)), 0))))
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts.
@@ -1272,9 +1280,10 @@ extern char *a29k_function_name;
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
+ and some other value for true. This is the value stored for true, which
+ is just the sign bit. */
-#define STORE_FLAG_VALUE 0x80000000
+#define STORE_FLAG_VALUE (-2147483647 - 1)
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
@@ -1446,7 +1455,7 @@ extern int a29k_debug_reg_map[];
/* This how to write an assembler directive to FILE to switch to
section NAME for DECL. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
+#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
fprintf (FILE, "\t.sect %s, bss\n\t.use %s\n", NAME, NAME)
/* This is how to output the definition of a user-level label named NAME,
@@ -1461,11 +1470,10 @@ extern int a29k_debug_reg_map[];
#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
+/* The prefix to add to user-visible assembler symbols. */
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- fprintf (FILE, "_%s", NAME)
+#undef USER_LABEL_PREFIX
+#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. */
@@ -1544,10 +1552,9 @@ extern int a29k_debug_reg_map[];
fprintf (FILE, "\t.word L%d\n", VALUE)
/* This is how to output an element of a case-vector that is relative.
- (29k does not use such vectors,
- but we must define this macro anyway.) */
+ Don't define this if it is not supported. */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) abort ()
+/* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
/* This is how to output an assembler line
that says to advance the location counter
diff --git a/gnu/usr.bin/gcc/config/a29k/t-vx29k b/gnu/usr.bin/gcc/config/a29k/t-vx29k
index 6cf4d9f7b2a..293674efd4b 100644
--- a/gnu/usr.bin/gcc/config/a29k/t-vx29k
+++ b/gnu/usr.bin/gcc/config/a29k/t-vx29k
@@ -6,7 +6,7 @@ LIBGCC1_TEST =
# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
# does not have _exit.
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1 -Dexit=unused_exit
+TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit
LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
dp-bit.c: $(srcdir)/config/fp-bit.c
diff --git a/gnu/usr.bin/gcc/config/a29k/udi.h b/gnu/usr.bin/gcc/config/a29k/udi.h
new file mode 100644
index 00000000000..400ffbbe985
--- /dev/null
+++ b/gnu/usr.bin/gcc/config/a29k/udi.h
@@ -0,0 +1,94 @@
+/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU
+ running over UDI using COFF.
+ Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+
+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. */
+
+/* Support the ctors and dtors sections for g++. */
+
+#define CTORS_SECTION_ASM_OP "\t.use .ctors"
+#define DTORS_SECTION_ASM_OP "\t.use .dtors"
+
+/* A list of other sections which the compiler might be "in" at any
+ given time. */
+
+#undef EXTRA_SECTIONS
+#define EXTRA_SECTIONS readonly_data, in_ctors, in_dtors
+
+/* A list of extra section function definitions. */
+
+#undef EXTRA_SECTION_FUNCTIONS
+#define EXTRA_SECTION_FUNCTIONS \
+ READONLY_DATA_FUNCTION \
+ CTORS_SECTION_FUNCTION \
+ DTORS_SECTION_FUNCTION
+
+#define READONLY_DATA_FUNCTION \
+void \
+literal_section () \
+{ \
+ if (in_section != readonly_data) \
+ { \
+ fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
+ in_section = readonly_data; \
+ } \
+} \
+
+#define CTORS_SECTION_FUNCTION \
+void \
+ctors_section () \
+{ \
+ if (in_section != in_ctors) \
+ { \
+ fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
+ in_section = in_ctors; \
+ } \
+}
+
+#define DTORS_SECTION_FUNCTION \
+void \
+dtors_section () \
+{ \
+ if (in_section != in_dtors) \
+ { \
+ fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
+ in_section = in_dtors; \
+ } \
+}
+
+#define INT_ASM_OP ".word"
+
+/* A C statement (sans semicolon) to output an element in the table of
+ global constructors. */
+#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
+ do { \
+ ctors_section (); \
+ fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
+
+/* A C statement (sans semicolon) to output an element in the table of
+ global destructors. */
+#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
+ do { \
+ dtors_section (); \
+ fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
diff --git a/gnu/usr.bin/gcc/config/a29k/unix.h b/gnu/usr.bin/gcc/config/a29k/unix.h
index f299d10398f..f05f258e94e 100644
--- a/gnu/usr.bin/gcc/config/a29k/unix.h
+++ b/gnu/usr.bin/gcc/config/a29k/unix.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU, Unix.
- Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GNU CC.
@@ -20,10 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* This is mostly the same as a29k.h, except that we define unix instead of
- EPI and define unix-style machine names. */
-
-#include "a29k/a29k.h"
+/* We define unix instead of EPI and define unix-style machine names. */
/* Set our default target to be the 29050; that is the more interesting chip
for Unix systems. */
diff --git a/gnu/usr.bin/gcc/config/a29k/vx29k.h b/gnu/usr.bin/gcc/config/a29k/vx29k.h
index 914b10878e6..8739b1ba7e2 100644
--- a/gnu/usr.bin/gcc/config/a29k/vx29k.h
+++ b/gnu/usr.bin/gcc/config/a29k/vx29k.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler. Vxworks 29k version.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -20,13 +20,18 @@ Boston, MA 02111-1307, USA. */
/* This file just exists to give specs for the 29k running on VxWorks. */
-#include "a29k/a29k-udi.h"
-
/* Names to predefine in the preprocessor for this target machine. */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "-D_AM29K -D_AM29000 -Acpu(a29k) -Amachine(a29k) -D__vxworks -D__vxworks_5"
+/* Vxworks header files require that the macro CPU be set.
+ We could define it in CPP_PREDEFINES, but the value is (or will be)
+ dependent upon GCC options. */
+
+#undef CPP_SPEC
+#define CPP_SPEC "-DCPU=AM29200"
+
/* VxWorks does all the library stuff itself. */
#undef LIB_SPEC