config.gcc (mmix-*-*): New target.

* config.gcc (mmix-*-*): New target.
	* doc/invoke.texi: Document MMIX options.
	* doc/contrib.texi: Add note about MMIX port to my entry.
	* config/mmix/t-mmix: New file.
	* config/mmix/mmix.h: New file.
	* config/mmix/mmix-protos.h: New file.
	* config/mmix/mmix.c: New file.
	* config/mmix/mmix.md: New file.
	* config/mmix/crti.asm: New file.
	* config/mmix/crtn.asm: New file.

From-SVN: r46746
This commit is contained in:
Hans-Peter Nilsson 2001-11-03 22:14:57 +00:00 committed by Hans-Peter Nilsson
parent d344dce955
commit bcf684c7a5
11 changed files with 6080 additions and 2 deletions

View File

@ -1,3 +1,16 @@
2001-11-03 Hans-Peter Nilsson <hp@bitrange.com>
* config.gcc (mmix-*-*): New target.
* doc/invoke.texi: Document MMIX options.
* doc/contrib.texi: Add note about MMIX port to my entry.
* config/mmix/t-mmix: New file.
* config/mmix/mmix.h: New file.
* config/mmix/mmix-protos.h: New file.
* config/mmix/mmix.c: New file.
* config/mmix/mmix.md: New file.
* config/mmix/crti.asm: New file.
* config/mmix/crtn.asm: New file.
2001-11-03 Kazu Hirata <kazu@hxi.com>
* config/sparc/linux-aout.h: Fix comment formatting.

View File

@ -2554,6 +2554,8 @@ mips-*-*) # Default MIPS RISC-OS 4.0.
use_collect2=yes
fi
;;
mmix-knuth-mmixware)
;;
mn10200-*-*)
float_format=i32
tm_file="elfos.h svr4.h ${tm_file}"

111
gcc/config/mmix/crti.asm Normal file
View File

@ -0,0 +1,111 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com>
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 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.)
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. */
% This is crt0 for mmix-knuth-mmixware, for setting up things for
% compiler-generated assembler and for setting up things between where the
% simulator calls and main, and shutting things down on the way back.
% This file and the GCC output are supposed to be *reasonably*
% mmixal-compatible to enable people to re-use output with Knuth's mmixal.
% However, forward references are used more freely: we are using the
% binutils tools. Users of mmixal beware; you will sometimes have to
% re-order things or use temporary variables.
% Users of mmixal will want to set up 8H and 9H to be .text and .data
% respectively, so the compiler can switch between them pretending they're
% segments.
% This little treasure is here so the 32 lowest address bits of user data
% will not be zero. Because of truncation, that would cause test-case
% gcc.c-torture/execute/980701-1.c to incorrectly fail.
.data ! mmixal:= 8H LOC Data_Segment
.p2align 3
LOC @+(8-@)@7
OCTA 2009
.text ! mmixal:= 9H LOC 8B; LOC #100
.global Main
% The __Stack_start symbol is provided by the link script.
stackpp OCTA __Stack_start
% "Main" is the magic symbol the simulator jumps to. We want to go
% on to "main".
% We need to set rG explicitly to avoid hard-to-debug situations.
Main SETL $255,32
PUT rG,$255
% Initialize the stack pointer. It is supposedly made a global
% zero-initialized (allowed to change) register in crtn.asm; we use the
% explicit number.
GETA $255,stackpp
LDOU $254,$255,0
% Make sure we get more than one mem, to simplify counting cycles.
LDBU $255,$1,0
LDBU $255,$1,1
PUSHJ $2,_init
#ifdef __MMIX_ABI_GNU__
% Copy argc and argv from their initial position to argument registers
% where necessary.
SET $232,$0
SET $233,$1
#else
% For the mmixware ABI, we need to move arguments. The return value will
% appear in $0.
SET $2,$1
SET $1,$0
#endif
PUSHJ $0,main
JMP exit
% Provide first part of _init and _fini. Save the return address on the
% register stack. We eventually ignore the return address of these
% PUSHJ:s, so it doesn't matter that whether .init and .fini code calls
% functions or where they store rJ. We shouldn't get there, so abort if
% that happens
.section .init,"ax",@progbits
.global _init
_init:
GET $0,:rJ
PUSHJ $1,0F
SETL $255,255
TRAP 0,0,0
0H IS @
.section .fini,"ax",@progbits
.global _fini
_fini:
GET $0,:rJ
PUSHJ $1,0F
SETL $255,255
TRAP 0,0,0
0H IS @

91
gcc/config/mmix/crtn.asm Normal file
View File

@ -0,0 +1,91 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com>
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 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.)
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. */
% This must be the last file on the link-line, allocating global registers
% from the top.
% Register $254 is the stack-pointer.
sp GREG
% Register $253 is frame-pointer. It's not supposed to be used in most
% functions.
fp GREG
% $252 is the static chain register; nested functions receive the
% context of the surrounding function through a pointer passed in this
% register.
static_chain GREG
struct_value_reg GREG
% These registers are used to pass state at an exceptional return (C++).
eh_state_3 GREG
eh_state_2 GREG
eh_state_1 GREG
eh_state_0 GREG
#ifdef __MMIX_ABI_GNU__
% Allocate global registers used by the GNU ABI.
gnu_parm_reg_16 GREG
gnu_parm_reg_15 GREG
gnu_parm_reg_14 GREG
gnu_parm_reg_13 GREG
gnu_parm_reg_12 GREG
gnu_parm_reg_11 GREG
gnu_parm_reg_10 GREG
gnu_parm_reg_9 GREG
gnu_parm_reg_8 GREG
gnu_parm_reg_7 GREG
gnu_parm_reg_6 GREG
gnu_parm_reg_5 GREG
gnu_parm_reg_4 GREG
gnu_parm_reg_3 GREG
gnu_parm_reg_2 GREG
gnu_parm_reg_1 GREG
#endif /* __MMIX_ABI_GNU__ */
% Provide last part of _init and _fini.
% The return address is stored in the topmost stored register in the
% register-stack. We ignore the current value in rJ. It is probably
% garbage because each fragment of _init and _fini may have their own idea
% of the current stack frame, if they're cut out from a "real" function
% like in gcc/crtstuff.c.
.section .init,"ax",@progbits
GETA $255,0F
PUT rJ,$255
POP 0,0
0H PUT rJ,$0
POP 0,0
.section .fini,"ax",@progbits
GETA $255,0F
PUT rJ,$255
0H PUT rJ,$0
POP 0,0

View File

@ -0,0 +1,149 @@
/* Prototypes for exported functions defined in mmix.c
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson (hp@bitrange.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 void mmix_override_options PARAMS ((void));
extern void mmix_init_expanders PARAMS ((void));
extern int mmix_eh_return_data_regno PARAMS ((int));
extern int mmix_initial_elimination_offset PARAMS ((int, int));
extern int mmix_starting_frame_offset PARAMS ((void));
extern int mmix_function_arg_regno_p PARAMS ((int, int));
extern void mmix_function_profiler PARAMS ((FILE *, int));
extern void mmix_function_block_profiler PARAMS ((FILE *, int));
extern void mmix_block_profiler PARAMS ((FILE *, int));
extern void mmix_function_block_profiler_exit PARAMS ((FILE *));
extern void mmix_trampoline_template PARAMS ((FILE *));
extern int mmix_trampoline_size;
extern int mmix_reversible_cc_mode PARAMS ((enum machine_mode));
extern int mmix_register_move_cost
PARAMS ((enum machine_mode, enum reg_class, enum reg_class));
extern const char *mmix_text_section_asm_op PARAMS ((void));
extern const char *mmix_data_section_asm_op PARAMS ((void));
extern const char *mmix_strip_name_encoding PARAMS ((const char *));
extern void mmix_asm_file_start PARAMS ((FILE *));
extern void mmix_asm_file_end PARAMS ((FILE *));
extern void mmix_asm_identify_gcc PARAMS ((FILE *));
extern void mmix_asm_output_source_filename PARAMS ((FILE *, const char *));
extern void mmix_output_quoted_string PARAMS ((FILE *, const char *, int));
extern void mmix_asm_output_source_line PARAMS ((FILE *, int));
extern void mmix_asm_output_ascii PARAMS ((FILE *, const char *, int));
extern void mmix_asm_output_label PARAMS ((FILE *, const char *));
extern void mmix_asm_globalize_label PARAMS ((FILE *, const char *));
extern void mmix_asm_weaken_label PARAMS ((FILE *, const char *));
extern void mmix_asm_output_labelref PARAMS ((FILE *, const char *));
extern void mmix_asm_output_internal_label
PARAMS ((FILE *, const char *, int));
extern void mmix_asm_output_def PARAMS ((FILE *, const char *, const char *));
extern void mmix_asm_output_define_label_difference_symbol
PARAMS ((FILE *, const char *, const char *, const char *));
extern int mmix_print_operand_punct_valid_p PARAMS ((int));
extern void mmix_asm_output_reg_push PARAMS ((FILE *, int));
extern void mmix_asm_output_reg_pop PARAMS ((FILE *, int));
extern void mmix_asm_output_skip PARAMS ((FILE *, int));
extern void mmix_asm_output_align PARAMS ((FILE *, int));
extern int mmix_shiftable_wyde_value PARAMS ((unsigned HOST_WIDEST_INT));
extern void mmix_output_register_setting
PARAMS ((FILE *, int, HOST_WIDEST_INT, int));
extern void mmix_conditional_register_usage PARAMS ((void));
extern int mmix_dbx_register_number PARAMS ((int));
/* Things that need rtl.h, tree.h or real.h included, or in combination. */
/* Need tree.h */
#ifdef TREE_CODE
extern void mmix_make_decl_one_only PARAMS ((tree));
extern int mmix_function_arg_pass_by_reference
PARAMS ((const CUMULATIVE_ARGS *, enum machine_mode, tree, int));
extern rtx mmix_function_outgoing_value PARAMS ((tree, tree));
extern int mmix_data_alignment PARAMS ((tree, int));
extern int mmix_constant_alignment PARAMS ((tree, int));
extern int mmix_local_alignment PARAMS ((tree, int));
extern void mmix_setup_incoming_varargs
PARAMS ((CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int));
extern void mmix_select_section PARAMS ((tree, int, int));
extern void mmix_encode_section_info PARAMS ((tree));
extern void mmix_unique_section PARAMS ((tree, int));
extern void mmix_asm_output_pool_prologue
PARAMS ((FILE *, const char *, tree, int));
extern void mmix_asm_output_aligned_common
PARAMS ((FILE *, const char *, int, int));
extern void mmix_asm_output_aligned_local
PARAMS ((FILE *, const char *, int, int));
extern void mmix_asm_declare_register_global
PARAMS ((FILE *, tree, int, const char *));
extern void mmix_asm_output_mi_thunk PARAMS ((FILE *, tree, int, tree));
/* Need tree.h and rtl.h */
# ifdef RTX_CODE
extern rtx mmix_function_arg
PARAMS ((const CUMULATIVE_ARGS *, enum machine_mode, tree, int, int));
extern rtx mmix_expand_builtin_va_arg PARAMS ((tree, tree));
# endif /* RTX_CODE */
#endif /* TREE_CODE */
/* Need rtl.h */
#ifdef RTX_CODE
extern void mmix_asm_output_addr_diff_elt PARAMS ((FILE *, rtx, int, int));
extern void mmix_asm_output_addr_vec_elt PARAMS ((FILE *, int));
extern enum reg_class mmix_preferred_reload_class
PARAMS ((rtx, enum reg_class));
extern enum reg_class mmix_preferred_output_reload_class
PARAMS ((rtx, enum reg_class));
extern enum reg_class mmix_secondary_reload_class
PARAMS ((enum reg_class, enum machine_mode, rtx, int));
extern int mmix_const_ok_for_letter_p PARAMS ((HOST_WIDE_INT, int));
extern int mmix_const_double_ok_for_letter_p PARAMS ((rtx, int));
extern int mmix_extra_constraint PARAMS ((rtx, int));
extern rtx mmix_dynamic_chain_address PARAMS ((rtx));
extern rtx mmix_return_addr_rtx PARAMS ((int, rtx));
extern rtx mmix_eh_return_stackadj_rtx PARAMS ((void));
extern rtx mmix_eh_return_handler_rtx PARAMS ((void));
extern void mmix_initialize_trampoline PARAMS ((rtx, rtx, rtx));
extern int mmix_constant_address_p PARAMS ((rtx));
extern int mmix_legitimate_address PARAMS ((enum machine_mode, rtx, int));
extern int mmix_legitimate_constant_p PARAMS ((rtx));
extern enum machine_mode mmix_select_cc_mode PARAMS ((RTX_CODE, rtx, rtx));
extern void mmix_canonicalize_comparison PARAMS ((RTX_CODE *, rtx *, rtx *));
extern int mmix_rtx_cost_recalculated
PARAMS ((rtx, RTX_CODE, RTX_CODE, int *));
extern int mmix_address_cost PARAMS ((rtx));
extern void mmix_asm_output_double_int PARAMS ((FILE *, rtx, int));
extern void mmix_print_operand PARAMS ((FILE *, rtx, int));
extern void mmix_print_operand_address PARAMS ((FILE *, rtx));
extern int mmix_valid_comparison PARAMS ((RTX_CODE, enum machine_mode, rtx));
extern rtx mmix_gen_compare_reg PARAMS ((enum rtx_code, rtx, rtx));
#endif /* RTX_CODE */
extern int mmix_asm_preferred_eh_data_format PARAMS ((int, int));
extern void mmix_setup_frame_addresses PARAMS ((void));
/* Need real.h */
#ifdef GCC_REAL_H
extern void mmix_asm_output_double PARAMS ((FILE *, REAL_VALUE_TYPE *));
extern void mmix_asm_output_float PARAMS ((FILE *, REAL_VALUE_TYPE *));
#endif /* GCC_REAL_H */
/*
* Local variables:
* eval: (c-set-style "gnu")
* indent-tabs-mode: t
* End:
*/

3160
gcc/config/mmix/mmix.c Normal file

File diff suppressed because it is too large Load Diff

1292
gcc/config/mmix/mmix.h Normal file

File diff suppressed because it is too large Load Diff

1187
gcc/config/mmix/mmix.md Normal file

File diff suppressed because it is too large Load Diff

20
gcc/config/mmix/t-mmix Normal file
View File

@ -0,0 +1,20 @@
# See "Target Fragment" in GCC info. That same order is used here.
LIBGCC1 =
# libgcc1-test doesn't work. There's critical stuff in crti and crtn and
# we know the result of running libgcc1-test anyway.
LIBGCC1_TEST =
CROSS_LIBGCC1 =
TARGET_LIBGCC2_CFLAGS = -mlibfuncs -Dinhibit_libc -O2
EXTRA_MULTILIB_PARTS = crti.o crtn.o crtbegin.o crtend.o
MULTILIB_OPTIONS = mabi=gnu
MULTILIB_DIRNAMES = gnuabi
$(T)crti.o: $(srcdir)/config/mmix/crti.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crti.o -x assembler-with-cpp $(srcdir)/config/mmix/crti.asm
$(T)crtn.o: $(srcdir)/config/mmix/crtn.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtn.o -x assembler-with-cpp $(srcdir)/config/mmix/crtn.asm

View File

@ -384,8 +384,8 @@ NeXT, Inc.@: donated the front end that supports the Objective-C
language.
@item
Hans-Peter Nilsson for the CRIS port, improvements to the search engine
setup, various documentation fixes and other small fixes.
Hans-Peter Nilsson for the CRIS and MMIX ports, improvements to the search
engine setup, various documentation fixes and other small fixes.
@item
Geoff Noer for this work on getting cygwin native builds working.

View File

@ -574,6 +574,12 @@ in the following sections.
-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
@emph{MMIX Options}
@gccoptlist{
-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
-melf}
@emph{IA-64 Options}
@gccoptlist{
-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
@ -5116,6 +5122,7 @@ that macro, which enables you to change the defaults.
* D30V Options::
* S/390 and zSeries Options::
* CRIS Options::
* MMIX Options::
@end menu
@node M680x0 Options
@ -9633,6 +9640,52 @@ Like @option{-sim}, but pass linker options to locate initialized data at
0x40000000 and zero-initialized data at 0x80000000.
@end table
@node MMIX Options
@subsection MMIX Options
@cindex MMIX Options
These options are defined for the MMIX:
@table @code
@item -mlibfuncs
@itemx -mno-libfuncs
Specify that intrinsic library functions are being compiled, passing all
values in registers, no matter the size.
@item -mepsilon
@itemx -mno-epsilon
Generate floating-point comparison instructions that compare with respect
to the @code{rE} epsilon register.
@item -mabi=mmixware
@itemx -mabi=gnu
Generate code that passes function parameters and return values that (in
the called function) are seen as registers @code{$0} and up, as opposed to
the GNU ABI which uses global registers @code{$231} and up.
@item -mzero-extend
@item -mno-zero-extend
When reading data from memory in sizes shorter than 64 bits, use (do not
use) zero-extending load instructions by default, rather than
sign-extending ones.
@item -mknuthdiv
@itemx -mno-knuthdiv
Make the result of a division yielding a remainder have the same sign as
the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
result follows the sign of the dividend. Both methods are arithmetically
valid, the latter being almost exclusively used.
@item -mtoplevel-symbols
@itemx -mno-toplevel-symbols
Prepend (do not prepend) a @code{:} to all global symbols, so the assembly
code can be used with the @code{PREFIX} assembly directive.
@item -melf
Generate an executable in the @samp{ELF} format, rather than the default
@samp{mmo} format used by the @command{mmix} simulator.
@end table
@node Code Gen Options
@section Options for Code Generation Conventions