On 20/09/2016 22:41, Richard Henderson wrote:
> On 09/15/2016 06:16 AM, Paolo Bonzini wrote:
>> This comes from free from unifying tcg_reg_alloc_mov and
>> tcg_reg_alloc_movi's handling of TEMP_VAL_CONST.  It triggers
>> often on moves to cc_dst, such as the following translation
>> of "sub $0x3c,%esp":
>>   before:                          after:
>>   subl   $0x3c,%ebp                subl   $0x3c,%ebp
>>   movl   %ebp,0x10(%r14)           movl   %ebp,0x10(%r14)
>>   movl   $0x3c,%ebx                movl   $0x3c,0x2c(%r14)
>>   movl   %ebx,0x2c(%r14)
> What's the input here?  From just this snippet it looks as if we should have
> converted both of them to an immediate store.

I don't have the exact binary but this is what I get from qemu

 movi_i32 tmp1,$0x20
 sub_i32 tmp0,esp,tmp1                            dead: 1
 mov_i32 esp,tmp0                                 sync: 0  dead: 1
 mov_i32 cc_src,tmp1                              sync: 0  dead: 0 1
 mov_i32 cc_dst,esp                               sync: 0  dead: 0
 discard cc_src2
 discard cc_op

which is compiled to

0x7f98ed3ff761:  mov    %ebx,(%rsi)            ; load esp
0x7f98ed3ff763:  sub    $0x20,%ebp             ; sub_i32 tmp0,esp,tmp1
0x7f98ed3ff766:  mov    %ebp,0x10(%r14)
0x7f98ed3ff76a:  mov    $0x20,%ebx             ; mov_i32 cc_src,tmp1
0x7f98ed3ff76f:  mov    %ebx,0x2c(%r14)
0x7f98ed3ff773:  mov    %ebp,0x28(%r14)        ; mov_i32 cc_dst,esp

TCG doesn't convert the "mov_i32 cc_src,tmp1" to movi, instead it tracks
the register as a TEMP_VAL_CONST.


Reply via email to