Le jeudi 10 avril 2008 à 15:48 +0200, Stelian Pop a écrit :
> Le mercredi 09 avril 2008 à 18:21 -0400, DJ Delorie a écrit :
> > > Maybe I should reserve a special register for this usage (say r0).
> > 
> > That might be the only way, yes.
> 
> Ok, I reserved r0 (BP_REGNUM) for such reloads, and I'm generating new
> instructions in LEGITIMIZE_RELOAD_ADDRESS to calculate the memory
> address:
[...]

Now it seems that the register moves are correctly dealt with, but I'm
still having the same problem on calls: just like indirect addressing,
indirect calls are allowed only on even registers.

My patterns look like:

        (define_insn "*icall_value"
          [(set (match_operand 0 "register_operand" "=r")
                (call (mem:QI (match_operand:QI 1 "register_operand" "z"))
                      (match_operand:QI 2 "" "")))]
           ""  
           "icall (%1)"
          [(set_attr "cc" "none")]
        )

        (define_expand "call_value"
          [(set (match_operand 0 "register_operand" "=r")
                (call (match_operand:QI 1 "memory_operand" "m")
                      (match_operand:QI 2 "general_operand" "")))]
           ""  
           {   
                if (GET_CODE (XEXP(operands[1], 0)) != REG)
                        XEXP(operands[1], 0) = force_reg (QImode, XEXP 
(operands[1], 0));
           }
        )

This gives:

        (insn 27 26 29 2 ../../../../src/gcc-4.3.0/libgcc/../gcc/libgcc2.c:564 
(set (reg/f:QI 114)
                (symbol_ref:QI ("__lshrqi3") [flags 0x41])) 1 {*movqi} 
(expr_list:REG_EQUIV (symbol_ref:QI ("__lshrqi3") [flags 0x41])
                (nil)))

...

        (call_insn/u 30 29 31 2 
../../../../src/gcc-4.3.0/libgcc/../gcc/libgcc2.c:564 (set (reg:QI 4 r4) 
                (call (mem:QI (reg/f:QI 114) [0 S1 A16])
                    (const_int 0 [0x0]))) 37 {*icall_value} (expr_list:REG_DEAD 
(reg:QI 5 r5) 
                (expr_list:REG_EH_REGION (const_int -1 [0xffffffff])
                    (nil)))
            (expr_list:REG_DEP_TRUE (use (reg:QI 5 r5))
                (expr_list:REG_DEP_TRUE (use (reg:QI 4 r4 [ D.2373 ])) 
                    (nil))))

And r114 gets reloaded into r1:

        Reloads for insn # 30
        Reload 0: reload_in (QI) = (symbol_ref:QI ("__lshrqi3") [flags 0x41])
                 EIGHT_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine
                 reload_in_reg: (reg/f:QI 114)
                 reload_reg_rtx: (reg:QI 1 r1)

Which does not satisfy the *icall_value constraints:

        ../../../../src/gcc-4.3.0/libgcc/../gcc/libgcc2.c: In function 
‘__mulhi3’:
        ../../../../src/gcc-4.3.0/libgcc/../gcc/libgcc2.c:570: error: insn does 
not satisfy its constraints:
        (call_insn/u 30 195 162 2 
../../../../src/gcc-4.3.0/libgcc/../gcc/libgcc2.c:564 (set (reg:QI 4 r4)
                (call (mem:QI (reg:QI 1 r1) [0 S1 A16])
                    (const_int 0 [0x0]))) 37 {*icall_value} 
(expr_list:REG_EH_REGION (const_int -1 [0xffffffff])
                (nil))
            (expr_list:REG_DEP_TRUE (use (reg:QI 5 r5))
                (expr_list:REG_DEP_TRUE (use (reg:QI 4 r4 [ D.2373 ]))
                    (nil))))

It seems that this reload doesn't pass through LEGITIMIZE_ADDRESS or
LEGITIMIZE_RELOAD_ADDRESS... How can I specify here to choose an EVEN_REGS
in place of the EIGHT_REGS (in fact it should choose one register in the 
intersection of EIGHT and EVEN_REGS) ?
 
Thanks,

-- 
Stelian Pop <[EMAIL PROTECTED]>

Reply via email to