1 /* 2 * Copyright (c) 2011, 2016, 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 */ 23 package org.graalvm.compiler.nodes.spi; 24 25 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider; 26 import org.graalvm.compiler.nodes.FixedNode; 27 import org.graalvm.compiler.nodes.FixedWithNextNode; 28 import org.graalvm.compiler.nodes.LogicNode; 29 import org.graalvm.compiler.nodes.extended.AnchoringNode; 30 import org.graalvm.compiler.nodes.extended.GuardingNode; 31 32 import jdk.vm.ci.meta.ConstantReflectionProvider; 33 import jdk.vm.ci.meta.DeoptimizationAction; 34 import jdk.vm.ci.meta.DeoptimizationReason; 35 import jdk.vm.ci.meta.JavaConstant; 36 import jdk.vm.ci.meta.MetaAccessProvider; 37 38 public interface LoweringTool { 39 40 MetaAccessProvider getMetaAccess(); 41 42 LoweringProvider getLowerer(); 43 44 ConstantReflectionProvider getConstantReflection(); 45 46 ConstantFieldProvider getConstantFieldProvider(); 47 48 Replacements getReplacements(); 49 50 StampProvider getStampProvider(); 51 52 NodeCostProvider getNodeCostProvider(); 53 54 GuardingNode createGuard(FixedNode before, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action); 55 56 GuardingNode createGuard(FixedNode before, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, JavaConstant speculation, boolean negated); 57 58 /** 59 * Gets the closest fixed node preceding the node currently being lowered. 60 */ 61 FixedWithNextNode lastFixedNode(); 62 63 AnchoringNode getCurrentGuardAnchor(); 64 65 /** 66 * Marker interface lowering stages. 67 */ 68 interface LoweringStage { 69 } 70 71 /** 72 * The lowering stages used in a standard Graal phase plan. Lowering is called 3 times, during 73 * every tier of compilation. 74 */ 75 enum StandardLoweringStage implements LoweringStage { 76 HIGH_TIER, 77 MID_TIER, 78 LOW_TIER 79 } 80 81 /** 82 * Returns current lowering stage. 83 */ 84 LoweringStage getLoweringStage(); 85 }