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: About EXTRA_ADDRESS_CONSTRAINT


Alexandre Courbot wrote:

>The insn that is generated by the + operator is of the form:
>
>(set (mem (const (plus (symbol_ref "obj") (const_int x))))
>     (plus (mem (symbol_ref "var")) (const_int 2)))
>
>During reloading, I designed my EXTRA_ADDRESS_CONSTRAINT marked constraint to
>detect the destination was a member of a struct, and thus it changed this
>insn into:
>
>(set (reg REG) (plus (mem (symbol_ref "var")) (const_int 2)))
>(set (mem (const (plus (symbol_ref "obj") (const_int x))))
>     (reg REG))

But this is a simple reload of the value into a register; you shouldn't
need any of the 'special stuff' for that.

>Which was fine! But unfortunately it seems to be risky :( Using
>EXTRA_MEMORY_CONSTRAINT doesn't do what I need (it stores the address of the
>location to store the result into into the register and do a mem on it -
>which I can't reflect in the generated code)
>
>The pattern that matches this is:
>(set (match_operand 0 "nonimmediate_operand" "=Q")
>     (plus (match_operand 1 "general_operand" "Q")
>           (match_operand 2 "general_operand" "Q")))
>
>(Q is my "doesn't belong to a structure" constraint)

Simply define 'Q' as a normal EXTRA_CONSTRAINT, and rewrite the pattern as

(set (match_operand 0 "nonimmediate_operand" "=Qr")
     (plus (match_operand 1 "general_operand" "Qr")
           (match_operand 2 "general_operand" "Qr")))

so that reload will know it can reload into a register in case the 'Q'
doesn't match exactly.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com


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