This is the mail archive of the gcc-help@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: match_dup as internal operands


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



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