This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Immediates propagated wrongly in stores
- From: Richard Henderson <rth at redhat dot com>
- To: Jean Christophe Beyler <jean dot christophe dot beyler at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 01 Jul 2009 09:23:06 -0700
- Subject: Re: Immediates propagated wrongly in stores
- References: <c568a2600907010836u7e09bedbta8fab25573d9e988@mail.gmail.com>
On 07/01/2009 08:36 AM, Jean Christophe Beyler wrote:
I tracked it down to the gcse pass. However, I thought I had turned
this off in the definition of a movdi in my machine description. But
apparently this is not sufficient, any ideas?
You probably just changed the constraint letters, but didn't change
the operand predicate. The constraint letters are only used during
register allocation, and the predicate is used elsewhere.
(match_operand:MODE N "predicate_function" "constraint_letters")
There are a number of pre-defined predicate functions you can use,
register_operand
nonmemory_operand
nonimmediate_operand
general_operand
and most ports find they need special ones to exactly match the
characteristics of some insns. e.g.
cpu.md:
(define_insn "*adddi_internal"
[(set (match_operand:DI 0 "register_operand" "=r,r,r")
(plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
(match_operand:DI 2 "add_operand" "r,K,L")))]
""
"@
addq %1,%2,%0
lda %0,%2(%1)
ldah %0,%h2(%1)")
predicates.md:
(define_predicate "add_operand"
(if_then_else (match_code "const_int")
(match_test "satisfies_constraint_K (op) ||
satisfies_constraint_L (op)")
(match_operand 0 "register_operand")))
You should strive to ensure that the predicate function exactly
matches the constraint letters. If the predicate function accepts
more than the constraint letters, the reload pass will fix it up.
But better code is generated when reload doesn't need to do this.
r~