Hello Ian

On 03.10.08, you wrote:


>> but the func
>> 
>> push_parm_decl 
>> 
>> have no parameter asmspec_tree.
> 
> It shouldn't need one.
> 
> I'm not sure what the semantics of this should be.  Are you trying to
> change the calling convention for a function?  Should it change what
> callers of the function do?

amigaos need Explicit register specification.see below the docu.

it seem other targets need this feature not, i dont know how this on other
OS work when they have a register ABI to OS functions.
 
Dont understand me wrong, i dont want that this feature is in gcc(i think if
it is not in, other developers need it not), i only want ask, if there is
on newest gcc a more easy way to add this feature, so i must not merge so
much in gcc files in.

i can build a workable gcc4.4.0 for amigaos but of course not usefull
because this feature is often need.

And here is what docu say to the amigaos extension.

""""
[EMAIL PROTECTED] Explicit register specification, Case sensitive CPP, 
Miscellaneous,
Miscellaneous

+In certain situations, like writing callback hooks, ``patchers'',
+standard shared libraries, etc., functions have to receive arguments
+in particular registers.

+To overcome this problem in the AmigaOS port of @samp{GCC}, explicit
+register specification has been extended to be available for function
+arguments, as well:
+
[EMAIL PROTECTED]
+void myhook(struct Hook* hook __asm("a0"), APTR object __asm("a2"),
+            APTR message __asm("a1"))
[EMAIL PROTECTED]
+   ...
[EMAIL PROTECTED]
[EMAIL PROTECTED] example
+
[EMAIL PROTECTED]
[EMAIL PROTECTED]: This feature is currently not available in @samp{G++}.
+
+Only the @samp{ANSI}-style declarations (prototypes) are supported.
+
+Registers have to be specified both in function declarations
+(prototypes) and definitions (function code).
[EMAIL PROTECTED] quotation
+
+This feature was first made available in the @samp{GCC} 2.7.2.1,
[EMAIL PROTECTED] Gadgets} snapshot @samp{961012}. 
""""

on old amigaos code, i get gcc workung with that header file and replace
some gcc functions.here i can code in seperate file.

Note:

below code contain much more than really need, amiga os target have regparm
option, to transfer arguments not in stack.but this is only a theoretical
speed feature i dont need, becaue inline func and optimizer work good on
GCC above gcc2.9

Only the feature Explicit register specification i like to add if it is
possible.

maybe this feature can too code in seperate file ?

here is in short what gcc functions are remap to  a seperate file called
amigaos.c 

#undef INIT_CUMULATIVE_ARGS
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
  (amigaos_init_cumulative_args(&(CUM), (FNTYPE)))

/* 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.) 
*/

#undef FUNCTION_ARG_ADVANCE
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)            \
  (amigaos_function_arg_advance (&(CUM)))

/* A C expression that controls whether a function argument is passed
   in a register, and which register. */

#undef FUNCTION_ARG
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
  (amigaos_function_arg (&(CUM), (MODE), (TYPE)))
#endif //REGPARMS_68K
/* end-GG-local */

/* Stack checking and automatic extension support.  */

#define PROLOGUE_BEGIN_HOOK(STREAM, FSIZE)              \
  (amigaos_prologue_begin_hook ((STREAM), (FSIZE)))

#define HAVE_ALTERNATE_FRAME_SETUP_F(FSIZE) TARGET_STACKEXTEND

#define ALTERNATE_FRAME_SETUP_F(STREAM, FSIZE)              \
  (amigaos_alternate_frame_setup_f ((STREAM), (FSIZE)))

#define HAVE_ALTERNATE_FRAME_SETUP(FSIZE) TARGET_STACKEXTEND

#define ALTERNATE_FRAME_SETUP(STREAM, FSIZE)                \
  (amigaos_alternate_frame_setup ((STREAM), (FSIZE)))

#define HAVE_ALTERNATE_FRAME_DESTR_F(FSIZE)             \
  (TARGET_STACKEXTEND && current_function_calls_alloca)

#define ALTERNATE_FRAME_DESTR_F(STREAM, FSIZE)              \
  (asm_fprintf ((STREAM), "\tjra %U__unlk_a5_rts\n"))

#define HAVE_ALTERNATE_RETURN                       \
  (TARGET_STACKEXTEND && frame_pointer_needed &&            \
   current_function_calls_alloca)

#define ALTERNATE_RETURN(STREAM)

#define HAVE_restore_stack_nonlocal TARGET_STACKEXTEND
#define gen_restore_stack_nonlocal gen_stack_cleanup_call

#define HAVE_restore_stack_function TARGET_STACKEXTEND
#define gen_restore_stack_function gen_stack_cleanup_call

#define HAVE_restore_stack_block TARGET_STACKEXTEND
#define gen_restore_stack_block gen_stack_cleanup_call

#undef TARGET_ALTERNATE_ALLOCATE_STACK
#define TARGET_ALTERNATE_ALLOCATE_STACK 1

#define ALTERNATE_ALLOCATE_STACK(OPERANDS)              \
do                                  \
  {                                 \
    amigaos_alternate_allocate_stack (OPERANDS);            \
    DONE;                               \
  }                                 \
while (0)

/* begin-GG-local: dynamic libraries */


#define DO_COLLECTING (do_collecting || amigaos_do_collecting())

/* This macro is called in collect2 for every GCC argument name.
   ARG is a part of commandline (without '\0' at the end).  */

#define COLLECT2_GCC_OPTIONS_HOOK(ARG) amigaos_gccopts_hook(ARG)

/* This macro is called in collect2 for every ld's "-l" or "*.o" or "*.a"
   argument.  ARG is a complete argument, with '\0' at the end.  */

#define COLLECT2_LIBNAME_HOOK(ARG) amigaos_libname_hook(ARG)

/* This macro is called at collect2 exit, to clean everything up.  */

#define COLLECT2_EXTRA_CLEANUP amigaos_collect2_cleanup

/* This macro is called just before the first linker invocation.
   LD1_ARGV is "char** argv", which will be passed to "ld".  STRIP is an
   *address* of "strip_flag" variable.  */

#define COLLECT2_PRELINK_HOOK(LD1_ARGV, STRIP) \
amigaos_prelink_hook((const char **)(LD1_ARGV), (STRIP))

/* This macro is called just after the first linker invocation, in place of
   "nm" and "ldd".  OUTPUT_FILE is the executable's filename.  */

#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE)
amigaos_postlink_hook(OUTPUT_FILE)
/* end-GG-local */

> 
> 
>> The current way is change many lines in c-parse.in (see below)
>> 
>> here is change that is need in c-decl.c
>> the changes are from 3.4.0 i find out, 
> 
> gcc 3.4.0 is very old at this point.  The C parser has been completely
> rewritten, and no longer uses yacc.
> 
> Ian
Regards

Reply via email to