Graal compiler: AMD64 Intrinsics design

Halimi, Jean-Philippe jean-philippe.halimi at intel.com
Wed Aug 15 18:57:06 UTC 2018


Hello everyone,

I'm getting started with the Graal source code and I'd like to add support for new BMI intrinsics, along with these already in place. I'm looking for help from people who developed the existing intrinsics infrastructure. Namely, I would like to double check that my initial understanding is correct.

Could you please let me know if the following steps are correct and sufficient?

1. org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/ --> will need to add any new type of instructions there if necessary
2. org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/ --> will need to add new LIR types if necessary, typically in a new Node class that will represent the intrinsic. Design in pseudo code would be as follows:

public final class AMD64NewNode extends UnaryNode implements ArithmeticLirLowerable {
   a. Constructor
   b. tryFold(ValueNode value) method: will try convert the input value to the corresponding value if possible.
   c. generate method: will generate the appropriate LIR containing the intrinsic in the builder.
}

3. Add an entry in org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java in order to support the intrinsic in the graph builder if hardware is supported

Thank you,

Jp


More information about the graal-dev mailing list