Mercurial > hg > truffle
comparison graal/com.oracle.max.graal.compiler/src/com/sun/c1x/ir/Local.java @ 2872:0341b6424579
Project renaming.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 08 Jun 2011 08:42:25 +0200 |
parents | graal/GraalCompiler/src/com/sun/c1x/ir/Local.java@14708c03abba |
children |
comparison
equal
deleted
inserted
replaced
2871:d704eb526603 | 2872:0341b6424579 |
---|---|
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.oracle.graal.graph.*; | |
26 import com.sun.c1x.debug.*; | |
27 import com.sun.cri.ci.*; | |
28 import com.sun.cri.ri.*; | |
29 | |
30 /** | |
31 * The {@code Local} instruction is a placeholder for an incoming argument | |
32 * to a function call. | |
33 */ | |
34 public final class Local extends FloatingNode { | |
35 | |
36 private static final int INPUT_COUNT = 1; | |
37 | |
38 private static final int SUCCESSOR_COUNT = 0; | |
39 | |
40 private final int index; | |
41 private RiType declaredType; | |
42 | |
43 public Local(CiKind kind, int javaIndex, Graph graph) { | |
44 super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); | |
45 this.index = javaIndex; | |
46 } | |
47 | |
48 /** | |
49 * Gets the index of this local. | |
50 * @return the index | |
51 */ | |
52 public int index() { | |
53 return index; | |
54 } | |
55 | |
56 /** | |
57 * Sets the declared type of this local, e.g. derived from the signature of the method. | |
58 * @param declaredType the declared type of the local variable | |
59 */ | |
60 public void setDeclaredType(RiType declaredType) { | |
61 this.declaredType = declaredType; | |
62 } | |
63 | |
64 /** | |
65 * Computes the declared type of the result of this instruction, if possible. | |
66 * @return the declared type of the result of this instruction, if it is known; {@code null} otherwise | |
67 */ | |
68 @Override | |
69 public RiType declaredType() { | |
70 return declaredType; | |
71 } | |
72 | |
73 @Override | |
74 public void accept(ValueVisitor v) { | |
75 v.visitLocal(this); | |
76 } | |
77 | |
78 @Override | |
79 public void print(LogStream out) { | |
80 out.print("local[index ").print(index()).print(']'); | |
81 } | |
82 | |
83 @Override | |
84 protected int inputCount() { | |
85 return super.inputCount() + INPUT_COUNT; | |
86 } | |
87 | |
88 @Override | |
89 protected int successorCount() { | |
90 return super.successorCount() + SUCCESSOR_COUNT; | |
91 } | |
92 | |
93 @Override | |
94 public Node copy(Graph into) { | |
95 Local x = new Local(kind, index, into); | |
96 x.setDeclaredType(declaredType()); | |
97 return x; | |
98 } | |
99 } |