comparison graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadIndexed.java @ 2874:d90bf514d647

Renamed packages.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 08 Jun 2011 08:59:54 +0200
parents graal/com.oracle.max.graal.compiler/src/com/sun/c1x/ir/LoadIndexed.java@0341b6424579
children 8044bdfaab06
comparison
equal deleted inserted replaced
2873:810e2d253e00 2874:d90bf514d647
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.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 import com.sun.cri.ri.*;
29
30 /**
31 * The {@code LoadIndexed} instruction represents a read from an element of an array.
32 */
33 public final class LoadIndexed extends AccessIndexed {
34
35 private static final int INPUT_COUNT = 0;
36 private static final int SUCCESSOR_COUNT = 0;
37
38 /**
39 * Creates a new LoadIndexed instruction.
40 * @param array the instruction producing the array
41 * @param index the instruction producing the index
42 * @param length the instruction producing the length
43 * @param elementKind the element type
44 * @param graph
45 */
46 public LoadIndexed(Value array, Value index, Value length, CiKind elementKind, Graph graph) {
47 super(elementKind.stackKind(), array, index, length, elementKind, INPUT_COUNT, SUCCESSOR_COUNT, graph);
48 }
49
50 /**
51 * Gets the declared type of this instruction's result.
52 * @return the declared type
53 */
54 @Override
55 public RiType declaredType() {
56 RiType arrayType = array().declaredType();
57 if (arrayType == null) {
58 return null;
59 }
60 return arrayType.componentType();
61 }
62
63 /**
64 * Gets the exact type of this instruction's result.
65 * @return the exact type
66 */
67 @Override
68 public RiType exactType() {
69 RiType declared = declaredType();
70 return declared != null && declared.isResolved() ? declared.exactType() : null;
71 }
72
73 @Override
74 public void accept(ValueVisitor v) {
75 v.visitLoadIndexed(this);
76 }
77
78 @Override
79 public void print(LogStream out) {
80 out.print(array()).print('[').print(index()).print("] (").print(kind.typeChar).print(')');
81 }
82
83 @Override
84 public boolean needsStateAfter() {
85 return false;
86 }
87
88 @Override
89 public Node copy(Graph into) {
90 LoadIndexed x = new LoadIndexed(null, null, null, elementKind(), into);
91 return x;
92 }
93 }