src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLoweringProvider.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLoweringProvider.java

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.hotspot.amd64;
  24 
  25 import static org.graalvm.compiler.hotspot.HotSpotBackend.Options.GraalArithmeticStubs;
  26 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_COS_STUB;
  27 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_EXP_STUB;
  28 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_LOG10_STUB;
  29 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_LOG_STUB;
  30 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_POW_STUB;
  31 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_SIN_STUB;
  32 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_TAN_STUB;
  33 
  34 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  35 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;

  36 import org.graalvm.compiler.graph.Node;
  37 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
  38 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
  39 import org.graalvm.compiler.hotspot.meta.DefaultHotSpotLoweringProvider;
  40 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
  41 import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
  42 import org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode;
  43 import org.graalvm.compiler.hotspot.replacements.profiling.ProbabilisticProfileSnippets;
  44 import org.graalvm.compiler.nodes.calc.FloatConvertNode;
  45 import org.graalvm.compiler.nodes.spi.LoweringTool;
  46 import org.graalvm.compiler.options.OptionValues;
  47 import org.graalvm.compiler.replacements.amd64.AMD64ConvertSnippets;
  48 import org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode.BinaryOperation;
  49 import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation;
  50 
  51 import jdk.vm.ci.code.TargetDescription;
  52 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
  53 import jdk.vm.ci.meta.MetaAccessProvider;
  54 
  55 public class AMD64HotSpotLoweringProvider extends DefaultHotSpotLoweringProvider {
  56 
  57     private AMD64ConvertSnippets.Templates convertSnippets;
  58     private ProbabilisticProfileSnippets.Templates profileSnippets;
  59 
  60     public AMD64HotSpotLoweringProvider(HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, ForeignCallsProvider foreignCalls, HotSpotRegistersProvider registers,
  61                     HotSpotConstantReflectionProvider constantReflection, TargetDescription target) {
  62         super(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
  63     }
  64 
  65     @Override
  66     public void initialize(OptionValues options, HotSpotProviders providers, GraalHotSpotVMConfig config) {
  67         convertSnippets = new AMD64ConvertSnippets.Templates(options, providers, providers.getSnippetReflection(), providers.getCodeCache().getTarget());
  68         profileSnippets = ProfileNode.Options.ProbabilisticProfiling.getValue(options)
  69                         ? new ProbabilisticProfileSnippets.Templates(options, providers, providers.getCodeCache().getTarget()) : null;
  70         super.initialize(options, providers, config);
  71     }
  72 
  73     @Override
  74     public void lower(Node n, LoweringTool tool) {
  75         if (n instanceof FloatConvertNode) {
  76             convertSnippets.lower((FloatConvertNode) n, tool);
  77         } else if (profileSnippets != null && n instanceof ProfileNode) {
  78             profileSnippets.lower((ProfileNode) n, tool);
  79         } else {
  80             super.lower(n, tool);
  81         }
  82     }
  83 
  84     @Override
  85     protected ForeignCallDescriptor toForeignCall(UnaryOperation operation) {
  86         if (GraalArithmeticStubs.getValue(runtime.getOptions())) {
  87             switch (operation) {
  88                 case LOG:
  89                     return ARITHMETIC_LOG_STUB;
  90                 case LOG10:




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.hotspot.amd64;
  24 
  25 import static org.graalvm.compiler.hotspot.HotSpotBackend.Options.GraalArithmeticStubs;
  26 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_COS_STUB;
  27 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_EXP_STUB;
  28 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_LOG10_STUB;
  29 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_LOG_STUB;
  30 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_POW_STUB;
  31 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_SIN_STUB;
  32 import static org.graalvm.compiler.hotspot.amd64.AMD64HotSpotForeignCallsProvider.ARITHMETIC_TAN_STUB;
  33 
  34 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  35 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
  36 import org.graalvm.compiler.debug.DebugHandlersFactory;
  37 import org.graalvm.compiler.graph.Node;
  38 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
  39 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
  40 import org.graalvm.compiler.hotspot.meta.DefaultHotSpotLoweringProvider;
  41 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
  42 import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
  43 import org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode;
  44 import org.graalvm.compiler.hotspot.replacements.profiling.ProbabilisticProfileSnippets;
  45 import org.graalvm.compiler.nodes.calc.FloatConvertNode;
  46 import org.graalvm.compiler.nodes.spi.LoweringTool;
  47 import org.graalvm.compiler.options.OptionValues;
  48 import org.graalvm.compiler.replacements.amd64.AMD64ConvertSnippets;
  49 import org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode.BinaryOperation;
  50 import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation;
  51 
  52 import jdk.vm.ci.code.TargetDescription;
  53 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
  54 import jdk.vm.ci.meta.MetaAccessProvider;
  55 
  56 public class AMD64HotSpotLoweringProvider extends DefaultHotSpotLoweringProvider {
  57 
  58     private AMD64ConvertSnippets.Templates convertSnippets;
  59     private ProbabilisticProfileSnippets.Templates profileSnippets;
  60 
  61     public AMD64HotSpotLoweringProvider(HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, ForeignCallsProvider foreignCalls, HotSpotRegistersProvider registers,
  62                     HotSpotConstantReflectionProvider constantReflection, TargetDescription target) {
  63         super(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
  64     }
  65 
  66     @Override
  67     public void initialize(OptionValues options, Iterable<DebugHandlersFactory> factories, HotSpotProviders providers, GraalHotSpotVMConfig config) {
  68         convertSnippets = new AMD64ConvertSnippets.Templates(options, factories, providers, providers.getSnippetReflection(), providers.getCodeCache().getTarget());
  69         profileSnippets = ProfileNode.Options.ProbabilisticProfiling.getValue(options)
  70                         ? new ProbabilisticProfileSnippets.Templates(options, factories, providers, providers.getCodeCache().getTarget()) : null;
  71         super.initialize(options, factories, providers, config);
  72     }
  73 
  74     @Override
  75     public void lower(Node n, LoweringTool tool) {
  76         if (n instanceof FloatConvertNode) {
  77             convertSnippets.lower((FloatConvertNode) n, tool);
  78         } else if (profileSnippets != null && n instanceof ProfileNode) {
  79             profileSnippets.lower((ProfileNode) n, tool);
  80         } else {
  81             super.lower(n, tool);
  82         }
  83     }
  84 
  85     @Override
  86     protected ForeignCallDescriptor toForeignCall(UnaryOperation operation) {
  87         if (GraalArithmeticStubs.getValue(runtime.getOptions())) {
  88             switch (operation) {
  89                 case LOG:
  90                     return ARITHMETIC_LOG_STUB;
  91                 case LOG10:


src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLoweringProvider.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File