Mercurial > hg > truffle
comparison graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MemoryAccess.java @ 3034:077f999e3583
New MemoryWrite node.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Mon, 20 Jun 2011 18:00:26 +0200 |
parents | |
children | fef84503ab7d |
comparison
equal
deleted
inserted
replaced
3033:ebd1d48a1ae1 | 3034:077f999e3583 |
---|---|
1 /* | |
2 * Copyright (c) 2011, 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 com.oracle.max.graal.compiler.ir; | |
24 | |
25 import com.oracle.max.graal.compiler.debug.*; | |
26 import com.oracle.max.graal.graph.*; | |
27 import com.sun.cri.ci.*; | |
28 | |
29 | |
30 public abstract class MemoryAccess extends Instruction { | |
31 private static final int INPUT_COUNT = 2; | |
32 private static final int INPUT_NODE = 0; | |
33 private static final int INPUT_GUARD = 1; | |
34 | |
35 private static final int SUCCESSOR_COUNT = 0; | |
36 | |
37 private int displacement; | |
38 private CiKind valueKind; | |
39 | |
40 /** | |
41 * The instruction that produces the object tested against null. | |
42 */ | |
43 public Value location() { | |
44 return (Value) inputs().get(super.inputCount() + INPUT_NODE); | |
45 } | |
46 | |
47 public Value setLocation(Value n) { | |
48 return (Value) inputs().set(super.inputCount() + INPUT_NODE, n); | |
49 } | |
50 | |
51 /** | |
52 * The instruction that produces the object tested against null. | |
53 */ | |
54 public GuardNode guard() { | |
55 return (GuardNode) inputs().get(super.inputCount() + INPUT_GUARD); | |
56 } | |
57 | |
58 public void setGuard(GuardNode n) { | |
59 inputs().set(super.inputCount() + INPUT_GUARD, n); | |
60 } | |
61 | |
62 public int displacement() { | |
63 return displacement; | |
64 } | |
65 | |
66 public CiKind valueKind() { | |
67 return valueKind; | |
68 } | |
69 | |
70 public MemoryAccess(CiKind kind, int displacement, int inputCount, int successorCount, Graph graph) { | |
71 super(kind.stackKind(), INPUT_COUNT + inputCount, SUCCESSOR_COUNT + successorCount, graph); | |
72 this.displacement = displacement; | |
73 this.valueKind = kind; | |
74 } | |
75 | |
76 @Override | |
77 public void print(LogStream out) { | |
78 out.print("mem read from ").print(location()); | |
79 } | |
80 } |