public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* match_dup as internal operands
       [not found] <1324405305.17587.ezmlm@gcc.gnu.org>
@ 2011-12-20 21:15 ` srimeruva
  2011-12-21  0:02   ` Ian Lance Taylor
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: srimeruva @ 2011-12-20 21:15 UTC (permalink / raw)
  To: gcc-help

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)); ")




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: match_dup as internal operands
  2011-12-20 21:15 ` match_dup as internal operands srimeruva
@ 2011-12-21  0:02   ` Ian Lance Taylor
  2012-02-04  7:06   ` constraints validation in reload pass srimeruva
  2012-02-04 12:02   ` match_dup as internal operands Georg-Johann Lay
  2 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2011-12-21  0:02 UTC (permalink / raw)
  To: srimeruva; +Cc: gcc-help

srimeruva@cse.iitb.ac.in writes:

> 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)); ")

This would normally be used for a named pattern which does not expect
operand[2] to be filled in.  Since there is no operand[2], using a
match_operand does not make sense.  But since operand[2] needs to be
referenced in the generated pattern, it has to appear somehow.
match_dup is a reasonable compromise, because match_dup always matches.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* constraints validation in reload pass
  2011-12-20 21:15 ` match_dup as internal operands srimeruva
  2011-12-21  0:02   ` Ian Lance Taylor
@ 2012-02-04  7:06   ` srimeruva
  2012-02-04 11:49     ` Georg-Johann Lay
  2012-02-04 12:02   ` match_dup as internal operands Georg-Johann Lay
  2 siblings, 1 reply; 5+ messages in thread
From: srimeruva @ 2012-02-04  7:06 UTC (permalink / raw)
  To: gcc-help

can anyone explain where(the part of the code or function) constraints in
machine descriptions are validated in reload pass of gcc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: constraints validation in reload pass
  2012-02-04  7:06   ` constraints validation in reload pass srimeruva
@ 2012-02-04 11:49     ` Georg-Johann Lay
  0 siblings, 0 replies; 5+ messages in thread
From: Georg-Johann Lay @ 2012-02-04 11:49 UTC (permalink / raw)
  To: srimeruva; +Cc: gcc-help

srimeruva@cse.iitb.ac.in schrieb:
> can anyone explain where(the part of the code or function) constraints in
> machine descriptions are validated in reload pass of gcc.

Please do not start a new topic by answering to an other, already 
existing topic ("match_dup as internal operands" in this case).

This will mess up email relations and thus confuse threaded email programs.

Thanks.

Part of the constraint checking code is located in recog.c, for example 
constrain_operands.

Target specific constraint-checkiers are auto-generated from backend's 
constraints.md file. For that code, see insn-constraints.c and 
insn-preds.c in the build directory.

Reloading and register allocation itself is performed by reload*.c and 
ira*.c

Johann

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: match_dup as internal operands
  2011-12-20 21:15 ` match_dup as internal operands srimeruva
  2011-12-21  0:02   ` Ian Lance Taylor
  2012-02-04  7:06   ` constraints validation in reload pass srimeruva
@ 2012-02-04 12:02   ` Georg-Johann Lay
  2 siblings, 0 replies; 5+ messages in thread
From: Georg-Johann Lay @ 2012-02-04 12:02 UTC (permalink / raw)
  To: srimeruva; +Cc: gcc-help

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-04 12:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1324405305.17587.ezmlm@gcc.gnu.org>
2011-12-20 21:15 ` match_dup as internal operands srimeruva
2011-12-21  0:02   ` Ian Lance Taylor
2012-02-04  7:06   ` constraints validation in reload pass srimeruva
2012-02-04 11:49     ` Georg-Johann Lay
2012-02-04 12:02   ` match_dup as internal operands Georg-Johann Lay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).