This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Constraints and reload
Sorry to bring this back to the conversation. Is there any reason why
this would not work with floating-point constraints ?
My "R" constraint is defined as:
(define_memory_constraint "R"
"R is for memory references which take 1 word for the instruction"
(and (match_code "mem")
(match_test "simple_memory_operand (op)")))
I have :
(define_insn "movdf_internal"
[(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,r,R")
(match_operand:DF 1 "general_operand" " r,F,R,r"))]
"check_move (operands[0], operands[1])"
"@
mov\\t%0,%1
lid\\t%0,%1
ldd\\t%0,%1
std\\t%1,%0"
[(set_attr "type" "move,arith,load,store")
(set_attr "mode" "DF,DF,DF,DF")
(set_attr "length" "1,1,1,1")])
However, on a relatively complex bit of code, I get :
error: unrecognizable insn:
(set (mem/s:DF (const:DI (plus:DI (symbol_ref:DI ("st") <var_decl
0x2a957d7aa0 st>)
(const_int 48 [0x30]))) [14 st+48 S8 A64])
(reg:DF 10 r10)) -1 (nil))
(My architecture cannot allow const as addresses to the store, it must
go through a register).
Basically, I have the same expand code and the same check_move
functions for the integer modes since they check the same things: is
it a memory, does it have an acceptable offset.
Check_move and simple_memory return false to the destination operand
of this set and the expand phase put "st" in a register.
But duing the greg pass, it shows:
Reloads for insn # 140
Reload 0: reload_out (DF) = (mem/s:DF (const:DI (plus:DI
(symbol_ref:DI ("st") <var_decl 0x2a957d7aa0 st>)
(const_int
48 [0x30]))) [14 st+48 S8 A64])
GR_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
reload_out_reg: (mem/s:DF (const:DI (plus:DI (symbol_ref:DI
("st") <var_decl 0x2a957d7aa0 st>)
(const_int
48 [0x30]))) [14 st+48 S8 A64])
reload_reg_rtx: (reg:DF 10 r10)
It is theorically possible that my code fails for integer modes but
that my code example doesn't force the compiler in the same route and
thus I don't see a fail. But I don't really think so.
Any ideas ?
Thanks a lot,
Jc
On Mon, Sep 14, 2009 at 2:16 PM, Jean Christophe Beyler
<jean.christophe.beyler@gmail.com> wrote:
> That seems to have fixed it, I just reverted back to what I had done initially.
>
> Thanks a lot,
> Jc
>
> On Mon, Sep 14, 2009 at 1:46 PM, Richard Henderson <rth@redhat.com> wrote:
>> On 09/14/2009 12:18 PM, Jean Christophe Beyler wrote:
>>>
>>> ? [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,R")
>>> ? ? ? ? (match_operand:DI 1 "general_operand" ? ? ?"r,i,R,r"))]
>>>
>>> Where R checks if the operand is a memory operand and if the offset is
>>> correct.
>>
>> Did you use define_memory_constraint for R, or just define_constraint?
>> If the former, it's a bug in reload; if the later, that's the problem.
>>
>>
>> r~
>>
>