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

Tyson Dowd trd at cs.mu.OZ.AU
Tue Jan 16 14:38:31 AEDT 2001


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

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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