Baffling USE in

Andrew Dinn adinn at
Thu Jan 21 10:29:32 UTC 2016

On 21/01/16 10:22, Andrew Haley wrote:
> In this pattern:
> instruct compI_rReg(rFlagsReg cr, rRegI op1, rRegI op2)
> %{
>   match(Set cr (CmpI op1 op2));
>   effect(DEF cr, USE op1, USE op2);
>   format %{ "cmpl    $op1, $op2" %}
>   opcode(0x3B);  /* Opcode 3B /r */
>   ins_encode(REX_reg_reg(op1, op2), OpcP, reg_reg(op1, op2));
>   ins_pipe(ialu_cr_reg_reg);
> %}
> why does the USE appear in the effect?  And the DEF?  The operands
> appear in the match expression in the normal way, so I would have
> thought the effect expression unnecessary.  It's this pattern: others
> don't have the effect:

I am not certain of this but I note that the above rule is used for
direct matching and also used for expansion. I believe the expansion
process requires an effect declaration even though that effect is also
implied by the match rule. There are many instruction definitions which
are only used for matching and they have an effect declaration but no
match declaration.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (US), Michael O'Neill (Ireland), Paul
Argiry (US)

More information about the hotspot-compiler-dev mailing list