Commit dcc8a603 by Nathan Sidwell

renam ms1 files to mt (part 2)

From-SVN: r108402
parent 9d26d264
Copyright (C) 2005 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
--------------------------------------------------------------------------
MS1 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
----------------
r0 always zero
r1 argument register 1
r2 argument register 2
r3 argument register 3
r4 argument register 4
r5 callee must save
r6 callee must save
r7 call clobbers
r8 call clobbers
r9 call clobbers
r10 call clobbers
r11 function return value
r12 frame pointer
r13 stack pointer
r14 linkage pointer
r15 interrupt pointer
Stack alignment 8 bytes
Structures passed <= 32 bits as values, else as pointers
The MS1 Stack
---------------
Space is allocated as needed in the stack frame for the following at compile
time:
* Outgoing parameters beyond the fourth
* 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 r12; dynamically allocated space is addressed with positive
offsets from the pointer returned by alloca().
Stack Frame
-----------
+-----------------------+
| Parameter Word 1 |
+-----------------------+ <-sp
| Previous FP |
+-----------------------+
| Return address |
+-----------------------+
| 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=r1 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 > r4, 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 > r3, 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 r11
short r11
long r11
long long stack
float r11
double stack
# crti.asm for ms1
#
# Copyright (C) 2005 Free Software Foundation, Inc.
#
# This file 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.
#
# In addition to the permissions in the GNU General Public License, the
# Free Software Foundation gives you unlimited permission to link the
# compiled version of this file with other programs, and to distribute
# those programs without any restriction coming from the use of this
# file. (The General Public License restrictions do apply in other
# respects; for example, they cover modification of the file, and
# distribution when not linked into another program.)
#
# This file 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 GCC; see the file COPYING. If not, write to the Free
# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception, if you link this library with files
# compiled with GCC to produce an executable, this does not cause
# the resulting executable to be covered by the GNU General Public License.
# This exception does not however invalidate any other reasons why
# the executable file might be covered by the GNU General Public License.
#
# This file just make a stack frame for the contents of the .fini and
# .init sections. Users may put any desired instructions in those
# sections.
.file "crti.asm"
.section ".init"
.global _init
.type _init,#function
.align 4
_init:
subi sp, sp, #4
stw r14, sp, #0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
.section ".fini"
.global _fini
.type _fini,#function
.align 4
_fini:
subi sp, sp, #4
stw r14, sp, #0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
or r0, r0, r0
# crtn.asm for ms1
# Copyright (C) 2005 Free Software Foundation, Inc.
#
# This file 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.
#
# In addition to the permissions in the GNU General Public License, the
# Free Software Foundation gives you unlimited permission to link the
# compiled version of this file with other programs, and to distribute
# those programs without any restriction coming from the use of this
# file. (The General Public License restrictions do apply in other
# respects; for example, they cover modification of the file, and
# distribution when not linked into another program.)
#
# This file 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 GCC; see the file COPYING. If not, write to the Free
# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception, if you link this library with files
# compiled with GCC to produce an executable, this does not cause
# the resulting executable to be covered by the GNU General Public License.
# This exception does not however invalidate any other reasons why
# the executable file might be covered by the GNU General Public License.
#
# This file just makes sure that the .fini and .init sections do in
# fact return. Users may put any desired instructions in those sections.
# This file is the last thing linked into any executable.
.file "crtn.asm"
.section ".init"
.align 4
ldw r14, sp, #0
addi sp, sp, #4
nop
jal r0, r14
or r0, r0, r0
.section ".fini"
.align 4
ldw r14, sp, #0
addi sp, sp, #4
nop
jal r0, r14
or r0, r0, r0
/* Copyright (C) 2005 Free Software Foundation,
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#define BITS_PER_UNIT 8
typedef int HItype __attribute__ ((mode (HI)));
typedef unsigned int UHItype __attribute__ ((mode (HI)));
typedef int SItype __attribute__ ((mode (SI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
typedef int word_type __attribute__ ((mode (__word__)));
struct SIstruct {HItype low, high;};
typedef union
{
struct SIstruct s;
SItype ll;
} SIunion;
SItype
__lshrsi3 (SItype u, word_type b)
{
SIunion w;
word_type bm;
SIunion uu;
if (b == 0)
return u;
uu.ll = u;
bm = (sizeof (HItype) * BITS_PER_UNIT) - b;
if (bm <= 0)
{
w.s.high = 0;
w.s.low = (UHItype)uu.s.high >> -bm;
}
else
{
UHItype carries = (UHItype)uu.s.high << bm;
w.s.high = (UHItype)uu.s.high >> b;
w.s.low = ((UHItype)uu.s.low >> b) | carries;
}
return w.ll;
}
SItype
__ashlsi3 (SItype u, word_type b)
{
SIunion w;
word_type bm;
SIunion uu;
if (b == 0)
return u;
uu.ll = u;
bm = (sizeof (HItype) * BITS_PER_UNIT) - b;
if (bm <= 0)
{
w.s.low = 0;
w.s.high = (UHItype)uu.s.low << -bm;
}
else
{
UHItype carries = (UHItype)uu.s.low >> bm;
w.s.low = (UHItype)uu.s.low << b;
w.s.high = ((UHItype)uu.s.high << b) | carries;
}
return w.ll;
}
SItype
__ashrsi3 (SItype u, word_type b)
{
SIunion w;
word_type bm;
SIunion uu;
if (b == 0)
return u;
uu.ll = u;
bm = (sizeof (HItype) * BITS_PER_UNIT) - b;
if (bm <= 0)
{
/* w.s.high = 1..1 or 0..0 */
w.s.high = uu.s.high >> (sizeof (HItype) * BITS_PER_UNIT - 1);
w.s.low = uu.s.high >> -bm;
}
else
{
UHItype carries = (UHItype)uu.s.high << bm;
w.s.high = uu.s.high >> b;
w.s.low = ((UHItype)uu.s.low >> b) | carries;
}
return w.ll;
}
USItype
__mulsi3 (USItype a, USItype b)
{
USItype c = 0;
while (a != 0)
{
if (a & 1)
c += b;
a >>= 1;
b <<= 1;
}
return c;
}
USItype
udivmodsi4(USItype num, USItype den, word_type modwanted)
{
USItype bit = 1;
USItype res = 0;
while (den < num && bit && !(den & (1L<<31)))
{
den <<=1;
bit <<=1;
}
while (bit)
{
if (num >= den)
{
num -= den;
res |= bit;
}
bit >>=1;
den >>=1;
}
if (modwanted) return num;
return res;
}
SItype
__divsi3 (SItype a, SItype b)
{
word_type neg = 0;
SItype res;
if (a < 0)
{
a = -a;
neg = !neg;
}
if (b < 0)
{
b = -b;
neg = !neg;
}
res = udivmodsi4 (a, b, 0);
if (neg)
res = -res;
return res;
}
SItype
__modsi3 (SItype a, SItype b)
{
word_type neg = 0;
SItype res;
if (a < 0)
{
a = -a;
neg = 1;
}
if (b < 0)
b = -b;
res = udivmodsi4 (a, b, 1);
if (neg)
res = -res;
return res;
}
SItype
__udivsi3 (SItype a, SItype b)
{
return udivmodsi4 (a, b, 0);
}
SItype
__umodsi3 (SItype a, SItype b)
{
return udivmodsi4 (a, b, 1);
}
/* Prototypes for exported functions defined in ms1.c
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
extern void ms1_init_expanders (void);
extern void ms1_expand_prologue (void);
extern void ms1_expand_epilogue (enum epilogue_type);
extern unsigned ms1_compute_frame_size (int);
extern void ms1_override_options (void);
extern int ms1_initial_elimination_offset (int, int);
extern const char * ms1_asm_output_opcode (FILE *, const char *);
extern int ms1_epilogue_uses (int);
extern void ms1_add_loop (void);
#ifdef TREE_CODE
extern const char * ms1_cannot_inline_p (tree);
extern int ms1_function_arg_boundary (enum machine_mode, tree);
extern void ms1_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
#endif
#ifdef RTX_CODE
extern void ms1_expand_eh_return (rtx *);
extern void ms1_emit_eh_epilogue (rtx *);
extern void ms1_print_operand (FILE *, rtx, int);
extern void ms1_print_operand_address (FILE *, rtx);
extern int ms1_check_split (rtx, enum machine_mode);
extern int ms1_reg_ok_for_base_p (rtx, int);
extern int ms1_legitimate_address_p (enum machine_mode, rtx, int);
/* Predicates for machine description. */
extern int uns_arith_operand (rtx, enum machine_mode);
extern int arith_operand (rtx, enum machine_mode);
extern int reg_or_0_operand (rtx, enum machine_mode);
extern int big_const_operand (rtx, enum machine_mode);
extern int single_const_operand (rtx, enum machine_mode);
extern void ms1_emit_cbranch (enum rtx_code, rtx, rtx, rtx);
extern void ms1_set_memflags (rtx);
extern rtx ms1_return_addr_rtx (int);
extern void ms1_split_words (enum machine_mode, enum machine_mode, rtx *);
extern void ms1_final_prescan_insn (rtx, rtx *, int);
#endif
#ifdef TREE_CODE
#ifdef RTX_CODE
extern void ms1_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
extern rtx ms1_function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int, int);
extern void ms1_va_start (tree, rtx);
extern enum reg_class ms1_secondary_reload_class (enum reg_class, enum machine_mode, rtx);
extern rtx ms1_function_value (tree, enum machine_mode, tree);
#endif
#endif
; Options for the ms1 port of the compiler
;
; Copyright (C) 2005 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
; GCC 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.
;
; GCC 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 GCC; see the file COPYING. If not, write to the Free
; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
; 02110-1301, USA.
mbacc
Target Report Mask(BYTE_ACCESS)
Use byte loads and stores when generating code.
msim
Target RejectNegative
Use simulator runtime
mno-crt0
Target RejectNegative
Do not include crt0.o in the startup files
mdebug-arg
Target RejectNegative Mask(DEBUG_ARG)
Internal debug switch
mdebug-addr
Target RejectNegative Mask(DEBUG_ADDR)
Internal debug switch
mdebug-stack
Target RejectNegative Mask(DEBUG_STACK)
Internal debug switch
mdebug-loc
Target RejectNegative Mask(DEBUG_LOC)
Internal debug switch
mdebug
Target RejectNegative Mask(DEBUG)
Internal debug switch
march=
Target RejectNegative Joined Var(ms1_cpu_string)
Specify CPU for code generation purposes
# Copyright (C) 2005 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC 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.
#
# GCC 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 GCC; see the file COPYING. If not, write to the Free
# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# Name of assembly file containing libgcc1 functions.
# This entry must be present, but it can be empty if the target does
# not need any assembler functions to support its code generation.
CROSS_LIBGCC1 =
#
# Alternatively if assembler functions *are* needed then define the
# entries below:
# CROSS_LIBGCC1 = libgcc1-asm.a
# LIB1ASMSRC = ms1/lib1funcs.asm
# LIB1ASMFUNCS = _udivsi3 etc...
LIB2FUNCS_EXTRA = $(srcdir)/config/ms1/lib2extra-funcs.c
# If any special flags are necessary when building libgcc2 put them here.
#
# TARGET_LIBGCC2_CFLAGS =
EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
# 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
# Assemble startup files.
crti.o: $(srcdir)/config/ms1/crti.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/ms1/crti.asm
crtn.o: $(srcdir)/config/ms1/crtn.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/ms1/crtn.asm
# 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 = march=ms1-64-001/march=ms1-16-002/march=ms1-16-003
MULTILIB_DIRNAMES = 64-001 16-002 16-003
# MULTILIB_MATCHES =
# MULTILIB_EXCEPTIONS =
# MULTILIB_EXTRA_OPTS =
#
# LIBGCC = stmp-multilib
# INSTALL_LIBGCC = install-multilib
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment