Mercurial > hg > truffle
annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java @ 9296:1342574c4f7d
Move targets can only be AllocatableValues.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 25 Apr 2013 16:14:42 +0200 |
parents | 5e3d1a68664e |
children | c455c86138ba |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3733
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 */ |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
23 package com.oracle.graal.api.code; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3733
diff
changeset
|
26 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
30 * A calling convention describes the locations in which the arguments for a call are placed, the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
31 * location in which the return value is placed if the call is not void and any |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
32 * {@linkplain #getTemporaries() extra} locations used (and killed) by the call. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
34 public class CallingConvention { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 /** |
5712
dfcb73ac6ba2
made invalid javadoc cause a JDT error
Doug Simon <doug.simon@oracle.com>
parents:
5711
diff
changeset
|
37 * Constants denoting the type of a call for which a calling convention is requested. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 public enum Type { |
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 * A request for the outgoing argument locations at a call site to Java code. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 JavaCall(true), |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
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 * A request for the incoming argument locations. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 JavaCallee(false), |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
51 * A request for the outgoing argument locations at a call site to the runtime (which may be |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
52 * Java or native code). |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 RuntimeCall(true), |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
57 * A request for the outgoing argument locations at a call site to external native code that |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
58 * complies with the platform ABI. |
3733
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 NativeCall(true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 * Determines if this is a request for the outgoing argument locations at a call site. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 public final boolean out; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 public static final Type[] VALUES = values(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 private Type(boolean out) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 this.out = out; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 * The amount of stack space (in bytes) required for the stack-based arguments of the call. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 */ |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
77 private final int stackSize; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
78 |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
79 private final AllocatableValue returnLocation; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 /** |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
82 * The ordered locations in which the arguments are placed. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
84 private final AllocatableValue[] argumentLocations; |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
85 |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
86 /** |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
87 * The locations used (and killed) by the call in addition to the arguments. |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
88 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
89 private final AllocatableValue[] temporaryLocations; |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
90 |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
91 /** |
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
92 * Creates a description of the registers and stack locations used by a call. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
93 * |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
94 * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
95 * the call |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
96 * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
97 * call |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
98 * @param argumentLocations the ordered locations in which the arguments are placed |
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
99 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
100 public CallingConvention(int stackSize, AllocatableValue returnLocation, AllocatableValue... argumentLocations) { |
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
101 this(AllocatableValue.NONE, stackSize, returnLocation, argumentLocations); |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
102 } |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
103 |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
104 /** |
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
105 * Creates a description of the registers and stack locations used by a call. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
106 * |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
107 * @param temporaryLocations the locations used (and killed) by the call in addition to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
108 * {@code arguments} |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
109 * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
110 * the call |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
111 * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
112 * call |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
113 * @param argumentLocations the ordered locations in which the arguments are placed |
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
114 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
115 public CallingConvention(AllocatableValue[] temporaryLocations, int stackSize, AllocatableValue returnLocation, AllocatableValue... argumentLocations) { |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
116 assert argumentLocations != null; |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
117 assert temporaryLocations != null; |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
118 assert returnLocation != null; |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
119 this.argumentLocations = argumentLocations; |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
120 this.stackSize = stackSize; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
121 this.returnLocation = returnLocation; |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
122 this.temporaryLocations = temporaryLocations; |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
123 assert verify(); |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
124 } |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
125 |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
126 /** |
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:
6507
diff
changeset
|
127 * Gets the location for the return value or {@link Value#ILLEGAL} if a void call. |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
128 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
129 public AllocatableValue getReturn() { |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
130 return returnLocation; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
131 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
133 /** |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
134 * Gets the location for the {@code index}'th argument. |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
135 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
136 public AllocatableValue getArgument(int index) { |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
137 return argumentLocations[index]; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
138 } |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
139 |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
140 /** |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
141 * Gets the amount of stack space (in bytes) required for the stack-based arguments of the call. |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
142 */ |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
143 public int getStackSize() { |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
144 return stackSize; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
145 } |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
146 |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
147 /** |
6507
53006ba078d4
refined the API for CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6477
diff
changeset
|
148 * Gets the number of locations required for the arguments. |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
149 */ |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
150 public int getArgumentCount() { |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
151 return argumentLocations.length; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
154 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
155 * Gets the locations used (and killed) by the call apart from the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
156 * {@linkplain #getArgument(int) arguments}. |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
157 */ |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
158 public AllocatableValue[] getTemporaries() { |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
159 if (temporaryLocations.length == 0) { |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
160 return temporaryLocations; |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
161 } |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
162 return temporaryLocations.clone(); |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
163 } |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
164 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 public String toString() { |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
167 StringBuilder sb = new StringBuilder(); |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
168 sb.append("CallingConvention["); |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
169 String sep = ""; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
170 for (Value op : argumentLocations) { |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
171 sb.append(sep).append(op); |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
172 sep = ", "; |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
173 } |
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:
6507
diff
changeset
|
174 if (returnLocation != Value.ILLEGAL) { |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
175 sb.append(" -> ").append(returnLocation); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 } |
6477
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
177 if (temporaryLocations.length != 0) { |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
178 sb.append("; temps="); |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
179 sep = ""; |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
180 for (Value op : temporaryLocations) { |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
181 sb.append(sep).append(op); |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
182 sep = ", "; |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
183 } |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
184 } |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
185 sb.append("]"); |
d93bff9fecb6
added temps used by a call to CallingConvention
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
186 return sb.toString(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 private boolean verify() { |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
190 for (int i = 0; i < argumentLocations.length; i++) { |
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
5712
diff
changeset
|
191 Value location = argumentLocations[i]; |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3733
diff
changeset
|
192 assert isStackSlot(location) || isRegister(location); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 } |