[m-dev.] diff: GCC back-end: promote return values to `int'

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 17 18:42:31 AEDT 2001


On 16-Jan-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 16-Jan-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Estimated hours taken: 1
> > 
> > gcc/mercury/mercury-gcc.c:
> > 	Promote function return values to `int', to ensure binary
> > 	compatibility with C.  Without this change, the generated code
> > 	for functions with return values of type e.g. `bool' on e.g.
> > 	x86 would use only the low 8 bits of the return register eax,
> > 	and would leave the remaining bits uninitialized, whereas
> > 	the C calling convention expects such values to be
> > 	sign-extended to 32 bits.
> 
> This looks ok, although it might we worth mentioning why you do it
> unconditionally here, rather than export the functionality to 
> mlds_to_gcc and let the code generator choose to do it or not depending
> on the circumstances.  (It would be fine to always choose to do it, 
> but by implementing it here you are hiding the fact that the gcc backend
> gives you a choice in the matter).

I did it unconditionally there just because doing so was simpler.
As the documentation for gcc.m says, it makes no attempt to be a
*complete* interface to the gcc back-end.  I don't think it is worth
complicating the interface of gcc.m with features that the gcc backend
offers but which we don't make use of.  This is just one example of
that.  There are lots of others.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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