1 /* 2 * Copyright (c) 2014, 2014, 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 24 package org.graalvm.compiler.nodes.spi; 25 26 import org.graalvm.compiler.graph.Node; 27 import org.graalvm.compiler.nodes.ValueNode; 28 29 import jdk.vm.ci.meta.Value; 30 31 public interface NodeValueMap { 32 33 /** 34 * Returns the operand that has been previously initialized by 35 * {@link #setResult(ValueNode, Value)} with the result of an instruction. It's a code 36 * generation error to ask for the operand of ValueNode that doesn't have one yet. 37 * 38 * @param node A node that produces a result value. 39 */ 40 Value operand(Node node); 41 42 /** 43 * @return {@code true} if there is an {@link Value operand} associated with the {@code node} in 44 * the current block. 45 */ 46 boolean hasOperand(Node node); 47 48 /** 49 * Associates {@code operand} with the {@code node} in the current block. 50 * 51 * @return {@code operand} 52 */ 53 Value setResult(ValueNode node, Value operand); 54 55 /** 56 * Gets the the {@link ValueNode} that produced a {@code value}. If the {@code value} is not 57 * associated with a {@link ValueNode} {@code null} is returned. 58 * 59 * This method is intended for debugging purposes only. 60 */ 61 ValueNode valueForOperand(Value value); 62 }