annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java @ 18355:9a11c4086341

size array appropriately when creating categorized register array
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Nov 2014 15:13:51 +0100
parents 9e5a323e0a1e
children d806707624bb 12bad81babff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
16104
4dd2cedc7f57 Revert using LIRKind.reference(Kind.Int) instead of hotspot specific NarrowOop kind (part of c0b8d395368b).
Roland Schatz <roland.schatz@oracle.com>
parents: 16094
diff changeset
2 * Copyright (c) 2011, 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 */
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6494
diff changeset
23 package com.oracle.graal.hotspot.amd64;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
25 import static com.oracle.graal.amd64.AMD64.*;
15259
d90e5c22ba55 Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
26 import static com.oracle.graal.compiler.common.GraalOptions.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
30 import com.oracle.graal.amd64.*;
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
31 import com.oracle.graal.api.code.*;
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
32 import com.oracle.graal.api.code.CallingConvention.Type;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
33 import com.oracle.graal.api.meta.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15011
diff changeset
34 import com.oracle.graal.compiler.common.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.hotspot.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
37 public class AMD64HotSpotRegisterConfig implements RegisterConfig {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
39 private final Architecture architecture;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
40
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
41 private final Register[] allocatable;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42
14989
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
43 private final int maxFrameSize;
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
44
13343
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
45 /**
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
46 * The same as {@link #allocatable}, except if parameter registers are removed with the
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14614
diff changeset
47 * {@link GraalOptions#RegisterPressure} option. The caller saved registers always include all
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14614
diff changeset
48 * parameter registers.
13343
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
49 */
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
50 private final Register[] callerSaved;
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
51
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
52 private final boolean allAllocatableAreCallerSaved;
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
53
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
54 private final HashMap<PlatformKind, Register[]> categorized = new HashMap<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
56 private final RegisterAttributes[] attributesMap;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57
14989
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
58 public int getMaximumFrameSize() {
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
59 return maxFrameSize;
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
60 }
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
61
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
63 public Register[] getAllocatableRegisters() {
9414
a58860b72b1f made AMD64HotSpotRegisterConfig return copies of internal arrays to prevent clients from modifying them
Doug Simon <doug.simon@oracle.com>
parents: 9296
diff changeset
64 return allocatable.clone();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
67 public Register[] getAllocatableRegisters(PlatformKind kind) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
68 if (categorized.containsKey(kind)) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
69 return categorized.get(kind);
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
70 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
71
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
72 ArrayList<Register> list = new ArrayList<>();
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
73 for (Register reg : getAllocatableRegisters()) {
16116
9e5a323e0a1e Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
Roland Schatz <roland.schatz@oracle.com>
parents: 16104
diff changeset
74 if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
75 list.add(reg);
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
76 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
77 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
78
18355
9a11c4086341 size array appropriately when creating categorized register array
Doug Simon <doug.simon@oracle.com>
parents: 16116
diff changeset
79 Register[] ret = list.toArray(new Register[list.size()]);
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
80 categorized.put(kind, ret);
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
81 return ret;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
85 public RegisterAttributes[] getAttributesMap() {
9414
a58860b72b1f made AMD64HotSpotRegisterConfig return copies of internal arrays to prevent clients from modifying them
Doug Simon <doug.simon@oracle.com>
parents: 9296
diff changeset
86 return attributesMap.clone();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
89 private final Register[] javaGeneralParameterRegisters;
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
90 private final Register[] nativeGeneralParameterRegisters;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
91 private final Register[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7};
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
93 private final CalleeSaveLayout csl;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
95 private static Register findRegister(String name, Register[] all) {
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
96 for (Register reg : all) {
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
97 if (reg.name.equals(name)) {
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
98 return reg;
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
99 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
100 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
101 throw new IllegalArgumentException("register " + name + " is not allocatable");
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
102 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
103
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
104 private static Register[] initAllocatable(boolean reserveForHeapBase) {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
105 Register[] registers = null;
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
106 // @formatter:off
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
107 if (reserveForHeapBase) {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
108 registers = new Register[] {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
109 rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, /*r12,*/ r13, r14, /*r15, */
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
110 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
111 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
112 };
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
113 } else {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
114 registers = new Register[] {
8338
16e34a47039b Make r10 allocatable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8335
diff changeset
115 rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, /*r15, */
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
116 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
117 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
118 };
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
119 }
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
120 // @formatter:on
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
121
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9717
diff changeset
122 if (RegisterPressure.getValue() != null) {
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9717
diff changeset
123 String[] names = RegisterPressure.getValue().split(",");
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
124 Register[] regs = new Register[names.length];
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
125 for (int i = 0; i < names.length; i++) {
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
126 regs[i] = findRegister(names[i], registers);
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
127 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
128 return regs;
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
129 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
130
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
131 return registers;
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
132 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
133
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
134 public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) {
15011
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
135 this(architecture, config, initAllocatable(config.useCompressedOops));
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
136 assert callerSaved.length == allocatable.length || RegisterPressure.getValue() != null;
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
137 }
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
138
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
139 public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config, Register[] allocatable) {
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
140 this.architecture = architecture;
14989
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
141 this.maxFrameSize = config.maxFrameSize;
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
142
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 if (config.windowsOs) {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
144 javaGeneralParameterRegisters = new Register[]{rdx, r8, r9, rdi, rsi, rcx};
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
145 nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9};
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 } else {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
147 javaGeneralParameterRegisters = new Register[]{rsi, rdx, rcx, r8, r9, rdi};
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
148 nativeGeneralParameterRegisters = new Register[]{rdi, rsi, rdx, rcx, r8, r9};
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
151 csl = null;
15011
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
152 this.allocatable = allocatable.clone();
13343
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
153 Set<Register> callerSaveSet = new HashSet<>();
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
154 Collections.addAll(callerSaveSet, allocatable);
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
155 Collections.addAll(callerSaveSet, xmmParameterRegisters);
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
156 Collections.addAll(callerSaveSet, javaGeneralParameterRegisters);
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
157 Collections.addAll(callerSaveSet, nativeGeneralParameterRegisters);
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
158 callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
159
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
160 allAllocatableAreCallerSaved = true;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
161 attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
165 public Register[] getCallerSaveRegisters() {
13343
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
166 return callerSaved;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
168
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 @Override
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
170 public boolean areAllAllocatableRegistersCallerSaved() {
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
171 return allAllocatableAreCallerSaved;
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
172 }
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
173
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
174 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
175 public Register getRegisterForRole(int index) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 throw new UnsupportedOperationException();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 @Override
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
180 public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 if (type == Type.NativeCall) {
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
182 return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 }
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
184 // On x64, parameter locations are the same whether viewed
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
185 // from the caller or callee perspective
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
186 return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
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
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
189 public Register[] getCallingConventionRegisters(Type type, Kind kind) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
190 if (architecture.canStoreValue(XMM, kind)) {
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
191 return xmmParameterRegisters;
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
192 }
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
193 assert architecture.canStoreValue(CPU, kind);
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
194 return type == Type.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters;
3733
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
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
197 private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 8338
diff changeset
198 AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
199
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200 int currentGeneral = 0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
201 int currentXMM = 0;
4181
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4174
diff changeset
202 int currentStackOffset = 0;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
204 for (int i = 0; i < parameterTypes.length; i++) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
205 final Kind kind = parameterTypes[i].getKind();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 switch (kind) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 case Byte:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 case Boolean:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 case Short:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211 case Char:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
212 case Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
213 case Long:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
214 case Object:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215 if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
216 Register register = generalParameterRegisters[currentGeneral++];
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
217 locations[i] = register.asValue(target.getLIRKind(kind));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
218 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
219 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
220 case Float:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221 case Double:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
222 if (!stackOnly && currentXMM < xmmParameterRegisters.length) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
223 Register register = xmmParameterRegisters[currentXMM++];
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
224 locations[i] = register.asValue(target.getLIRKind(kind));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
227 default:
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4220
diff changeset
228 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
230
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231 if (locations[i] == null) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
232 locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
233 currentStackOffset += Math.max(target.getSizeInBytes(kind), target.wordSize);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
234 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
237 Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
238 AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(target.getLIRKind(returnKind.getStackKind()));
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: 6413
diff changeset
239 return new CallingConvention(currentStackOffset, returnLocation, locations);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
242 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
243 public Register getReturnRegister(Kind kind) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
244 switch (kind) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245 case Boolean:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 case Byte:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 case Char:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248 case Short:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 case Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 case Long:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
251 case Object:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 return rax;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 case Float:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254 case Double:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 return xmm0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 case Void:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257 case Illegal:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
258 return null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
260 throw new UnsupportedOperationException("no return register for type " + kind);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
261 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
262 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
263
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
264 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
265 public Register getFrameRegister() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
266 return rsp;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
267 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
269 public CalleeSaveLayout getCalleeSaveLayout() {
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
270 return csl;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 public String toString() {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
275 return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
276 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277 }