graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java

Print this page
rev 14070 : Merge with default

*** 39,48 **** --- 39,50 ---- import com.oracle.graal.hsail.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.hsail.*; import com.oracle.graal.nodes.*; + import com.oracle.graal.nodes.spi.Replacements; + import com.oracle.graal.replacements.hsail.*; /** * HSAIL specific backend. */ public class HSAILHotSpotBackend extends HotSpotBackend {
*** 61,76 **** --- 63,93 ---- @Override public boolean shouldAllocateRegisters() { return true; } + /** + * Completes the initialization of the HSAIL backend. This includes initializing the providers + * and registering any method substitutions specified by the HSAIL backend. + */ @Override public void completeInitialization() { final HotSpotProviders providers = getProviders(); HotSpotVMConfig config = getRuntime().getConfig(); + // Initialize the lowering provider. final HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer(); lowerer.initialize(providers, config); + // Register the replacements used by the HSAIL backend. + Replacements replacements = providers.getReplacements(); + try { + // Register the substitutions for java.lang.Math routines. + // replacements.registerSubstitutions(Class.forName("com.oracle.graal.replacements.hsail.HSAILMathSubstitutions")); + replacements.registerSubstitutions(HSAILMathSubstitutions.class); + + } catch (Exception e) { + e.printStackTrace(); + } } /** * Use the HSAIL register set when the compilation target is HSAIL. */