annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/address/RawAddressNode.java @ 21783:a858c5f56d8a

Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 08 Jun 2015 18:47:58 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21783
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
1 /*
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
4 *
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
8 *
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
13 * accompanied this code).
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
14 *
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
18 *
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
21 * questions.
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
22 */
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.nodes.memory.address;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
24
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
25 import com.oracle.graal.graph.*;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
26 import com.oracle.graal.nodeinfo.*;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
27 import com.oracle.graal.nodes.*;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
28
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
29 /**
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
30 * Convert a word-sized integer to a raw address.
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
31 */
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
32 @NodeInfo(allowedUsageTypes = InputType.Association)
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
33 public class RawAddressNode extends AddressNode {
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
34 public static final NodeClass<RawAddressNode> TYPE = NodeClass.create(RawAddressNode.class);
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
35
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
36 @Input ValueNode address;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
37
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
38 public RawAddressNode(ValueNode address) {
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
39 super(TYPE);
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
40 this.address = address;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
41 }
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
42
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
43 public ValueNode getAddress() {
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
44 return address;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
45 }
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
46
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
47 public void setAddress(ValueNode address) {
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
48 updateUsages(this.address, address);
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
49 this.address = address;
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
50 }
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
51
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
52 @NodeIntrinsic
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
53 public static native Address address(long address);
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
54
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
55 @NodeIntrinsic
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
56 public static native Address address(Object address);
a858c5f56d8a Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
57 }