UnsafeMemoryLoadNode.java revision 12657:6ef01bd40ce2
1/* 2 * Copyright (c) 2016, 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 */ 23package org.graalvm.compiler.nodes.extended; 24 25import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2; 26import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1; 27 28import org.graalvm.compiler.core.common.LocationIdentity; 29import org.graalvm.compiler.core.common.type.StampFactory; 30import org.graalvm.compiler.graph.NodeClass; 31import org.graalvm.compiler.nodeinfo.NodeInfo; 32import org.graalvm.compiler.nodes.FixedWithNextNode; 33import org.graalvm.compiler.nodes.ValueNode; 34import org.graalvm.compiler.nodes.spi.Lowerable; 35import org.graalvm.compiler.nodes.spi.LoweringTool; 36 37import jdk.vm.ci.meta.JavaKind; 38 39/** 40 * Load of a value at a location specified as an absolute address. 41 */ 42@NodeInfo(cycles = CYCLES_2, size = SIZE_1) 43public class UnsafeMemoryLoadNode extends FixedWithNextNode implements Lowerable { 44 45 public static final NodeClass<UnsafeMemoryLoadNode> TYPE = NodeClass.create(UnsafeMemoryLoadNode.class); 46 47 @Input protected ValueNode address; 48 protected final JavaKind kind; 49 protected final LocationIdentity locationIdentity; 50 51 public UnsafeMemoryLoadNode(ValueNode address, JavaKind kind, LocationIdentity locationIdentity) { 52 super(TYPE, StampFactory.forKind(kind.getStackKind())); 53 this.address = address; 54 this.kind = kind; 55 this.locationIdentity = locationIdentity; 56 } 57 58 public ValueNode getAddress() { 59 return address; 60 } 61 62 public JavaKind getKind() { 63 return kind; 64 } 65 66 @Override 67 public void lower(LoweringTool tool) { 68 tool.getLowerer().lower(this, tool); 69 } 70 71 public LocationIdentity getLocationIdentity() { 72 return locationIdentity; 73 } 74} 75