Backend for Motorola's MCore processors.

From-SVN: r31972
This commit is contained in:
Nick Clifton 2000-02-14 22:51:36 +00:00
parent 77de5d85d0
commit 8f90be4c54
13 changed files with 9785 additions and 0 deletions

74
gcc/config/mcore/crti.asm Normal file
View File

@ -0,0 +1,74 @@
# crti.asm for ELF based systems
# Copyright (C) 1992, 1998, 1999 Free Software Foundation, Inc.
# Written By David Vinayak Henkel-Wallace, June 1992
#
# 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 this program; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, 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 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 r0, 16
st.w r15, (r0, 12)
# These nops are here to align the end of this code with a 16 byte
# boundary. The linker will start inserting code into the .init
# section at such a boundary.
nop
nop
nop
nop
nop
nop
.section ".fini"
.global _fini
.type _fini,@function
.align 4
_fini:
subi r0, 16
st.w r15, (r0, 12)
nop
nop
nop
nop
nop
nop

57
gcc/config/mcore/crtn.asm Normal file
View File

@ -0,0 +1,57 @@
# crtn.asm for ELF based systems
# Copyright (C) 1992, 1999, 2000 Free Software Foundation, Inc.
# Written By David Vinayak Henkel-Wallace, June 1992
#
# 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 this program; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, 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 r15,(r0, 12)
addi r0,16
jmp r15
.section ".fini"
.align 4
ldw r15, (r0, 12)
addi r0,16
jmp r15
# Th-th-th-that is all folks!

64
gcc/config/mcore/gfloat.h Normal file
View File

@ -0,0 +1,64 @@
/* Output routines for Motorola MCore processor
Copyright (C) 1993, 1999, 2000 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* float.h for the M*Core microprocessor. It uses IEEE floating point.
* float is 32 bit IEEE-754 format
* double is 64 bit IEEE-754 format
* long double is not defined right now...
*/
#ifndef __FLOAT_H___
#define __FLOAT_H___
#define FLT_RADIX 2
#define FLT_ROUNDS 1
#define FLT_MANT_DIG 24
#define FLT_DIG 6
#define FLT_EPSILON ((float)1.19209290e-07)
#define FLT_MIN_EXP (-125)
#define FLT_MIN ((float)1.17549435e-38)
#define FLT_MIN_10_EXP (-37)
#define FLT_MAX_EXP 128
#define FLT_MAX ((float)3.40282347e+38)
#define FLT_MAX_10_EXP 38
#define DBL_MANT_DIG 53
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MIN_EXP (-1021)
#define DBL_MIN 2.2250738585072014e-308
#define DBL_MIN_10_EXP (-307)
#define DBL_MAX_EXP 1024
#define DBL_MAX 1.7976931348623157e+308
#define DBL_MAX_10_EXP 308
/* No definitions for LDBL at this time. */
#undef LDBL_MANT_DIG
#undef LDBL_DIG
#undef LDBL_EPSILON
#undef LDBL_MIN_EXP
#undef LDBL_MIN
#undef LDBL_MIN_10_EXP
#undef LDBL_MAX_EXP
#undef LDBL_MAX
#undef LDBL_MAX_10_EXP
#endif /* __FLOAT_H__ */

313
gcc/config/mcore/lib1.asm Normal file
View File

@ -0,0 +1,313 @@
/* libgcc1 routines for the MCore.
Copyright (C) 1993, 1999, 2000 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.
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 this program; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, 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. */
#define CONCAT1(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
/* Use the right prefix for global labels. */
#define SYM(x) CONCAT1 (__, x)
#ifdef __ELF__
#define TYPE(x) .type SYM (x),@function
#define SIZE(x) .size SYM (x), . - SYM (x)
#else
#define TYPE(x)
#define SIZE(x)
#endif
.macro FUNC_START name
.text
.globl SYM (\name)
TYPE (\name)
SYM (\name):
.endm
.macro FUNC_END name
SIZE (\name)
.endm
#ifdef L_udivsi3
FUNC_START udiv32
FUNC_START udivsi32
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
// appears to be wrong...
// tested out incorrectly in our OS work...
// mov r7,r3 // looking at divisor
// ff1 r7 // I can move 32-r7 more bits to left.
// addi r7,1 // ok, one short of that...
// mov r1,r2
// lsr r1,r7 // bits that came from low order...
// rsubi r7,31 // r7 == "32-n" == LEFT distance
// addi r7,1 // this is (32-n)
// lsl r4,r7 // fixes the high 32 (quotient)
// lsl r2,r7
// cmpnei r4,0
// bf 4f // the sentinel went away...
// run the remaining bits
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
4: mov r2,r4 // return quotient
mov r3,r1 // and piggyback the remainder
jmp r15
FUNC_END udiv32
FUNC_END udivsi32
#endif
#ifdef L_umodsi3
FUNC_START urem32
FUNC_START umodsi3
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
mov r2,r1 // return remainder
jmp r15
FUNC_END urem32
FUNC_END umodsi3
#endif
#ifdef L_divsi3
FUNC_START div32
FUNC_START divsi3
mov r5,r2 // calc sign of quotient
xor r5,r3
abs r2 // do unsigned divide
abs r3
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
// tested out incorrectly in our OS work...
// mov r7,r3 // looking at divisor
// ff1 r7 // I can move 32-r7 more bits to left.
// addi r7,1 // ok, one short of that...
// mov r1,r2
// lsr r1,r7 // bits that came from low order...
// rsubi r7,31 // r7 == "32-n" == LEFT distance
// addi r7,1 // this is (32-n)
// lsl r4,r7 // fixes the high 32 (quotient)
// lsl r2,r7
// cmpnei r4,0
// bf 4f // the sentinel went away...
// run the remaining bits
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
4: mov r2,r4 // return quotient
mov r3,r1 // piggyback the remainder
btsti r5,31 // after adjusting for sign
bf 3f
rsubi r2,0
rsubi r3,0
3: jmp r15
FUNC_END div32
FUNC_END divsi3
#endif
#ifdef L_modsi3
FUNC_START rem32
FUNC_START modsi3
mov r5,r2 // calc sign of remainder
abs r2 // do unsigned divide
abs r3
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
mov r2,r1 // return remainder
btsti r5,31 // after adjusting for sign
bf 3f
rsubi r2,0
3: jmp r15
FUNC_END rem32
FUNC_END modsi3
#endif
/* GCC expects that {__eq,__ne,__gt,__ge,__le,__lt}{df2,sf2}
will behave as __cmpdf2. So, we stub the implementations to
jump on to __cmpdf2 and __cmpsf2.
All of these shortcircuit the return path so that __cmp{sd}f2
will go directly back to the caller. */
.macro COMPARE_DF_JUMP name
.import SYM (cmpdf2)
FUNC_START \name
jmpi SYM (cmpdf2)
FUNC_END \name
.endm
#ifdef L_eqdf2
COMPARE_DF_JUMP eqdf2
#endif /* L_eqdf2 */
#ifdef L_nedf2
COMPARE_DF_JUMP nedf2
#endif /* L_nedf2 */
#ifdef L_gtdf2
COMPARE_DF_JUMP gtdf2
#endif /* L_gtdf2 */
#ifdef L_gedf2
COMPARE_DF_JUMP gedf2
#endif /* L_gedf2 */
#ifdef L_ltdf2
COMPARE_DF_JUMP ltdf2
#endif /* L_ltdf2 */
#ifdef L_ledf2
COMPARE_DF_JUMP ledf2
#endif /* L_ledf2 */
/* SINGLE PRECISION FLOATING POINT STUBS */
.macro COMPARE_SF_JUMP name
.import SYM (cmpsf2)
FUNC_START \name
jmpi SYM (cmpsf2)
FUNC_END \name
.endm
#ifdef L_eqsf2
COMPARE_SF_JUMP eqsf2
#endif /* L_eqsf2 */
#ifdef L_nesf2
COMPARE_SF_JUMP nesf2
#endif /* L_nesf2 */
#ifdef L_gtsf2
COMPARE_SF_JUMP gtsf2
#endif /* L_gtsf2 */
#ifdef L_gesf2
COMPARE_SF_JUMP __gesf2
#endif /* L_gesf2 */
#ifdef L_ltsf2
COMPARE_SF_JUMP __ltsf2
#endif /* L_ltsf2 */
#ifdef L_lesf2
COMPARE_SF_JUMP lesf2
#endif /* L_lesf2 */

View File

@ -0,0 +1,206 @@
/* Definitions of MCore target.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
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 __MCORE_ELF_H__
#define __MCORE_ELF_H__
/* Run-time Target Specification. */
#define TARGET_VERSION fputs (" (Motorola MCORE/elf)", stderr)
#define SUBTARGET_CPP_PREDEFINES " -D__ELF__"
#include "svr4.h"
#include "mcore/mcore.h"
/* Use DWARF2 debugging info. */
#ifndef DWARF2_DEBUGGING_INFO
#define DWARF2_DEBUGGING_INFO 1
#endif
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
/* But allow DWARF 1 if the user wants it. */
#ifndef DWARF_DEBUGGING_INFO
#define DWARF_DEBUGGING_INFO 1
#endif
/* The numbers used to denote specific machine registers in the System V
Release 4 DWARF debugging information are quite likely to be totally
different from the numbers used in BSD stabs debugging information
for the same kind of target machine. Thus, we undefine the macro
DBX_REGISTER_NUMBER here as an extra inducement to get people to
provide proper machine-specific definitions of DBX_REGISTER_NUMBER
(which is also used to provide DWARF registers numbers in dwarfout.c)
in their tm.h files which include this file. */
#undef DBX_REGISTER_NUMBER
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
/* When using stabs, gcc2_compiled must be a stabs entry, not an
ordinary symbol, or gdb won't see it. The stabs entry must be
before the N_SO in order for gdb to find it. */
#undef ASM_IDENTIFY_GCC
#define ASM_IDENTIFY_GCC(FILE) \
do \
{ \
if (write_symbols != DBX_DEBUG) \
fputs ("gcc2_compiled.:\n", FILE); \
else \
fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
} \
while (0)
/* MCore defines .long and .short to NOT force any alignment.
This lets you misalign as much as you wish. */
#define UNALIGNED_INT_ASM_OP ".long"
#define UNALIGNED_SHORT_ASM_OP ".short"
#define EXPORTS_SECTION_ASM_OP "\t.section .exports"
#define SUBTARGET_EXTRA_SECTIONS in_const, in_exports
#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
EXPORT_SECTION_FUNCTION \
/* CONST_SECTION_FUNCTION is defined svr4.h. */
#define EXPORT_SECTION_FUNCTION \
void \
exports_section () \
{ \
if (in_section != in_exports) \
{ \
fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \
in_section = in_exports; \
} \
}
#define SUBTARGET_SWITCH_SECTIONS \
case in_exports: exports_section (); break; \
case in_const: const_section (); break;
#define MCORE_EXPORT_NAME(STREAM, NAME) \
do \
{ \
exports_section (); \
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
MCORE_STRIP_NAME_ENCODING (NAME)); \
} \
while (0);
/* Write the extra assembler code needed to declare a function properly.
Some svr4 assemblers need to also have something extra said about the
function's return value. We allow for that here. */
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
do \
{ \
if (mcore_dllexport_name_p (NAME)) \
{ \
MCORE_EXPORT_NAME (FILE, NAME); \
function_section (DECL); \
} \
fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
assemble_name (FILE, NAME); \
putc (',', FILE); \
fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
putc ('\n', FILE); \
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
ASM_OUTPUT_LABEL (FILE, NAME); \
} \
while (0)
/* Write the extra assembler code needed to declare an object properly. */
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
do \
{ \
if (mcore_dllexport_name_p (NAME)) \
{ \
enum in_section save_section = in_section; \
MCORE_EXPORT_NAME (FILE, NAME); \
switch_to_section (save_section, (DECL)); \
} \
fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
assemble_name (FILE, NAME); \
putc (',', FILE); \
fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
putc ('\n', FILE); \
size_directive_output = 0; \
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, NAME); \
fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
} \
ASM_OUTPUT_LABEL(FILE, NAME); \
} \
while (0)
/* Output the size directive for a decl in rest_of_decl_compilation
in the case where we did not do so before the initializer.
Once we find the error_mark_node, we know that the value of
size_directive_output was set
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
#undef ASM_FINISH_DECLARE_OBJECT
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
do \
{ \
char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
&& ! AT_END && TOP_LEVEL \
&& DECL_INITIAL (DECL) == error_mark_node \
&& !size_directive_output) \
{ \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, name); \
fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
} \
} \
while (0)
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
/* Include the OS stub library, so that the code can be simulated.
This is not the right way to do this. Ideally this kind of thing
should be done in the linker script - but I have not worked out how
to specify the location of a linker script in a gcc command line yet. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
/* The subroutine calls in the .init and .fini sections create literal
pools which must be jumped around... */
#define FORCE_INIT_SECTION_ALIGN asm ("br 1f ; .literals ; 1:")
#define FORCE_FINI_SECTION_ALIGN asm ("br 1f ; .literals ; 1:")
#undef CTORS_SECTION_ASM_OP
#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
#undef DTORS_SECTION_ASM_OP
#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
#endif /* __MCORE_ELF_H__ */

251
gcc/config/mcore/mcore-pe.h Normal file
View File

@ -0,0 +1,251 @@
/* Definitions of target machine for GNU compiler, for MCore using COFF/PE.
Copyright (C) 1994, 1999, 2000 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@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. */
/* Run-time Target Specification. */
#define TARGET_VERSION fputs (" (MCORE/pe)", stderr)
#define SUBTARGET_CPP_PREDEFINES " -D__pe__"
#include "svr3.h"
#include "mcore/mcore.h"
#include "dbxcoff.h"
#undef SDB_DEBUGGING_INFO
#undef DBX_DEBUGGING_INFO
#define DBX_DEBUGGING_INFO 1
/* Computed in toplev.c. */
#undef PREFERRED_DEBUGGING_TYPE
/* Lay out additional 'sections' where we place things like code
and readonly data. This gets them out of default places. */
#define SUBTARGET_SWITCH_SECTIONS \
case in_drectve: drectve_section (); break; \
case in_rdata: rdata_section (); break;
#define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
#define RDATA_SECTION_ASM_OP "\t.section .rdata"
#define SUBTARGET_EXTRA_SECTIONS in_drectve, in_rdata
#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
DRECTVE_SECTION_FUNCTION \
RDATA_SECTION_FUNCTION
#define DRECTVE_SECTION_FUNCTION \
void \
drectve_section () \
{ \
if (in_section != in_drectve) \
{ \
fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \
in_section = in_drectve; \
} \
}
#define RDATA_SECTION_FUNCTION \
void \
rdata_section () \
{ \
if (in_section != in_rdata) \
{ \
fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
in_section = in_rdata; \
} \
}
#undef READONLY_DATA_SECTION
#define READONLY_DATA_SECTION() rdata_section ()
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
or a constant of some sort. RELOC indicates whether forming
the initial value of DECL requires link-time relocations. */
#undef SELECT_SECTION
#define SELECT_SECTION(DECL, RELOC) \
{ \
if (TREE_CODE (DECL) == STRING_CST) \
{ \
if (! flag_writable_strings) \
rdata_section (); \
else \
data_section (); \
} \
else if (TREE_CODE (DECL) == VAR_DECL) \
{ \
if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \
|| !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
|| !DECL_INITIAL (DECL) \
|| (DECL_INITIAL (DECL) != error_mark_node \
&& !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
data_section (); \
else \
rdata_section (); \
} \
else \
rdata_section (); \
}
/* A C statement or statements to switch to the appropriate
section for output of RTX in mode MODE. RTX is some kind
of constant in RTL. The argument MODE is redundant except
in the case of a `const_int' rtx. Currently, these always
go into the const section. */
#undef SELECT_RTX_SECTION
#define SELECT_RTX_SECTION(MODE, RTX) rdata_section ()
#define MCORE_EXPORT_NAME(STREAM, NAME) \
do \
{ \
drectve_section (); \
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
MCORE_STRIP_NAME_ENCODING (NAME)); \
} \
while (0);
/* Output the label for an initialized variable. */
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
do \
{ \
if (mcore_dllexport_name_p (NAME)) \
{ \
enum in_section save_section = in_section; \
MCORE_EXPORT_NAME (STREAM, NAME); \
switch_to_section (save_section, (DECL)); \
} \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} \
while (0)
/* Output a function label definition. */
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
do \
{ \
if (mcore_dllexport_name_p (NAME)) \
{ \
MCORE_EXPORT_NAME (STREAM, NAME); \
function_section (DECL); \
} \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} \
while (0);
#undef ASM_FILE_START
#define ASM_FILE_START(STREAM) \
do \
{ \
extern char * version_string; \
fprintf (STREAM, "%s Generated by gcc %s for MCore/pe\n", \
ASM_COMMENT_START, version_string); \
output_file_directive ((STREAM), main_input_filename); \
} \
while (0)
#undef ASM_OUTPUT_SOURCE_LINE
#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
{ \
if (write_symbols == DBX_DEBUG) \
{ \
static int sym_lineno = 1; \
char buffer[256]; \
\
ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", sym_lineno); \
fprintf (FILE, ".stabn 68,0,%d,", LINE); \
assemble_name (FILE, buffer); \
putc ('-', FILE); \
assemble_name (FILE, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
putc ('\n', FILE); \
ASM_OUTPUT_INTERNAL_LABEL (FILE, "LM", sym_lineno); \
sym_lineno ++; \
} \
}
#define STARTFILE_SPEC "crt0.o%s"
#define ENDFILE_SPEC "%{!mno-lsim:-lsim}"
#undef CTORS_SECTION_ASM_OP
#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
#undef DTORS_SECTION_ASM_OP
#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
#define INT_ASM_OP ".long"
#undef ASM_OUTPUT_CONSTRUCTOR
#define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME) \
do \
{ \
ctors_section (); \
fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
assemble_name (STREAM, NAME); \
fprintf (STREAM, "\n"); \
} \
while (0)
/* A C statement (sans semicolon) to output an element in the table of
global destructors. */
#undef ASM_OUTPUT_DESTRUCTOR
#define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME) \
do \
{ \
dtors_section (); \
fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
assemble_name (STREAM, NAME); \
fprintf (STREAM, "\n"); \
} \
while (0)
/* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */
#define CTOR_LISTS_DEFINED_EXTERNALLY
#undef DO_GLOBAL_CTORS_BODY
#undef DO_GLOBAL_DTORS_BODY
#undef INIT_SECTION_ASM_OP
#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
#define SUPPORTS_ONE_ONLY 1
/* A C statement to output something to the assembler file to switch to section
NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
NULL_TREE. Some target formats do not support arbitrary sections. Do not
define this macro in such cases. */
#undef ASM_OUTPUT_SECTION_NAME
#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
do \
{ \
if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
fprintf (STREAM, "\t.section %s,\"x\"\n", NAME); \
else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
fprintf (STREAM, "\t.section %s,\"\"\n", NAME); \
else \
fprintf (STREAM, "\t.section %s,\"w\"\n", NAME); \
/* Functions may have been compiled at various levels of \
optimization so we can't use `same_size' here. \
Instead, have the linker pick one. */ \
if ((DECL) && DECL_ONE_ONLY (DECL)) \
fprintf (STREAM, "\t.linkonce %s\n", \
TREE_CODE (DECL) == FUNCTION_DECL \
? "discard" : "same_size"); \
} \
while (0)

View File

@ -0,0 +1,109 @@
/* Prototypes for exported functions defined in mcore.c
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Nick Clifton (nickc@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. */
extern char * mcore_output_jump_label_table PARAMS ((void));
extern void mcore_expand_prolog PARAMS ((void));
extern void mcore_expand_epilog PARAMS ((void));
extern int mcore_const_ok_for_inline PARAMS ((long));
extern int mcore_num_ones PARAMS ((int));
extern int mcore_num_zeros PARAMS ((int));
extern int mcore_initial_elimination_offset PARAMS ((int, int));
extern int mcore_byte_offset PARAMS ((unsigned int));
extern int mcore_halfword_offset PARAMS ((unsigned int));
extern int mcore_const_trick_uses_not PARAMS ((long));
extern void mcore_override_options PARAMS ((void));
extern int mcore_dllexport_name_p PARAMS ((char *));
extern int mcore_dllimport_name_p PARAMS ((char *));
extern int mcore_naked_function_p PARAMS ((void));
#ifdef TREE_CODE
extern void mcore_unique_section PARAMS ((tree, int));
extern void mcore_encode_section_info PARAMS ((tree));
extern int mcore_valid_machine_decl_attribute PARAMS ((tree, tree, tree, tree));
extern tree mcore_merge_machine_decl_attributes PARAMS ((tree, tree));
#ifdef HAVE_MACHINE_MODES
extern int mcore_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
extern void mcore_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int *));
extern int mcore_num_arg_regs PARAMS ((enum machine_mode, tree));
extern int mcore_must_pass_on_stack PARAMS ((enum machine_mode, tree));
#endif /* HAVE_MACHINE_MODES */
#ifdef RTX_CODE
extern rtx mcore_function_value PARAMS ((tree, tree));
#endif /* RTX_CODE */
#endif /* TREE_CODE */
#ifdef RTX_CODE
extern rtx arch_compare_op0;
extern rtx arch_compare_op1;
extern char * mcore_output_bclri PARAMS ((rtx, int));
extern char * mcore_output_bseti PARAMS ((rtx, int));
extern char * mcore_output_cmov PARAMS ((rtx *, int, char *));
extern char * mcore_output_call PARAMS ((rtx *, int));
extern int mcore_is_dead PARAMS ((rtx, rtx));
extern int mcore_expand_insv PARAMS ((rtx *));
extern int mcore_modify_comparison PARAMS ((RTX_CODE));
extern void mcore_expand_block_move PARAMS ((rtx, rtx, rtx *));
extern rtx mcore_dependent_simplify_rtx PARAMS ((rtx, int, int, int, int *));
extern void mcore_dependent_reorg PARAMS ((rtx));
extern int mcore_const_costs PARAMS ((rtx, RTX_CODE));
extern int mcore_and_cost PARAMS ((rtx));
extern int mcore_ior_cost PARAMS ((rtx));
extern char * mcore_output_andn PARAMS ((rtx, rtx *));
extern void mcore_print_operand_address PARAMS ((FILE *, rtx));
extern void mcore_print_operand PARAMS ((FILE *, rtx, int));
extern rtx mcore_gen_compare_reg PARAMS ((RTX_CODE));
extern int mcore_symbolic_address_p PARAMS ((rtx));
extern enum reg_class mcore_reload_class PARAMS ((rtx, enum reg_class));
extern int mcore_is_same_reg PARAMS ((rtx, rtx));
extern int mcore_arith_S_operand PARAMS ((rtx));
#ifdef HAVE_MACHINE_MODES
extern char * mcore_output_move PARAMS ((rtx, rtx *, enum machine_mode));
extern char * mcore_output_movedouble PARAMS ((rtx *, enum machine_mode));
extern char * mcore_output_inline_const_forced PARAMS ((rtx, rtx *, enum machine_mode));
extern int mcore_arith_reg_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_general_movsrc_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_general_movdst_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_reload_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_J_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_K_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_K_operand_not_0 PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_M_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_K_S_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_imm_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_any_imm_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_arith_O_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_literal_K_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_addsub_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_compare_operand PARAMS ((rtx, enum machine_mode));
extern int mcore_load_multiple_operation PARAMS ((rtx, enum machine_mode));
extern int mcore_store_multiple_operation PARAMS ((rtx, enum machine_mode));
extern int mcore_call_address_operand PARAMS ((rtx, enum machine_mode));
#ifdef TREE_CODE
extern rtx mcore_function_arg PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
#endif /* TREE_CODE */
#endif /* HAVE_MACHINE_MODES */
#endif /* RTX_CODE */

3574
gcc/config/mcore/mcore.c Normal file

File diff suppressed because it is too large Load Diff

1458
gcc/config/mcore/mcore.h Normal file

File diff suppressed because it is too large Load Diff

3526
gcc/config/mcore/mcore.md Normal file

File diff suppressed because it is too large Load Diff

64
gcc/config/mcore/t-mcore Normal file
View File

@ -0,0 +1,64 @@
# 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 = libgcc1-asm.a
LIB1ASMSRC = mcore/lib1.asm
LIB1ASMFUNCS = _divsi3 _udivsi3 _modsi3 _umodsi3
# Assemble startup files.
$(T)crti.o: $(srcdir)/config/mcore/crti.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mcore/crti.asm
$(T)crtn.o: $(srcdir)/config/mcore/crtn.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mcore/crtn.asm
# 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
dp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/mcore/t-mcore
rm -f dp-bit.c
echo '' > dp-bit.c
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/mcore/t-mcore
rm -f fp-bit.c
echo '' > fp-bit.c
echo '#define FLOAT' > fp-bit.c
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
T_CFLAGS = -DDONT_HAVE_STDIO -DDONT_HAVE_SETJMP -Dinhibit_libc
# could use -msifilter to be safe from interrupt/jmp interactions and others.
TARGET_LIBGCC2_CFLAGS=-O3 -DNO_FLOATLIB_FIXUNSDFSI #-msifilter
# We have values for float.h.
CROSS_FLOAT_H = $(srcdir)/config/mcore/gfloat.h
# let the library provider supply an <assert.h>
INSTALL_ASSERT_H=
# If support for -m4align is ever re-enabled then comment out the
# following line and uncomment the mutlilib lines below.
EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
# MULTILIB_OPTIONS = m8align/m4align
# MULTILIB_DIRNAMES = align8 align4
# MULTILIB_MATCHES =
# MULTILIB_EXTRA_OPTS =
# MULTILIB_EXCEPTIONS =
# EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
# LIBGCC = stmp-multilib
# INSTALL_LIBGCC = install-multilib
MULTILIB_OPTIONS = mbig-endian/mlittle-endian m210/m340
MULTILIB_DIRNAMES = big little m210 m340
EXTRA_PARTS =
EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib

View File

@ -0,0 +1,47 @@
# 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 = libgcc1-asm.a
LIB1ASMSRC = mcore/lib1.asm
LIB1ASMFUNCS = _divsi3 _udivsi3 _modsi3 _umodsi3
# 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
dp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/mcore/t-mcore
rm -f dp-bit.c
echo '' > dp-bit.c
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/mcore/t-mcore
rm -f fp-bit.c
echo '' > fp-bit.c
echo '#define FLOAT' > fp-bit.c
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
T_CFLAGS = -DDONT_HAVE_STDIO -DDONT_HAVE_SETJMP -Dinhibit_libc
# could use -msifilter to be safe from interrupt/jmp interactions and others.
TARGET_LIBGCC2_CFLAGS=-O3 -DNO_FLOATLIB_FIXUNSDFSI #-msifilter
# We have values for float.h.
CROSS_FLOAT_H = $(srcdir)/config/mcore/gfloat.h
# let the library provider supply an <assert.h>
INSTALL_ASSERT_H=
MULTILIB_OPTIONS = mbig-endian/mlittle-endian m210/m340
MULTILIB_DIRNAMES = big little m210 m340
MULTILIB_MATCHES =
MULTILIB_EXTRA_OPTS =
MULTILIB_EXCEPTIONS =
EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
# If EXTRA_MULTILIB_PARTS is not defined above then define EXTRA_PARTS here
# EXTRA_PARTS = crtbegin.o crtend.o

View File

@ -0,0 +1,42 @@
/* Configuration for GNU C-compiler for the Motorola M*Core.
Copyright (C) 1993, 1999, 2000 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, 675 Mass Ave, Cambridge, MA 02139, 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
/* If compiled with GNU C, use the built-in alloca. */
#ifdef __GNUC__
#define alloca __builtin_alloca
#endif
/* Target machine dependencies.
tm.h is a symbolic link to the actual target specific file. */
#include "tm.h"
/* Arguments to use with `exit'. */
#define SUCCESS_EXIT_CODE 0
#define FATAL_EXIT_CODE 33