Dear all,

I have a question about the way the machine description works and how
it affects the different passes of the compiler. I was reading the GNU
Compiler Collection Internals and I found this part (in section
14.8.1):

     (define_insn ""
       [(set (match_operand:SI 0 "general_operand" "=r")
             (plus:SI (match_dup 0)
                      (match_operand:SI 1 "general_operand" "r")))]
       ""
       "...")

which has two operands, one of which must appear in two places, and

     (define_insn ""
       [(set (match_operand:SI 0 "general_operand" "=r")
             (plus:SI (match_operand:SI 1 "general_operand" "0")
                      (match_operand:SI 2 "general_operand" "r")))]
       ""
       "...")

which has three operands, two of which are required by a constraint to
be identical.



My question is :
- How do the constraints work for match_dup or for when you put "0" as
a constraint? Since we want the same register but as input and not
output, how does the compiler set up its dependencies? Does it just
forget the "=" or "+" for the match_dup or "0" ?

- I also read that it is possible to assign a letter with a number for
the constraint. Does this mean I can do "r0" to say, it's going to be
an input register but it must look like the one you'll find in
position 0?

- My third question is: why not put "+r" as the constraint instead of
"=r" since we are going to be reading and writing into r0.

- Finally, I have a similar instruction definition, if I use the first
solution (match_dup), the instruction that will calculate the
input/output operand 0 sometimes gets removed by the web pass. But if
I use the second solution (put a "0" constraint), then it is no longer
removed. Any idea why these two definitions would be treated
differently in the web pass?

Thanks again in advance,
Jc

Reply via email to