Mercurial > hg > truffle
annotate graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java @ 9422:149fe42411df
Use platform specific kind in backend.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 30 Apr 2013 12:00:13 +0200 |
parents | 1342574c4f7d |
children | 3c9aeef2702c |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4182
de7b3e7ae528
Simplify CiValue
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
23 package com.oracle.graal.api.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import java.io.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
28 * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
29 * kind} and are immutable. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
31 public abstract class Value implements Serializable { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6477
diff
changeset
|
32 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
33 private static final long serialVersionUID = -6909397188697766469L; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
9294
899295127bc4
Get rid of the distinction between UNUSED and ILLEGAL value.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
35 @SuppressWarnings("serial") public static final AllocatableValue ILLEGAL = new AllocatableValue(Kind.Illegal) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6477
diff
changeset
|
36 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 @Override |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
38 public String toString() { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
39 return "-"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
43 private final Kind kind; |
9422
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
44 private final PlatformKind platformKind; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 * Initializes a new value of the specified kind. |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6477
diff
changeset
|
48 * |
9422
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
49 * @param platformKind the kind |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 */ |
9422
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
51 protected Value(PlatformKind platformKind) { |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
52 this.platformKind = platformKind; |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
53 if (platformKind instanceof Kind) { |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
54 this.kind = (Kind) platformKind; |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
55 } else { |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
56 this.kind = Kind.Illegal; |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
57 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
61 * Returns a String representation of the kind, which should be the end of all |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
62 * {@link #toString()} implementation of subclasses. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 */ |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6477
diff
changeset
|
64 protected final String getKindSuffix() { |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6477
diff
changeset
|
65 return "|" + getKind().getTypeChar(); |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
66 } |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
67 |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
68 /** |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6477
diff
changeset
|
69 * Returns the kind of this value. |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
70 */ |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
71 public final Kind getKind() { |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5851
diff
changeset
|
72 return kind; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 } |
9422
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
74 |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
75 /** |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
76 * Returns the platform specific kind used to store this value. |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
77 */ |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
78 public final PlatformKind getPlatformKind() { |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
79 return platformKind; |
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9296
diff
changeset
|
80 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 } |