[Mono-dev] Global register allocator in JIT
Sergey Tikhonov
tsv at solvo.ru
Wed Oct 11 16:11:52 EDT 2006
Zoltan Varga wrote:
> Hi,
>
> To match the example, these should use OP_LADD instead of CEE_ADD. The
> burg phase has an optimization to avoid useless moves when compiling
> trees of the form:
> (stind.i regvar[REG] (TREE))
> It is turned on by defining MONO_ARCH_ENABLE_EMIT_STATE_OPT in the
> mini-<ARCH>.h file. It is defined for alpha, so I don't know why it is
> not working
> there. It does on other architectures.
Thank you. The macro was not defined (it was in file, but was not active
:) ).
I defined it and it helped. The code looks better now, but there are
still some issues.
I checked generated code for amd64 - here is something interesting (the
same method):
LABEL BLOCK 12:
(stind.i2 (long_add (long_conv_to_i (ldind.i regvar[%r13])) iconst[0])
(ldind.i2 (long_add (long_conv_to_i (ldind.i regvar[%r14])) iconst[0])))
(stind.i regvar[%r13] (long_add (long_conv_to_i (ldind.i regvar[%r13]))
iconst[2]))
(stind.i regvar[%r14] (long_add (long_conv_to_i (ldind.i regvar[%r14]))
iconst[2]))
(stind.i4 regvar[%r15] (sub (ldind.i4 regvar[%r15]) iconst[2]))
LOCAL REGALLOC: BASIC BLOCK: 12
1 move R16 <- %r13
2 move R19 <- %r14
3 loadi2_membase R18 <- R19
4 storei2_membase_reg [R16] <- R18
5 move R21 <- %r13
6 add_imm %r13 <- R21 clobbers: 1
7 move %r13 <- %r13
8 move R23 <- %r14
9 add_imm %r14 <- R23 clobbers: 1
10 move %r14 <- %r14
11 sub_imm %r15 <- %r15 clobbers: 1
<BB>:12
b0: 49 8b c5 mov %r13,%rax
b3: 49 8b ce mov %r14,%rcx
b6: 48 0f bf 09 movswq (%rcx),%rcx
ba: 66 89 08 mov %cx,(%rax)
bd: 49 8b c5 mov %r13,%rax <-- ????
c0: 49 83 c5 02 add $0x2,%r13
c4: 49 8b c6 mov %r14,%rax <-- ????
c7: 49 83 c6 02 add $0x2,%r14
cb: 49 83 ef 02 sub $0x2,%r15
Thank you for helping me out (I will have more questions :) )
Regards,
Sergey.
More information about the Mono-devel-list
mailing list