This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ok, here is a new update of the target core patch. Changes: * libcall attribute now only affects lvalues * Improved libcall documentation * Added tentative documentation for target macro Now, if you want the libcall attribute to be universally available to targets, and not just rs6000 ones, here's what I'd do: * Split TARGET_AMIGAOS_DECL_ATTRIBUTES into two macros, so that the two attributes can be enabled individually. (The linearvarargs attribute is PPC-specific, so it can't be made universally available.) * Move the definition of the libcall attribute and the function that checks its constraints into c-common.c If you don't want this, we can leave it as it is now, or instead define some slightly more generic mechanism for allowing the target to modify function calls. Something like this would be sufficient for the purposes of the libcall attribute: TARGET_DECORATE_FUNCTION_CALL(fntype, function, params) Given a function type, a function value, and a list of uncoerced function parameters, return a modified list of parameters to pass to the coercion step. with the default implementation #define TARGET_DECORATE_FUNCTION_CALL(fntype, function, params) params of course. So which of the solutions do you feel should be pursued? Changelog entries, testcases, and patch follows. // Marcus
* config.gcc (powerpc-*-amiga*): Add. * config/rs6000/amigaos.c, config/rs6000/amigaos.h, config/rs6000/amigaos-protos.h, config/rs6000/t-amigaos: New. * config/rs6000/amigaos-va.h: New: AmigaOS specific macros va_startlinear() and va_getlinearva(). * config/rs6000/rs6000.c (rs6000_attribute_table): Add libcall and linearvarargs attributes when target is AmigaOS. * c-typeck.c, cp/typeck.c (build_function_call): Implement AmigaOS libcall attribute. * doc/extend.texi (Function Attributes): Document the libcall and linearvarargs attributes. * doc/tm.texi: Document the TARGET_AMIGAOS_DECL_ATTRIBUTES macro.
Attachment:
amigaos-libcall.c
Description: libcall attribute testcase
Attachment:
amigaos-varargs.c
Description: linearvarargs attribute testcase
Attachment:
amigaos-dblalign.c
Description: alignment testcase
Index: gcc/c-typeck.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/c-typeck.c,v retrieving revision 1.259 diff -u -p -r1.259 c-typeck.c --- gcc/c-typeck.c 28 Sep 2003 19:09:49 -0000 1.259 +++ gcc/c-typeck.c 12 Oct 2003 13:38:27 -0000 @@ -1684,6 +1684,16 @@ build_function_call (tree function, tree /* fntype now gets the type of function pointed to. */ fntype = TREE_TYPE (fntype); +#ifdef TARGET_AMIGAOS_DECL_ATTRIBUTES + if (lookup_attribute ("libcall", TYPE_ATTRIBUTES (fntype))) + if (TREE_CODE (function) == COMPONENT_REF && lvalue_p (function)) + params = chainon (build_tree_list (NULL_TREE, + build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (TREE_OPERAND (function, 0))), + TREE_OPERAND (function, 0)) + ) + , params); +#endif + /* Convert the parameters to the types declared in the function prototype, or apply default promotions. */ Index: gcc/config.gcc =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config.gcc,v retrieving revision 1.393 diff -u -p -r1.393 config.gcc --- gcc/config.gcc 2 Oct 2003 00:44:13 -0000 1.393 +++ gcc/config.gcc 12 Oct 2003 13:38:28 -0000 @@ -1567,6 +1567,14 @@ pdp11-*-*) avr-*-*) use_fixproto=yes ;; +powerpc-*-amiga*) + tm_file="${tm_file} dbxelf.h elfos.h svr4.h rs6000/sysv4.h rs6000/amigaos.h" + tm_p_file="${tm_p_file} rs6000/amigaos-protos.h" + tmake_file=rs6000/t-amigaos + extra_objs=amigaos.o + extra_headers="${extra_headers} amigaos-va.h" + use_collect2=yes + ;; # port not yet contributed #powerpc-*-openbsd*) # tmake_file="${tmake_file} rs6000/t-fprules " Index: gcc/config/rs6000/rs6000.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/rs6000/rs6000.c,v retrieving revision 1.522 diff -u -p -r1.522 rs6000.c --- gcc/config/rs6000/rs6000.c 2 Oct 2003 00:44:27 -0000 1.522 +++ gcc/config/rs6000/rs6000.c 12 Oct 2003 13:38:44 -0000 @@ -13269,6 +13269,10 @@ const struct attribute_spec rs6000_attri /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ { "longcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute }, { "shortcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute }, +#ifdef TARGET_AMIGAOS_DECL_ATTRIBUTES + { "libcall", 0, 0, false, true, true, amigaos_handle_libcall_attribute }, + { "linearvarargs", 0, 0, false, true, true, amigaos_handle_linearvarargs_attribute }, +#endif { NULL, 0, 0, false, false, false, NULL } }; Index: gcc/cp/typeck.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/cp/typeck.c,v retrieving revision 1.506 diff -u -p -r1.506 typeck.c --- gcc/cp/typeck.c 2 Oct 2003 23:14:01 -0000 1.506 +++ gcc/cp/typeck.c 12 Oct 2003 13:38:47 -0000 @@ -2410,6 +2410,16 @@ build_function_call (tree function, tree /* fntype now gets the type of function pointed to. */ fntype = TREE_TYPE (fntype); +#ifdef TARGET_AMIGAOS_DECL_ATTRIBUTES + if (lookup_attribute ("libcall", TYPE_ATTRIBUTES (fntype))) + if (TREE_CODE (function) == COMPONENT_REF && lvalue_p (function)) + params = chainon (build_tree_list (NULL_TREE, + build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (TREE_OPERAND (function, 0))), + TREE_OPERAND(function, 0)) + ) + , params); +#endif + /* Convert the parameters to the types declared in the function prototype, or apply default promotions. */ Index: gcc/doc/extend.texi =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/doc/extend.texi,v retrieving revision 1.163 diff -u -p -r1.163 extend.texi --- gcc/doc/extend.texi 4 Oct 2003 10:53:09 -0000 1.163 +++ gcc/doc/extend.texi 12 Oct 2003 13:38:50 -0000 @@ -2673,6 +2673,53 @@ Alternative methods for including the sy are to use a .def file with an @code{EXPORTS} section or, with GNU ld, using the @option{--export-all} linker flag. +@item libcall +@cindex @code{AmigaOS specific function attributes} +On AmigaOS, the @code{libcall} attribute is used to declare function +pointers in an AmigaOS @emph{Interface}. When such a function pointer +is invoked, a pointer to the Interface itself is passed as a hidden +first argument, similar to @code{this} in C++. + +ISO/IEC 9899:1999 Edits for Libcall functions + +The following are a set of changes to ISO/IEC 9899:1999 (aka C99) +that document the exact semantics of the language extension. + +@itemize @bullet +@item +@cite{6.5.2.2 Function calls} + +Change paragraph 3 to + +@quotation +[...] denotes the called function. The arguments to the function +are specified by the implicit argument, if any, followed by the list +of expressions. +@end quotation + +Add new paragraph before paragraph 4 + +@quotation +If the expression that denotes the called function is a structure or union +member expression as defined in (6.5.2.3) (or such an expression enclosed +in any number of parentheses expressions), is an lvalue, and has a type +that includes the attribute @code{libcall}, then the function call has an +implicit argument. In other cases there is no implicit argument. If there +is an implicit argument, then this will be the first argument to the function, +and the list of expressions will follow it. The type of the implicit +argument is that of a pointer to the structure or union object of which the +function expression designates a member. The value of the implicit argument +is the address of this structure or union object. +@end quotation +@end itemize + +@item linearvarargs +@cindex @code{AmigaOS specific function attributes} +On AmigaOS, the @code{linearvarargs} attribute causes all unprototyped +arguments to a varargs function to be passed on the stack, and not in +registers as the SVR4 ABI defines. Please note that @code{libcall} also +implies @code{linearvarargs}. + @end table You can specify multiple attributes in a declaration by separating them Index: gcc/doc/tm.texi =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/doc/tm.texi,v retrieving revision 1.259 diff -u -p -r1.259 tm.texi --- gcc/doc/tm.texi 2 Oct 2003 00:44:29 -0000 1.259 +++ gcc/doc/tm.texi 12 Oct 2003 13:38:56 -0000 @@ -9139,3 +9139,9 @@ system library's @code{pow}, @code{powf} The default value places no upper bound on the multiplication count. @end defmac +@defmac TARGET_AMIGAOS_DECL_ATTRIBUTES +If defined, the function declaration attributes @code{libcall} and +@code{linearvarargs}, needed for the AmigaOS target, are enabled. +Currently, this is only supported for PPC targets, since the actual +attribute definitions are in @file{rs6000.c}. +@end defmac Index: gcc/config/rs6000/amigaos.c =================================================================== diff -u /dev/null gcc/config/rs6000/amigaos.c --- /dev/null Sun Oct 12 03:10:43 2003 +++ gcc/config/rs6000/amigaos.c Wed Oct 8 02:23:38 2003 @@ -0,0 +1,351 @@ +/* Subroutines used for code generation on Amiga OS 4 + Copyright (C) 2003 Free Software Foundation, Inc. + Contributed by Thomas Frieden (ThomasF@hyperion-entertainment.com) + + 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, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "rtl.h" +#include "regs.h" +#include "hard-reg-set.h" +#include "real.h" +#include "insn-config.h" +#include "conditions.h" +#include "insn-flags.h" +#include "insn-attr.h" +#include "flags.h" +#include "recog.h" +#include "obstack.h" +#include "tree.h" +#include "expr.h" +#include "optabs.h" +#include "except.h" +#include "function.h" +#include "output.h" +#include "errors.h" +#include "tm_p.h" + +#undef DEBUG +#ifdef DEBUG +#define dprintf(...) \ +printf("%s: ", __PRETTY_FUNCTION__); \ +printf(__VA_ARGS__) +#else +#define dprintf(...) /* __VA_ARGS__ */ +#endif + + +/* Initialize a variable CUM of type CUMULATIVE_ARGS + for a call to a function whose data type is FNTYPE. + For a library call, FNTYPE is 0. + + Most of the work is delegated to init_cumulative_args() in rs6000.c, + here we just check for special attributes and update call_cookie + accordingly. */ + +void +amigaos_init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, + rtx libname ATTRIBUTE_UNUSED, int incoming) +{ + dprintf ("enter\n"); + init_cumulative_args (cum, fntype, libname, incoming, FALSE); + + /* Check if either libcall or linear varargs, set appropriate cookie */ + if (fntype && (lookup_attribute ("libcall", TYPE_ATTRIBUTES (fntype)))) + cum->call_cookie |= CALL_LINEARVARARGS; + + if (fntype && (lookup_attribute ("linearvarargs", TYPE_ATTRIBUTES (fntype)))) + cum->call_cookie |= CALL_LINEARVARARGS; + + dprintf ("exit\n"); +} + + +/* Update the data in CUM to advance over an argument + of mode MODE and data type TYPE. + (TYPE is null for libcalls where that information may not be available.) + + If the function has the linearvarargs attribute and this argument + to advance over is the last non-vararg argument, then advance over + all registers, so that the overflow area is hit immediately. + Otherwise, just let function_arg_advance () from rs6000.c do its + thing. */ + +void +amigaos_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int named) +{ + dprintf ("enter\n"); + function_arg_advance (cum, mode, type, named); + + if (cum->call_cookie & CALL_LINEARVARARGS && cum->nargs_prototype < 0) + { + cum->sysv_gregno = GP_ARG_MAX_REG + 1; + cum->fregno = FP_ARG_V4_MAX_REG + 1; + } + dprintf ("exit\n"); +} + + +/* Determine where to put an argument to a function. + + Linearvarargs should always go to the stack, apart from that + any decision made by function_arg () in rs6000.c will be OK. */ + +struct rtx_def * +amigaos_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int named) +{ + struct rtx_def *res = 0; + + dprintf ("enter\n"); + if (mode == VOIDmode && cum->call_cookie & CALL_LINEARVARARGS) + res = GEN_INT (cum->call_cookie); + else + res = function_arg (cum, mode, type, named); + + dprintf ("exit\n"); + + return res; +} + + +/* Perform any needed actions needed for a function that is receiving a + variable number of arguments. + + CUM is as above. + + MODE and TYPE are the mode and type of the current parameter. + + PRETEND_SIZE is a variable that should be set to the amount of stack + that must be pushed by the prolog to pretend that our caller pushed + it. + + For linearvarargs functions, there is no need to perform the + register saving normaly done for SysV varargs, since no varargs + are passed in registers. For other types of functions, + setup_incoming_varargs () in rs6000.c will do the job nicely. */ + +void +amigaos_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int *pretend_size, int no_rtl) +{ + CUMULATIVE_ARGS next_cum; + rtx save_area; + int first_reg_offset; + + dprintf ("enter\n"); + if (cum->call_cookie & CALL_LINEARVARARGS) + { + tree fntype; + int stdarg_p; + + fntype = TREE_TYPE (current_function_decl); + stdarg_p = (TYPE_ARG_TYPES (fntype) != 0 + && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) + != void_type_node)); + + /* For varargs, we do not want to skip the dummy va_dcl argument. + For stdargs, we do want to skip the last named argument. */ + next_cum = *cum; + if (stdarg_p) + function_arg_advance (&next_cum, mode, type, 1); + + /* Indicate to allocate space on the stack for varargs save area. */ + /* ??? Does this really have to be located at a magic spot on the + stack, or can we allocate this with assign_stack_local instead. */ + cfun->machine->sysv_varargs_p = 1; + if (! no_rtl) + save_area = plus_constant (virtual_stack_vars_rtx, + - RS6000_VARARGS_SIZE); + + first_reg_offset = next_cum.sysv_gregno - GP_ARG_MIN_REG; + + } + else + { + setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl); + } + + dprintf ("exit\n"); + +} + + +/* Implement va_start. + + For linearvarargs functions, immediately increase the fpr + and gpr count to the maximum value, so that va_arg will look + only at the stack. */ + +void +amigaos_expand_builtin_va_start (tree valist, rtx nextarg) +{ + rs6000_va_start (valist, nextarg); + + if (current_function_args_info.call_cookie & CALL_LINEARVARARGS) + { + tree f_gpr, f_fpr; + tree gpr, fpr, t; + + f_gpr = TYPE_FIELDS (TREE_TYPE (va_list_type_node)); + f_fpr = TREE_CHAIN (f_gpr); + + valist = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (valist)), valist); + gpr = build (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr); + fpr = build (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr); + + /* Set gpr use count to 8, forcing the overflow area to be used */ + t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, build_int_2 (8, 0)); + TREE_SIDE_EFFECTS (t) = 1; + expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); + + /* Likewise for floating point arguments */ + t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, build_int_2 (8, 0)); + TREE_SIDE_EFFECTS (t) = 1; + expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); + } +} + + +/* Implement __builtin_saveregs for linearvarargs functions. */ + +struct rtx_def * +amigaos_expand_builtin_saveregs (void) +{ + rtx block, mem_gpr_fpr, mem_overflow, tmp; + tree fntype; + int stdarg_p; + HOST_WIDE_INT words, gpr; + struct rtx_def *res; + + dprintf ("enter\n"); + + if (current_function_args_info.call_cookie & CALL_LINEARVARARGS) + { + HOST_WIDE_INT bits; + + fntype = TREE_TYPE (current_function_decl); + stdarg_p = (TYPE_ARG_TYPES (fntype) != 0 + && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) + != void_type_node)); + + /* Allocate the va_list constructor. */ + block = assign_stack_local (BLKmode, 3 * UNITS_PER_WORD, BITS_PER_WORD); + RTX_UNCHANGING_P (block) = 1; + RTX_UNCHANGING_P (XEXP (block, 0)) = 1; + + mem_gpr_fpr = change_address (block, word_mode, XEXP (block, 0)); + mem_overflow = change_address (block, ptr_mode, + plus_constant (XEXP (block, 0), + UNITS_PER_WORD)); + /*mem_reg_save_area = change_address (block, ptr_mode, + plus_constant (XEXP (block, 0), + 2 * UNITS_PER_WORD));*/ + + /* Construct the two characters of `gpr' and `fpr' as a unit. */ + words = current_function_args_info.words; + gpr = current_function_args_info.sysv_gregno - GP_ARG_MIN_REG; + + /* Varargs has the va_dcl argument, but we don't count it. */ + if (!stdarg_p) + { + if (gpr > GP_ARG_NUM_REG) + words -= 1; + } + + bits = (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1) << 8 + | (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1); + if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD) + tmp = GEN_INT (bits << (BITS_PER_WORD - 16)); + else + { + bits <<= BITS_PER_WORD - HOST_BITS_PER_WIDE_INT - 16; + tmp = immed_double_const (0, bits, word_mode); + } + + emit_move_insn (mem_gpr_fpr, tmp); + + /* Find the overflow area. */ + tmp = expand_binop (Pmode, add_optab, virtual_incoming_args_rtx, + GEN_INT (words * UNITS_PER_WORD), + mem_overflow, 0, OPTAB_WIDEN); + if (tmp != mem_overflow) + emit_move_insn (mem_overflow, tmp); + + /*tmp = expand_binop (Pmode, add_optab, virtual_stack_vars_rtx, + GEN_INT (-RS6000_VARARGS_SIZE), + mem_reg_save_area, 0, OPTAB_WIDEN); + if (tmp != mem_reg_save_area) + emit_move_insn (mem_reg_save_area, tmp);*/ + + /* Return the address of the va_list constructor. */ + res = XEXP (block, 0); + } + else + { + res = expand_builtin_saveregs (); + } + + dprintf ("exit\n"); + return res; +} + + +/* Handle a "libcall" attribute. */ + +tree +amigaos_handle_libcall_attribute (tree *node, tree name, + tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) +{ + if (TREE_CODE (*node) != FUNCTION_TYPE + && TREE_CODE (*node) != FIELD_DECL + && TREE_CODE (*node) != TYPE_DECL) + { + warning ("`%s' attribute only applies to functions", + IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} + + +/* Handle a "linearvarargs" attribute. */ + +tree +amigaos_handle_linearvarargs_attribute (tree *node, tree name, + tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) +{ + if (TREE_CODE (*node) != FUNCTION_TYPE + && TREE_CODE (*node) != FIELD_DECL + && TREE_CODE (*node) != TYPE_DECL) + { + warning ("`%s' attribute only applies to functions", + IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} Index: gcc/config/rs6000/amigaos.h =================================================================== diff -u /dev/null gcc/config/rs6000/amigaos.h --- /dev/null Sun Oct 12 03:10:43 2003 +++ gcc/config/rs6000/amigaos.h Thu Oct 9 00:37:45 2003 @@ -0,0 +1,148 @@ +/* Definitions of target machine for GNU compiler, for AmigaOS. + Copyright (C) 1997, 2003 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, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + + +/* On AmigaOS, binaries are linked with -r, so we'll rely on collect2 + to inform us of any undefined symbols. */ +#define COLLECT_REPORT_UNDEF + + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +/* Make CPU default to 604e. FIXME: Make this 750 later */ +#undef PROCESSOR_DEFAULT +#define PROCESSOR_DEFAULT PROCESSOR_PPC604e + +#undef DEFAULT_ABI +#define DEFAULT_ABI ABI_V4 + +/* Make most of the definitions from other compilers available */ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("PPC"); \ + builtin_define ("__ELF__"); \ + builtin_define ("powerpc"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ + builtin_define ("AMIGA"); \ + builtin_define ("AMIGAOS"); \ + builtin_define ("AMIGAOS4"); \ + builtin_define ("__amigaos__"); \ + builtin_define ("__amiga__"); \ + builtin_define ("__amigaos4__"); \ + builtin_define ("amiga"); \ + builtin_define ("amigaos"); \ + builtin_define ("amigaos4"); \ + TARGET_OS_SYSV_CPP_BUILTINS (); \ + } \ + while (0) + + +#undef CPP_OS_DEFAULT_SPEC +#define CPP_OS_DEFAULT_SPEC "%(cpp_os_amigaos)" + +#define STANDARD_INCLUDE_DIR "gcc:include" +#define SYSTEM_INCLUDE_DIR "gcc:os-include" +#undef LOCAL_INCLUDE_DIR + +#undef LINK_SPEC +#define LINK_SPEC "\ +--relocateable -d %{h*} %{v:-V} %{G*} \ +%{Wl,*:%*} %{YP,*} %{R*} \ +%{Qy:} %{!Qn:-Qy} \ +%(link_target) \ +%(link_os)" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crtbegin.o%s crt0.o%s main.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#undef LIB_SPEC +#define LIB_SPEC \ +"--start-group -lc -lamiga --end-group" + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (PowerPC AmigaOS 4)"); + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_REGNAMES) + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS + + +#undef DEFAULT_VTABLE_THUNKS +#ifndef USE_GNULIBC_1 +#define DEFAULT_VTABLE_THUNKS 1 +#endif + +#undef JUMP_TABLES_IN_TEXT_SECTION +#define JUMP_TABLES_IN_TEXT_SECTION 0 + +/* Used as cookie for linear vararg passing */ +#define CALL_LINEARVARARGS 0x10000000 + +/* Overrides */ +#undef INIT_CUMULATIVE_ARGS +#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \ + amigaos_init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE) + +#undef INIT_CUMULATIVE_INCOMING_ARGS +#define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \ + amigaos_init_cumulative_args (&CUM, FNTYPE, LIBNAME, TRUE) + +#undef FUNCTION_ARG_ADVANCE +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ + amigaos_function_arg_advance (&CUM, MODE, TYPE, NAMED) + +#undef FUNCTION_ARG +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ + amigaos_function_arg (&CUM, MODE, TYPE, NAMED) + +#undef SETUP_INCOMING_VARARGS +#define SETUP_INCOMING_VARARGS(CUM,MODE, TYPE,PRETEND_SIZE, NO_RTL) \ + amigaos_setup_incoming_varargs (&CUM, MODE, TYPE, &PRETEND_SIZE, NO_RTL) + +#undef EXPAND_BUILTIN_VA_START +#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \ + amigaos_expand_builtin_va_start (VALIST, NEXTARG) + +#undef EXPAND_BUILTIN_SAVEREGS +#define EXPAND_BUILTIN_SAVEREGS() \ + amigaos_expand_builtin_saveregs () + +#undef SLOW_UNALIGNED_ACCESS +#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) \ + (STRICT_ALIGNMENT \ + || (((MODE) == SFmode) && (ALIGN) < 32) \ + || (((MODE) == DFmode || (MODE) == TFmode || (MODE) == DImode) \ + && (ALIGN) < 64)) + +/* Add the libcall and linearvarargs attributes */ +#define TARGET_AMIGAOS_DECL_ATTRIBUTES + Index: gcc/config/rs6000/t-amigaos =================================================================== diff -u /dev/null gcc/config/rs6000/t-amigaos --- /dev/null Sun Oct 12 03:10:43 2003 +++ gcc/config/rs6000/t-amigaos Fri Sep 12 21:17:46 2003 @@ -0,0 +1,28 @@ +# Do not build libgcc1. +LIBGCC1 = +CROSS_LIBGCC1 = + +# These are really part of libgcc1, but this will cause them to be +# built correctly, so... [taken from t-sparclite] +LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c + +dp-bit.c: $(srcdir)/config/fp-bit.c + cat $(srcdir)/config/fp-bit.c > 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 + +amigaos.o: $(srcdir)/config/rs6000/amigaos.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + +# Build the libraries for both hard and soft floating point + +MULTILIB_OPTIONS = msoft-float +MULTILIB_DIRNAMES = soft-float + +NATIVE_SYSTEM_HEADER_DIR=gcc:include +CROSS_SYSTEM_HEADER_DIR=${gcc_tooldir}/include + +# FIXME: do this +# USE_COLLECT2 = Index: gcc/config/rs6000/amigaos-protos.h =================================================================== diff -u /dev/null gcc/config/rs6000/amigaos-protos.h --- /dev/null Sun Oct 12 03:10:43 2003 +++ gcc/config/rs6000/amigaos-protos.h Sun Oct 5 23:08:09 2003 @@ -0,0 +1,35 @@ +/* Prototypes. + Copyright (C) 2003 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, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + + +#ifdef RTX_CODE +#ifdef TREE_CODE + +extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, int); +extern void amigaos_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); +extern struct rtx_def *amigaos_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); +extern void amigaos_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); +extern void amigaos_expand_builtin_va_start (tree valist, rtx nextarg); +extern struct rtx_def *amigaos_expand_builtin_saveregs (void); +extern tree amigaos_handle_libcall_attribute (tree *, tree, tree, int, bool*); +extern tree amigaos_handle_linearvarargs_attribute (tree *, tree, tree, int, bool*); + +#endif /* TREE_CODE */ +#endif /* RTX_CODE */ Index: gcc/config/rs6000/amigaos-va.h =================================================================== diff -u /dev/null gcc/config/rs6000/amigaos-va.h --- /dev/null Sun Oct 12 03:10:43 2003 +++ gcc/config/rs6000/amigaos-va.h Tue Oct 7 02:29:39 2003 @@ -0,0 +1,43 @@ +/* Copyright (C) 2003 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, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself 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. */ + +/* AmigaOS4 specific macros for use with __atribute__((linearvarargs)) */ + +#ifndef _AMIGAOS_VA_H +#define _AMIGAOS_VA_H + + +/* Alias for va_start, for compatibility */ +#define va_startlinear(AP, x) \ + va_start(AP, x) + + +/* Get a pointer to the area on the stack where the varargs are stored */ +#define va_getlinearva(AP,TYPE) \ + (TYPE)((AP)->overflow_arg_area) + + +#endif /* not _AMIGAOS_VA_H */
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |