comparison graal/GraalCompiler/src/com/sun/c1x/ir/LoadPointer.java @ 2509:16b9a8b5ad39

Renamings Runtime=>GraalRuntime and Compiler=>GraalCompiler
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Apr 2011 11:50:44 +0200
parents graal/Compiler/src/com/sun/c1x/ir/LoadPointer.java@9ec15d6914ca
children
comparison
equal deleted inserted replaced
2508:fea94949e0a2 2509:16b9a8b5ad39
1 /*
2 * Copyright (c) 2009, 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.sun.c1x.ir;
24
25 import com.sun.c1x.debug.*;
26 import com.sun.c1x.value.*;
27 import com.sun.cri.ci.*;
28
29 /**
30 * The {@code LoadPointer} instruction represents a read of a pointer.
31 * This instruction is part of the HIR support for low-level operations, such as safepoints,
32 * stack banging, etc, and does not correspond to a Java operation.
33 *
34 * @author Ben L. Titzer
35 * @author Doug Simon
36 */
37 public final class LoadPointer extends PointerOp {
38
39 /**
40 * Creates an instruction for a pointer load.
41 *
42 * @param kind the kind of value loaded from the pointer
43 * @param opcode the opcode of the instruction
44 * @param pointer the value producing the pointer
45 * @param displacement the value producing the displacement. This may be {@code null}.
46 * @param offsetOrIndex the value producing the scaled-index or the byte offset depending on whether {@code displacement} is {@code null}
47 * @param stateBefore the state before
48 * @param isVolatile {@code true} if the access is volatile
49 * @see PointerOp#PointerOp(CiKind, int, Value, Value, Value, FrameState, boolean)
50 */
51 public LoadPointer(CiKind kind, int opcode, Value pointer, Value displacement, Value offsetOrIndex, FrameState stateBefore, boolean isVolatile) {
52 super(kind, kind, opcode, pointer, displacement, offsetOrIndex, stateBefore, isVolatile);
53 }
54
55 @Override
56 public void accept(ValueVisitor v) {
57 v.visitLoadPointer(this);
58 }
59
60 @Override
61 public void print(LogStream out) {
62 out.print("*(").print(pointer());
63 if (displacement() == null) {
64 out.print(" + ").print(offset());
65 } else {
66 out.print(" + ").print(displacement()).print(" + (").print(index()).print(" * sizeOf(" + dataKind + "))");
67 }
68 out.print(")");
69 }
70 }