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 java.util.Collection; 26 import java.util.List; 27 28 import org.graalvm.compiler.core.common.cfg.BlockMap; 29 import org.graalvm.compiler.core.common.type.Stamp; 30 import org.graalvm.compiler.graph.Node; 31 import org.graalvm.compiler.graph.NodeSourcePosition; 32 import org.graalvm.compiler.lir.LIRFrameState; 33 import org.graalvm.compiler.lir.gen.LIRGeneratorTool; 34 import org.graalvm.compiler.nodes.AbstractBeginNode; 35 import org.graalvm.compiler.nodes.AbstractEndNode; 36 import org.graalvm.compiler.nodes.AbstractMergeNode; 37 import org.graalvm.compiler.nodes.BreakpointNode; 38 import org.graalvm.compiler.nodes.DeoptimizingNode; 39 import org.graalvm.compiler.nodes.FullInfopointNode; 40 import org.graalvm.compiler.nodes.IfNode; 41 import org.graalvm.compiler.nodes.Invoke; 42 import org.graalvm.compiler.nodes.LoopEndNode; 43 import org.graalvm.compiler.nodes.SafepointNode; 44 import org.graalvm.compiler.nodes.StructuredGraph; 45 import org.graalvm.compiler.nodes.ValueNode; 46 import org.graalvm.compiler.nodes.calc.ConditionalNode; 47 import org.graalvm.compiler.nodes.cfg.Block; 48 import org.graalvm.compiler.nodes.extended.SwitchNode; 49 50 import jdk.vm.ci.code.CallingConvention; 51 import jdk.vm.ci.meta.Value; 52 53 public interface NodeLIRBuilderTool extends NodeValueMap { 54 55 // TODO (je) remove and move into the Node 56 LIRFrameState state(DeoptimizingNode deopt); 57 58 void emitIf(IfNode i); 59 60 void emitConditional(ConditionalNode i); 61 62 void emitSwitch(SwitchNode i); 63 64 void emitInvoke(Invoke i); 65 66 // Handling of block-end nodes still needs to be unified in the LIRGenerator. 67 void visitMerge(AbstractMergeNode i); 68 69 void visitEndNode(AbstractEndNode i); 70 71 void visitLoopEnd(LoopEndNode i); 72 73 // These methods define the contract a runtime specific backend must provide. 74 75 void visitSafepointNode(SafepointNode i); 76 77 void visitBreakpointNode(BreakpointNode i); 78 79 void visitFullInfopointNode(FullInfopointNode i); 80 81 void setSourcePosition(NodeSourcePosition position); 82 83 LIRGeneratorTool getLIRGeneratorTool(); 84 85 void emitOverflowCheckBranch(AbstractBeginNode overflowSuccessor, AbstractBeginNode next, Stamp compareStamp, double probability); 86 87 Value[] visitInvokeArguments(CallingConvention cc, Collection<ValueNode> arguments); 88 89 void doBlock(Block block, StructuredGraph graph, BlockMap<List<Node>> blockMap); 90 }