iq2000: New port.

* config/iq2000: New port.
	* config.gcc (iq2000-*-elf): Added.
	* doc/install.texi (Specific):  Add iq2000 description.

From-SVN: r70245
This commit is contained in:
Stan Cox 2003-08-08 11:30:25 +00:00 committed by Stan Cox
parent 3e083bea6c
commit 6b3d1e471a
11 changed files with 8190 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2003-08-08 Stan Cox <scox@redhat.com>
* config/iq2000: New port.
* config.gcc (iq2000-*-elf): Added.
* doc/install.texi (Specific): Add iq2000 description.
2003-08-08 Andreas Schwab <schwab@suse.de>
* configure.in (gcc_cv_as_ia64_ltoffx_ldxmov_relocs): Fix quoting

View File

@ -1296,6 +1296,13 @@ ia64*-*-hpux*)
ip2k-*-elf)
tm_file="elfos.h ${tm_file}"
;;
iq2000*-*-elf*)
tm_file="iq2000/iq2000.h"
tmake_file=iq2000/t-iq2000
out_file=iq2000/iq2000.c
xm_file=iq2000/xm-iq2000.h
md_file=iq2000/iq2000.md
;;
m32r-*-elf*)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file}"
extra_parts="crtinit.o crtfini.o"

232
gcc/config/iq2000/abi Normal file
View File

@ -0,0 +1,232 @@
IQ2000 ABI
=========
Sizes and alignments
--------------------
Type Size (bytes) Alignment (bytes)
char 1 1
short 2 2
int 4 4
unsigned 4 4
long 4 4
long long 8 8
float 4 4
double 8 8
pointers 4 4
* alignment within aggregates (structs and unions) is as above, with
padding added if needed
* aggregates have alignment equal to that of their most aligned
member
* aggregates have sizes which are a multiple of their alignment
Floating point
--------------
All emulated using IEEE floating point conventions.
Registers
----------------
%0 always zero
%1 call clobbered
%2 return value
%3 return value
%4 argument register 1
%5 argument register 2
%6 argument register 3
%7 argument register 4
%8 argument register 5
%9 argument register 6
%10 argument register 7
%11 argument register 8
%12 call clobbered
%13 call clobbered
%14 call clobbered
%15 call clobbered
%16 call saved
%17 call saved
%18 call saved
%19 call saved
%20 call saved
%21 call saved
%22 call saved
%23 call saved
%24 call clobbered
%25 call clobbered
%26 reserved
%27 frame ptr
%28 global ptr
%29 stack ptr
%30 reserved
%31 return address
Stack alignment 8 bytes
Structures passed <= 32 bits as values, else as pointers
The IQ2000 Stack
---------------
Space is allocated as needed in the stack frame for the following at compile
time:
* Outgoing parameters beyond the eighth
* All automatic arrays, automatic data aggregates, automatic
scalars which must be addressable, and automatic scalars for
which there is no room in registers
* Compiler-generated temporary values (typically when there are
too many for the compiler to keep them all in registers)
Space can be allocated dynamically (at runtime) in the stack frame for the
following:
* Memory allocated using the alloca() function of the C library
Addressable automatic variables on the stack are addressed with positive
offsets relative to %27; dynamically allocated space is addressed with positive
offsets from the pointer returned by alloca().
Stack Frame
-----------
+-----------------------+
| Caller memory args |
+-----------------------+ <-sp
| Return address |
+-----------------------+
| Previous FP |
+-----------------------+
| Saved Registers |
+-----------------------+
| ... |
+-----------------------+
| Local Variables |
+-----------------------+ <-fp
| Alloca |
+-----------------------+
| ... |
+-----------------------+
| Parameter Word 2 |
+-----------------------+
| Parameter Word 1 |
+-----------------------+ <-sp
Parameter Assignment to Registers
---------------------------------
Consider the parameters in a function call as ordered from left (first
parameter) to right. GR contains the number of the next available
general-purpose register. STARG is the address of the next available stack
parameter word.
INITIALIZE:
Set GR=r4 and STARG to point to parameter word 1.
SCAN:
If there are no more parameters, terminate.
Otherwise, select one of the following depending on the type
of the next parameter:
SIMPLE ARG:
A SIMPLE ARG is one of the following:
* One of the simple integer types which will fit into a
general-purpose register,
* A pointer to an object of any type,
* A struct or union small enough to fit in a register (<= 32 bits)
* A larger struct or union, which shall be treated as a
pointer to the object or to a copy of the object.
(See below for when copies are made.)
If GR > r11, go to STACK. Otherwise, load the parameter value into
general-purpose register GR and advance GR to the next general-purpose
register. Values shorter than the register size are sign-extended or
zero-extended depending on whether they are signed or unsigned. Then
go to SCAN.
DOUBLE or LONG LONG
If GR > r10, go to STACK. Otherwise, if GR is odd, advance GR to the
next register. Load the 64-bit long long or double value into register
pair GR and GR+1. Advance GR to GR+2 and go to SCAN.
STACK:
Parameters not otherwise handled above are passed in the parameter
words of the caller's stack frame. SIMPLE ARGs, as defined above, are
considered to have size and alignment equal to the size of a
general-purpose register, with simple argument types shorter than this
sign- or zero-extended to this width. Round STARG up to a multiple of
the alignment requirement of the parameter and copy the argument
byte-for-byte into STARG, STARG+1, ... STARG+size-1. Set STARG to
STARG+size and go to SCAN.
Structure passing
-----------------
As noted above, code which passes structures and unions by value is implemented
specially. (In this section, "struct" will refer to structs and unions
inclusively.) Structs small enough to fit in a register are passed by value in
a single register or in a stack frame slot the size of a register. Structs
containing a single double or long long component are passed by value in two
registers or in a stack frame slot the size of two registers. Other structs
are handled by passing the address of the structure. In this case, a copy of
the structure will be made if necessary in order to preserve the pass-by-value
semantics.
Copies of large structs are made under the following rules:
ANSI mode K&R Mode
--------- --------
Normal param Callee copies if needed Caller copies
Varargs (...) param Caller copies Caller copies
In the case of normal (non-varargs) large-struct parameters in ANSI mode, the
callee is responsible for producing the same effect as if a copy of the
structure were passed, preserving the pass-by-value semantics. This may be
accomplished by having the callee make a copy, but in some cases the callee may
be able to determine that a copy is not necessary in order to produce the same
results. In such cases, the callee may choose to avoid making a copy of the
parameter.
Varargs handling
----------------
No special changes are needed for handling varargs parameters other than the
caller knowing that a copy is needed on struct parameters larger than a
register (see above).
The varargs macros set up a register save area for the general-purpose
registers to be saved. Because the save area lies between the caller and
callee stack frames, the saved register parameters are contiguous with
parameters passed on the stack. A pointer advances from the register save area
into the caller's stack frame.
Function return values
----------------------
Type Register
---- --------
int r2
short r2
long r2
long long r2-r3
float r2
double r2-r3
struct/union see below
Structs/unions which will fit into two general-purpose registers are returned
in r2, or in r2-r3 if necessary. Larger structs/unions are handled by the
caller passing as a "hidden" first argument a pointer to space allocated to
receive the return value.

View File

@ -0,0 +1,64 @@
/* Definitions of target machine for GNU compiler for iq2000.
Copyright (C) 2003 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. */
#ifndef GCC_IQ2000_PROTOS_H
#define GCC_IQ2000_PROTOS_H
extern int iq2000_check_split PARAMS ((rtx, enum machine_mode));
extern int iq2000_reg_mode_ok_for_base_p PARAMS ((rtx, enum machine_mode, int));
extern int iq2000_legitimate_address_p PARAMS ((enum machine_mode, rtx, int));
extern const char* iq2000_fill_delay_slot PARAMS ((const char*, enum delay_type, rtx*, rtx));
extern const char *iq2000_move_1word PARAMS ((rtx *, rtx, int));
extern int iq2000_address_cost PARAMS ((rtx));
extern void override_options PARAMS ((void));
extern HOST_WIDE_INT iq2000_debugger_offset PARAMS ((rtx, HOST_WIDE_INT));
extern void final_prescan_insn PARAMS ((rtx, rtx*, int));
extern HOST_WIDE_INT compute_frame_size PARAMS ((HOST_WIDE_INT));
extern int iq2000_initial_elimination_offset (int, int);
extern void iq2000_expand_prologue PARAMS ((void));
extern void iq2000_expand_epilogue PARAMS ((void));
extern void iq2000_expand_eh_return PARAMS ((rtx));
extern int iq2000_can_use_return_insn PARAMS ((void));
int function_arg_pass_by_reference PARAMS ((CUMULATIVE_ARGS*, enum machine_mode, tree, int));
int iq2000_adjust_insn_length PARAMS ((rtx, int));
char *iq2000_output_conditional_branch PARAMS ((rtx, rtx*, int, int, int, int));
extern void iq2000_init_builtins PARAMS ((void));
extern void iq2000_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, int, tree, int*, int));
extern void print_operand_address PARAMS ((FILE*, rtx));
extern void print_operand PARAMS ((FILE*, rtx, int));
#ifdef RTX_CODE
extern rtx gen_int_relational PARAMS ((enum rtx_code, rtx, rtx, rtx, int*));
extern void gen_conditional_branch PARAMS ((rtx *, enum rtx_code));
#endif
#ifdef TREE_CODE
extern void init_cumulative_args PARAMS ((CUMULATIVE_ARGS*, tree, rtx));
extern void function_arg_advance PARAMS ((CUMULATIVE_ARGS*, enum machine_mode, tree, int));
extern struct rtx_def* function_arg PARAMS ((CUMULATIVE_ARGS*, enum machine_mode, tree, int));
extern int function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS*, enum machine_mode, tree, int));
extern void iq2000_va_start PARAMS ((tree, rtx));
extern rtx iq2000_va_arg PARAMS ((tree, tree));
extern rtx iq2000_function_value PARAMS ((tree, tree));
extern rtx iq2000_expand_builtin PARAMS ((tree, rtx, rtx,
enum machine_mode, int));
#endif
#endif /* ! GCC_IQ2000_PROTOS_H */

3745
gcc/config/iq2000/iq2000.c Normal file

File diff suppressed because it is too large Load Diff

1486
gcc/config/iq2000/iq2000.h Normal file

File diff suppressed because it is too large Load Diff

2553
gcc/config/iq2000/iq2000.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
typedef unsigned int USItype __attribute__ ((mode (SI)));
USItype
__mulsi3 (USItype a, USItype b)
{
USItype c = 0;
while (a != 0)
{
if (a & 1)
c += b;
a >>= 1;
b <<= 1;
}
return c;
}

View File

@ -0,0 +1,36 @@
# Suppress building libgcc1.a, since the MIPS compiler port is complete
# and does not need anything from libgcc1.a.
LIBGCC1 =
CROSS_LIBGCC1 =
# We must build libgcc2.a with -G 0, in case the user wants to link
# without the $gp register.
TARGET_LIBGCC2_CFLAGS = -G 0
LIB2FUNCS_EXTRA = $(srcdir)/config/udivmod.c $(srcdir)/config/divmod.c $(srcdir)/config/udivmodsi4.c $(srcdir)/config/iq2000/lib2extra-funcs.c
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
FPBIT = fp-bit.c
DPBIT = dp-bit.c
fp-bit.c: $(srcdir)/config/fp-bit.c
echo '#define FLOAT' > fp-bit.c
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
dp-bit.c: $(srcdir)/config/fp-bit.c
cat $(srcdir)/config/fp-bit.c > dp-bit.c
# Enable the following if multilibs are needed.
# See gcc/genmultilib, gcc/gcc.texi and gcc/tm.texi for a
# description of the options and their values.
#
# MULTILIB_OPTIONS =
# MULTILIB_DIRNAMES =
# MULTILIB_MATCHES =
# MULTILIB_EXCEPTIONS =
# MULTILIB_EXTRA_OPTS =
#
# LIBGCC = stmp-multilib
# INSTALL_LIBGCC = install-multilib

View File

@ -0,0 +1,35 @@
/* Configuration for IQ based processors
Copyright (C) 2003 Free Software Foundation, Inc.
Contributed by Red Hat 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. */
/* #defines that need visibility everywhere. */
#define FALSE 0
#define TRUE 1
/* This describes the machine the compiler is hosted on. */
#define HOST_BITS_PER_CHAR 8
#define HOST_BITS_PER_SHORT 16
#define HOST_BITS_PER_INT 32
#define HOST_BITS_PER_LONG 32
#define HOST_BITS_PER_LONGLONG 64
/* Arguments to use with `exit'. */
#define SUCCESS_EXIT_CODE 0
#define FATAL_EXIT_CODE 33

View File

@ -1906,6 +1906,8 @@ GNU Compiler Collection on your machine.
@item
@uref{#ip2k-*-elf,,ip2k-*-elf}
@item
@uref{#iq2000-*-elf,,iq2000-*-elf}
@item
@uref{#m32r-*-elf,,m32r-*-elf}
@item
@uref{#m6811-elf,,m6811-elf}
@ -2756,6 +2758,13 @@ There are no standard Unix configurations.
Use @samp{configure --target=ip2k-elf --enable-languages=c} to configure GCC@.
@html
<hr />
@end html
@heading @anchor{iq2000-*-elf}iq2000-*-elf
Vitesse IQ2000 processors. These are used in embedded
applications. There are no standard Unix configurations.
@html
<hr />
@end html