This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Immediates propagated wrongly in stores


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~



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]