MemoryPhiNode.java revision 12651:6ef01bd40ce2
11573Srgrimes/* 21573Srgrimes * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. 31573Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41573Srgrimes * 51573Srgrimes * This code is free software; you can redistribute it and/or modify it 61573Srgrimes * under the terms of the GNU General Public License version 2 only, as 71573Srgrimes * published by the Free Software Foundation. 81573Srgrimes * 91573Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 101573Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 111573Srgrimes * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 121573Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 131573Srgrimes * accompanied this code). 141573Srgrimes * 151573Srgrimes * You should have received a copy of the GNU General Public License version 161573Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 171573Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 181573Srgrimes * 191573Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 201573Srgrimes * or visit www.oracle.com if you need additional information or have any 211573Srgrimes * questions. 221573Srgrimes */ 231573Srgrimespackage org.graalvm.compiler.nodes.memory; 241573Srgrimes 251573Srgrimesimport org.graalvm.compiler.core.common.LocationIdentity; 261573Srgrimesimport org.graalvm.compiler.core.common.type.StampFactory; 271573Srgrimesimport org.graalvm.compiler.graph.NodeClass; 2854770Sgreenimport org.graalvm.compiler.graph.NodeInputList; 2954770Sgreenimport org.graalvm.compiler.nodeinfo.InputType; 301573Srgrimesimport org.graalvm.compiler.nodeinfo.NodeInfo; 311573Srgrimesimport org.graalvm.compiler.nodes.AbstractMergeNode; 32129184Sbdeimport org.graalvm.compiler.nodes.PhiNode; 331573Srgrimesimport org.graalvm.compiler.nodes.ValueNode; 3423668Speter 351573Srgrimes/** 36129184Sbde * Memory {@code PhiNode}s merge memory dependencies at control flow merges. 37129184Sbde */ 3890045Sobrien@NodeInfo(nameTemplate = "Phi({i#values}) {p#locationIdentity/s}", allowedUsageTypes = {InputType.Memory}) 3990045Sobrienpublic final class MemoryPhiNode extends PhiNode implements MemoryNode { 401573Srgrimes 4171579Sdeischen public static final NodeClass<MemoryPhiNode> TYPE = NodeClass.create(MemoryPhiNode.class); 421573Srgrimes @Input(InputType.Memory) NodeInputList<ValueNode> values; 43129161Speadar protected final LocationIdentity locationIdentity; 441573Srgrimes 451573Srgrimes public MemoryPhiNode(AbstractMergeNode merge, LocationIdentity locationIdentity) { 461573Srgrimes super(TYPE, StampFactory.forVoid(), merge); 471573Srgrimes this.locationIdentity = locationIdentity; 481573Srgrimes this.values = new NodeInputList<>(this); 491573Srgrimes } 501573Srgrimes 511573Srgrimes public MemoryPhiNode(AbstractMergeNode merge, LocationIdentity locationIdentity, ValueNode[] values) { 52175688Syar super(TYPE, StampFactory.forVoid(), merge); 5371579Sdeischen this.locationIdentity = locationIdentity; 541573Srgrimes this.values = new NodeInputList<>(this, values); 55235647Sgleb } 56235647Sgleb 57175688Syar public LocationIdentity getLocationIdentity() { 58175688Syar return locationIdentity; 59175688Syar } 60175688Syar 61175688Syar @Override 62175688Syar public NodeInputList<ValueNode> values() { 63175688Syar return values; 64175688Syar } 65175688Syar} 66175688Syar