[m-dev.] for review: use gcc's regparm attribute (was: fastcall for the x86)

Peter Ross peter.ross at miscrit.be
Mon Nov 27 21:21:09 AEDT 2000


On Sun, Nov 26, 2000 at 12:31:49PM +1100, Fergus Henderson wrote:
> Pete, could you please review this one?
> 
> This version bootstraps with the gcc 2.97 20001124 snapshot.
> I've also changed it so that it puts `MR_CALL' after the
> return type, for MSVC.  (This makes the relative diff huge,
> I'm afraid, so I'm only posting a new complete diff.)
> I've also cleaned up a few rough edges (e.g. including the calling
> convention in the mangled grade).
> 
> ----------
> 
> Estimated hours taken: 16
> 
> Add support for using a different C calling convention for the
> C functions generated by the MLDS back-end, if you're on x86
> and you define MR_USE_REGPARM.  The code do to this uses GNU C's
> function attributes extension; it will only work if you have
> the latest snapshot versions of gcc.  So MR_USE_REGPARM is
> not enabled by default.
> 
> compiler/ml_call_gen.m:
> 	For higher-order calls and class method calls, assign the
> 	function pointer to a local variable.  This is needed for
> 	current versions of gcc, since gcc doesn't support function
> 	attributes on function types in function pointer type casts.
> 
> compiler/mlds_to_c.m:
> 	Output "MR_CALL" in function declarations
> 	and function pointer types.
> 
> runtime/mercury_std.h:
> 	Define MR_CALL.  This is a macro that can expand to some
> 	implementation-specific C extension to specify the
> 	calling convention used for the MLDS back-end.
> 	E.g. for gcc, on x86, if MR_USE_REGPARM is defined it
> 	expands to `__attribute__((__regparm__(3), __stdcall__))'.
> 
> runtime/mercury_conf_param.h:
> 	Document MR_USE_REGPARM.
> 
> runtime/mercury_grade.h:
> 	Encode the setting of MR_USE_REGPARM in the mangled grade name.
> 
> runtime/mercury_types.h:
> runtime/mercury.h:
> runtime/mercury.c:
> runtime/mercury_wrapper.h:
> runtime/mercury_wrapper.c:
> util/mkinit.c:
> library/array.m:
> library/builtin.m:
> library/exception.m:
> 	Use MR_CALL for functions that should have the
> 	Mercury calling convention.
> 
This diff looks fine.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list