AMD64Arithmetic.java

Christian Wimmer christian.wimmer at oracle.com
Wed Feb 20 14:18:01 PST 2013


On 2/20/2013 2:05 PM, Venkatachalam, Vasanth wrote:
> Hi,
>
> I'm trying to understand AMD64Arithmetic.java and had some questions.
>
>
> 1)      Why are Op2RegCommutative, DivOp and ShiftOp defined separately instead of having the operations that would be covered  by these classes piggyback on Op1Reg and Op2Reg? More generally, what guides the decision of how many separate *Op classes should be defined in this file which call the emit( ) routine?

The operand fields have annotations that specify what locations are 
acceptable for the operand (register, stack, constant, ...). Since x86 
is very irregular (some instructions allow the right operand to me in 
memory, some allow constants, some only registers), there are different 
operation classes to model that.

>
> 2)      Am I right in thinking that these different Op objects (Op1Reg, etc) represent nodes in the LIR and the emit( ) routine decides based on the opcode, which native or assembly instructions should be emitted?

Yes

> What files should I look at to understand the plumbing that generates these nodes (and which I would need to update if I were to define new Op classes in this file)?

AMD64LIRGenerator generates these nodes.

-Christian


More information about the graal-dev mailing list