This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: match_dup as internal operands
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: srimeruva at cse dot iitb dot ac dot in
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 04 Feb 2012 13:01:04 +0100
- Subject: Re: match_dup as internal operands
- References: <1324405305.17587.ezmlm@gcc.gnu.org> <ab38551f74fe0b1a415229dc537655db.squirrel@www.cse.iitb.ac.in>
srimeruva@cse.iitb.ac.in schrieb:
what is the advantage of using match_dup for internal operands as
(define_expand "zero_extendhisi2"
[(set (match_operand:SI 0 "register_operand" "")
(and:SI (subreg:SI
(match_operand:HI 1 "register_operand" "")
0)
(match_dup 2)))]
""
"operands[2]
= force_reg (SImode, GEN_INT (65535)); ")
zero_extendhisi2 is a standard insn name that gets 2 operands,
see "Standard Pattern Names For Generation" in the internals documentation.
Operand 2 is just a placeholder to add a 3rd operand that is
needed for (const_int 65535). Look at the generated code in
insn-emit.c:gen_zero_extendhisi2 and it will be clear:
That function gets two rtx parameters. The C-snip allocates an array
rtx[3] which is initialized with the arguments and the match_dup value.
These rtx'es are then used to emit RTL as specified by the expander.
Notice that usage in insns, splits, peepholes etc. is different and
serves as reference to an other operand when matching, for example in recog.
Johann