1 /*
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
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 */
88 assert host == null;
89
90 GraalHotSpotVMConfig config = runtime.getVMConfig();
91 JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
92 HotSpotRegistersProvider registers = createRegisters();
93 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
94 HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
95 TargetDescription target = codeCache.getTarget();
96 HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
97 HotSpotConstantFieldProvider constantFieldProvider = createConstantFieldProvider(config, metaAccess);
98 Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
99 HotSpotWordTypes wordTypes = createWordTypes(metaAccess, target);
100 HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
101 LoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
102 HotSpotStampProvider stampProvider = createStampProvider();
103 HotSpotGCProvider gc = createGCProvider(config);
104 Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider, gc);
105 HotSpotSnippetReflectionProvider snippetReflection = createSnippetReflection(runtime, constantReflection, wordTypes);
106 BytecodeProvider bytecodeProvider = createBytecodeProvider(metaAccess, snippetReflection);
107 HotSpotReplacementsImpl replacements = createReplacements(target, p, snippetReflection, bytecodeProvider);
108 Plugins plugins = createGraphBuilderPlugins(compilerConfiguration, config, metaAccess, constantReflection, foreignCalls, snippetReflection, replacements, wordTypes, runtime.getOptions());
109 replacements.setGraphBuilderPlugins(plugins);
110 HotSpotSuitesProvider suites = createSuites(config, runtime, compilerConfiguration, plugins, replacements);
111 HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers,
112 snippetReflection, wordTypes, plugins, gc);
113 replacements.setProviders(providers);
114
115 return createBackend(config, runtime, providers);
116 }
117
118 protected Plugins createGraphBuilderPlugins(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotMetaAccessProvider metaAccess,
119 HotSpotConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls,
120 HotSpotSnippetReflectionProvider snippetReflection, HotSpotReplacementsImpl replacements, HotSpotWordTypes wordTypes, OptionValues options) {
121 Plugins plugins = HotSpotGraphBuilderPlugins.create(compilerConfiguration, config, wordTypes, metaAccess, constantReflection, snippetReflection, foreignCalls, replacements, options);
122 SPARCGraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), false);
123 return plugins;
124 }
125
126 /**
127 * @param replacements
128 */
129 protected HotSpotSuitesProvider createSuites(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, CompilerConfiguration compilerConfiguration, Plugins plugins,
130 Replacements replacements) {
131 return new AddressLoweringHotSpotSuitesProvider(new SPARCSuitesCreator(compilerConfiguration, plugins), config, runtime, new AddressLoweringPhase(new SPARCAddressLowering()));
132 }
133
134 protected SPARCHotSpotBackend createBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
135 return new SPARCHotSpotBackend(config, runtime, providers);
136 }
137
138 protected HotSpotLoweringProvider createLowerer(HotSpotGraalRuntimeProvider runtime, HotSpotMetaAccessProvider metaAccess, HotSpotForeignCallsProvider foreignCalls,
139 HotSpotRegistersProvider registers, HotSpotConstantReflectionProvider constantReflection, TargetDescription target) {
140 return new SPARCHotSpotLoweringProvider(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
141 }
|
1 /*
2 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
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 */
88 assert host == null;
89
90 GraalHotSpotVMConfig config = runtime.getVMConfig();
91 JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
92 HotSpotRegistersProvider registers = createRegisters();
93 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
94 HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
95 TargetDescription target = codeCache.getTarget();
96 HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
97 HotSpotConstantFieldProvider constantFieldProvider = createConstantFieldProvider(config, metaAccess);
98 Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
99 HotSpotWordTypes wordTypes = createWordTypes(metaAccess, target);
100 HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
101 LoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
102 HotSpotStampProvider stampProvider = createStampProvider();
103 HotSpotGCProvider gc = createGCProvider(config);
104 Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider, gc);
105 HotSpotSnippetReflectionProvider snippetReflection = createSnippetReflection(runtime, constantReflection, wordTypes);
106 BytecodeProvider bytecodeProvider = createBytecodeProvider(metaAccess, snippetReflection);
107 HotSpotReplacementsImpl replacements = createReplacements(target, p, snippetReflection, bytecodeProvider);
108 Plugins plugins = createGraphBuilderPlugins(runtime, compilerConfiguration, config, metaAccess, constantReflection, foreignCalls, snippetReflection, replacements, wordTypes,
109 runtime.getOptions());
110 replacements.setGraphBuilderPlugins(plugins);
111 HotSpotSuitesProvider suites = createSuites(config, runtime, compilerConfiguration, plugins, replacements);
112 HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers,
113 snippetReflection, wordTypes, plugins, gc);
114 replacements.setProviders(providers);
115
116 return createBackend(config, runtime, providers);
117 }
118
119 protected Plugins createGraphBuilderPlugins(HotSpotGraalRuntimeProvider graalRuntime,
120 CompilerConfiguration compilerConfiguration,
121 GraalHotSpotVMConfig config,
122 HotSpotMetaAccessProvider metaAccess,
123 HotSpotConstantReflectionProvider constantReflection,
124 HotSpotForeignCallsProvider foreignCalls,
125 HotSpotSnippetReflectionProvider snippetReflection,
126 HotSpotReplacementsImpl replacements,
127 HotSpotWordTypes wordTypes,
128 OptionValues options) {
129 Plugins plugins = HotSpotGraphBuilderPlugins.create(
130 graalRuntime,
131 compilerConfiguration,
132 config,
133 wordTypes,
134 metaAccess,
135 constantReflection,
136 snippetReflection,
137 foreignCalls,
138 replacements,
139 options);
140 SPARCGraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), false);
141 return plugins;
142 }
143
144 /**
145 * @param replacements
146 */
147 protected HotSpotSuitesProvider createSuites(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, CompilerConfiguration compilerConfiguration, Plugins plugins,
148 Replacements replacements) {
149 return new AddressLoweringHotSpotSuitesProvider(new SPARCSuitesCreator(compilerConfiguration, plugins), config, runtime, new AddressLoweringPhase(new SPARCAddressLowering()));
150 }
151
152 protected SPARCHotSpotBackend createBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
153 return new SPARCHotSpotBackend(config, runtime, providers);
154 }
155
156 protected HotSpotLoweringProvider createLowerer(HotSpotGraalRuntimeProvider runtime, HotSpotMetaAccessProvider metaAccess, HotSpotForeignCallsProvider foreignCalls,
157 HotSpotRegistersProvider registers, HotSpotConstantReflectionProvider constantReflection, TargetDescription target) {
158 return new SPARCHotSpotLoweringProvider(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
159 }
|