> -----Original Message----- > From: gcc-patches-owner@gcc.gnu.org > [mailto:gcc-patches-owner@gcc.gnu.org] On Behalf Of Richard Henderson > Sent: 26. november 2002 00:39 > To: Casper Hornstrup > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] Fastcall support on cygwin and mingw targets > > > First, please avoid putting the patch into a tarball. It > just makes it harder to review. > > On Thu, Nov 14, 2002 at 05:28:25PM +0100, Casper Hornstrup wrote: > > ! /* Output a reference to a label. Fastcall symbols are > prefixed with @, > > ! whereas symbols for functions using other calling > conventions don't > > ! have a prefix (unless they are marked dllimport or dllexport). > > ! Internally, @ is used as a prefix for symbols that are > marked dllimport > > ! or dllexport so internally the prefix + is used for > fastcall symbols. */ > > #undef ASM_OUTPUT_LABELREF > > ! #define ASM_OUTPUT_LABELREF(STREAM, NAME) \ > > (1) This is now so big it should be moved to an external function. > (2) The frobbing of @ and + is confusing. It is not *required* > that @ be used for dllimport/export. I'd prefer to first see > a patch that replaced the literal @ with a macro; then the macro > can expand to something other than @, and your life is happier. > > > + The @code{fastcall} calling convention exists in Windows > for Intel > > + processors only. > > This is false. It exists on all ia32 targets. The name > mangling only happens on Windows, but that is not required > for the calling convention to be in effect. > > > > r~ > I have fixed these issues. Patch attached. gcc/testsuite/ChangeLog 2002-11-13 Casper S. Hornstrup * gcc.c-torture/compile/20021110-1.c: New test. * gcc.c-torture/compile/20021110-1.x: Likewise. * gcc.c-torture/compile/20021110-2.c: Likewise. * gcc.c-torture/compile/20021110-2.x: Likewise. * gcc.c-torture/compile/20021110-3.c: Likewise. * gcc.c-torture/compile/20021110-3.x: Likewise. * gcc.c-torture/compile/20021110-4.c: Likewise. * gcc.c-torture/compile/20021110-4.x: Likewise. gcc/ChangeLog 2002-11-13 Casper S. Hornstrup * config/i386/i386.c (ix86_handle_cdecl_attribute): Check for attributes incompatible with fastcall attribute. (ix86_handle_regparm_attribute): Likewise. 2002-11-13 Danny Smith * config/i386/i386.c (ix86_comp_type_attributes): Check for mismatched fastcall types. 2002-11-13 Eric Kohl * config/i386/cygwin.h (TARGET_OS_CPP_BUILTINS): Add fastcall attributes. (ASM_OUTPUT_LABELREF): Define as i386_pe_output_labelref. * config/i386/i386-protos.h (i386_pe_output_labelref): Declare. * config/i386/winnt.c (i386_pe_mark_dllimport). Convert internal fastcall decoration to MS-compatible decoration. Add __imp_ prefix in i386_pe_output_labelref rather than here. * config/i386/i386.c (ix86_attribute_table): Accept 'fastcall' as a valid attribute. (ix86_return_pops_args): Fastcall functions pop the stack. (init_cumulative_args): Reserve registers ECX and EDX if function has fastcall attribute. (function_arg): Use registers ECX and EDX if function has fastcall attribute. * config/i386/i386.h (CUMULATIVE_ARGS): Add fastcall attribute flag. (FASTCALL_PREFIX): Define as '+'. * config/i386/mingw32.h (TARGET_OS_CPP_BUILTINS): Add fastcall attributes. * config/i386/winnt.c (gen_fastcall_suffix): New function. Decorates a label name with a preliminary fastcall prefix (+) and the stdcall suffix. (i386_pe_encode_section_info): Call gen_fastcall_suffix() if a symbol has a fastcall attribute. (i386_pe_strip_name_encoding): Return length of internal fastcall prefix (+). (i386_pe_output_labelref): New function. Outputs a label reference. (i386_pe_fastcall_name_p): New function. Checks a symbol for presence of internal fastcall prefix ('+' prefix). (i386_pe_asm_file_end): Converts internal fastcall prefix ('+' prefix) into the Microsoft compatible '@' prefix. * doc/extend.texi: Add documentation of fastcall attribute.