001/*
002 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package com.oracle.graal.hotspot.meta;
024
025import jdk.internal.jvmci.hotspot.*;
026import jdk.internal.jvmci.meta.*;
027
028import com.oracle.graal.api.replacements.*;
029import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
030import com.oracle.graal.hotspot.word.*;
031import com.oracle.graal.nodes.spi.*;
032import com.oracle.graal.phases.tiers.*;
033import com.oracle.graal.phases.util.*;
034
035/**
036 * Extends {@link Providers} to include a number of extra capabilities used by the HotSpot parts of
037 * the compiler.
038 */
039public class HotSpotProviders extends Providers {
040
041    private final SuitesProvider suites;
042    private final HotSpotRegistersProvider registers;
043    private final SnippetReflectionProvider snippetReflection;
044    private final HotSpotWordTypes wordTypes;
045    private final Plugins graphBuilderPlugins;
046
047    public HotSpotProviders(MetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls,
048                    LoweringProvider lowerer, Replacements replacements, SuitesProvider suites, HotSpotRegistersProvider registers, SnippetReflectionProvider snippetReflection,
049                    HotSpotWordTypes wordTypes, Plugins graphBuilderPlugins) {
050        super(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, new HotSpotStampProvider(codeCache.getTarget().wordKind));
051        this.suites = suites;
052        this.registers = registers;
053        this.snippetReflection = snippetReflection;
054        this.wordTypes = wordTypes;
055        this.graphBuilderPlugins = graphBuilderPlugins;
056    }
057
058    @Override
059    public HotSpotCodeCacheProvider getCodeCache() {
060        return (HotSpotCodeCacheProvider) super.getCodeCache();
061    }
062
063    @Override
064    public HotSpotForeignCallsProvider getForeignCalls() {
065        return (HotSpotForeignCallsProvider) super.getForeignCalls();
066    }
067
068    public SuitesProvider getSuites() {
069        return suites;
070    }
071
072    public HotSpotRegistersProvider getRegisters() {
073        return registers;
074    }
075
076    public SnippetReflectionProvider getSnippetReflection() {
077        return snippetReflection;
078    }
079
080    public Plugins getGraphBuilderPlugins() {
081        return graphBuilderPlugins;
082    }
083
084    public HotSpotWordTypes getWordTypes() {
085        return wordTypes;
086    }
087}