[Mono-dev] How to return valuetype in registers?

Rodrigo Kumpera kumpera at gmail.com
Tue Oct 9 15:59:40 UTC 2012


To handle passing registers arguments in registers is by doing it
in mono_arch_emit_call. Look at how amd64
implements this as it uses more than 2 regs. What you basically needs to
emit is:

R100 is your valuetype register

LDADDR R101 <- R100
LOAD_MEMBASE HREG_0, [R101] + 0
LOAD_MEMBASE HREG_1, [R101] + 8
...
LOAD_MEMBASE HREG_n, [R101] + n * 8

Where HREG_? is the physical register you need to use.


You might notice that this code sequence is inefficient since it requires
the valuetype to be in memory. This is a limitation
of the current compiler which doesn't support regalloc'ing or scalarzing
valuetypes.



On Mon, Oct 8, 2012 at 7:42 PM, Braddock Gaskill (Contractor) <
braddock.gaskill at apx-labs.com> wrote:

> Hi all.  I'm still working on the Tilera CPU port.
>
> The TILE-Gx ABI specifies that structures smaller than 80 bytes should be
> passed in the first 10 registers.  Larger structs get returned in a
> caller-allocated space.
>
> I can't figure out how to specify to the mono runtime that I want to pass
> a valuetype entirely in the registers.  The special case of a register pair
> is handled, but 10 registers?
>
> Is there any way to do this?
>
> Thanks,
> Braddock Gaskill
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20121009/b9858177/attachment.html>


More information about the Mono-devel-list mailing list