emit vs. visit in LIR interface
Doug Simon
doug.simon at oracle.com
Thu Oct 17 13:55:49 PDT 2013
On 10/17/2013 09:40 PM, Deneau, Tom wrote:
> Say you've defined a new XxxNode and a LoweredXxxNode version also.
> In the generate method for the LoweredXxxNode, what determines whether one should
>
> a) define a emitXxx in the LIRGenerator interface, do the parsing work in the LoweredXxxNode.generate method itself, and then call gen.emitXXX (like for example the say BitCountNode.generate works)
>
> b) define a visitXxx routine as part of the LIRGenerator interface, and the LoweredXxxNode.generate basically just calls gen.visitXxx(LoweredXxxNode) and do the real work in the visitXxx (like for example VisitCompareAndSwap)
Or:
c) For a backend-specific node, cast the LIRGenerator/LIRGeneratorTool parameter in LoweredXxxNode.generate() to a backend-specific generator interface and call a backend-specific emitXXX method. Look at PatchReturnAddressNode or JumpToExceptionHandlerInCallerNode.
I'm assuming c) matches your use case.
-Doug
More information about the graal-dev
mailing list