[Mono-dev] Building Mono on Linux/Alpha

Zoltan Varga vargaz at gmail.com
Thu Mar 30 11:11:34 EST 2006


                                     Hi,

=======================================================
> Do I understand it correctly that after the call of "__emul_idiv" the
> return value should be
> put into "alpha_r14" register? Where should I do it?
> mini-amd64.c has function "emit_move_return_value" which for "simple"
> calls just
> asserts that ins->dreg should be equal to AMD64_RAX.
> Now by calling convention return value returned in alpha_r0 register and
> it works if the tests are ran
> without optimizations. Should I add instruction to move return value
> from R0 to ins->dreg?
>

Either you should emit code to move from R0 to ins->dreg, or (better), modify
your cpu-alpha.md file and the register allocator macros in
mini-alpha.h to force
the local register allocator to allways allocate the dreg of the call
instruction to
R0. This way the reg allocator will emit the move instruction if it is
neccesary.

Here is what a call instruction looks like in cpu-pentium.md:

call: dest:a clob:c len:17

And the corresponding macro (only an example):
#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 'a') ? X86_EAX : -1)

> Using different options triggered some interesting code I had to
> implement. My question is what is the difference between local and global
> registers? As I undertood the local registers could be used temporary in
> basic blocks, the global registers are used during optimizations.
> Can I define all my local registers as global ones? It seems that they
> couldn't mixed.

Global registers are used during global register allocation. They should be
distinct from the set of local registers. mono_arch_get_global_int_regs ()
returns the list of registers that should be used for global allocation. These
registers are usually the 'callee-saved' registers defined by the platform ABI.
The global register allocator will set cfg->used_int_regs if needed. I suggest
returning an empty list from get_global_int_regs () until all tests are running,
so you have a large set of regression tests which you can use to debug the
inevitable problems which will arose when some variables are allocated to
global registers.

                 Zoltan



More information about the Mono-devel-list mailing list