annotate jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java @ 24225:a2dbb6fcc923

Added tag jvmci-0.33 for changeset 3aed4cb813f4
author Doug Simon <doug.simon@oracle.com>
date Fri, 18 Aug 2017 22:47:33 +0200
parents 9e1235406b59
children
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 /*
23396
9ed5b586018b Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents: 23395
diff changeset
2 * Copyright (c) 2009, 2016, 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 */
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
23 package jdk.vm.ci.code;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
25 import jdk.vm.ci.code.CallingConvention.Type;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
26 import jdk.vm.ci.meta.JavaKind;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
27 import jdk.vm.ci.meta.JavaType;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
28 import jdk.vm.ci.meta.PlatformKind;
23396
9ed5b586018b Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents: 23395
diff changeset
29 import jdk.vm.ci.meta.ValueKind;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
32 * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
33 * registers.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
35 public interface RegisterConfig {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 * Gets the register to be used for returning a value of a given kind.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 */
22536
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22431
diff changeset
40 Register getReturnRegister(JavaKind kind);
3733
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 /**
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: 14614
diff changeset
43 * Gets the maximum allowed size of the frame.
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14614
diff changeset
44 */
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14614
diff changeset
45 default 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: 14614
diff changeset
46 return Integer.MAX_VALUE;
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14614
diff changeset
47 }
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14614
diff changeset
48
a0dbb3628f2a Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14614
diff changeset
49 /**
23395
19432ed40848 clean up and minimize JVMCI (JDK-8156835) - part 3
Doug Simon <doug.simon@oracle.com>
parents: 23393
diff changeset
50 * Gets the register used as the frame pointer. Spill slots and outgoing stack-based arguments
19432ed40848 clean up and minimize JVMCI (JDK-8156835) - part 3
Doug Simon <doug.simon@oracle.com>
parents: 23393
diff changeset
51 * are addressed relative to this register.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
53 Register getFrameRegister();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54
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 * Gets the calling convention describing how arguments are passed.
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: 14614
diff changeset
57 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 * @param type the type of calling convention being requested
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6470
diff changeset
59 * @param returnType the return type (can be null for methods returning {@code void})
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6470
diff changeset
60 * @param parameterTypes the types of the arguments of the call
23396
9ed5b586018b Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents: 23395
diff changeset
61 * @param valueKindFactory the factory to create custom {@link ValueKind ValueKinds}
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 */
23396
9ed5b586018b Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents: 23395
diff changeset
63 CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory<?> valueKindFactory);
3733
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 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
66 * Gets the ordered set of registers that are can be used to pass parameters according to a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
67 * given calling convention.
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: 14614
diff changeset
68 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 * @param type the type of calling convention
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 8335
diff changeset
70 * @param kind specifies what kind of registers is being requested
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
71 * @return the ordered set of registers that may be used to pass parameters in a call conforming
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
72 * to {@code type}
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
74 RegisterArray getCallingConventionRegisters(Type type, JavaKind kind);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 /**
20920
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
77 * Gets the set of all registers that might be used by the register allocator.
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
78 *
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
79 * To get the set of registers the register allocator is allowed to use see
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
80 * {@link RegisterAllocationConfig#getAllocatableRegisters()}
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 */
20920
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
82 @SuppressWarnings("javadoc")
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
83 RegisterArray getAllocatableRegisters();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 /**
20920
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
86 * Filters a set of registers and returns only those that can be used by the register allocator
badbe99cfaa4 RegisterConfig: improve javadoc for getAllocatableRegisters and filterAllocatableRegisters.
Josef Eisl <josef.eisl@jku.at>
parents: 20916
diff changeset
87 * for a value of a particular kind.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
89 RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 * Gets the registers whose values must be preserved by a method across any call it makes.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
94 RegisterArray getCallerSaveRegisters();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 /**
22431
0a0c0111ecda Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
97 * Gets the registers whose values must be preserved by the callee.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
99 RegisterArray getCalleeSaveRegisters();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 /**
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
102 * Gets a map from register {@linkplain Register#number numbers} to register
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
103 * {@linkplain RegisterAttributes attributes} for this register configuration.
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: 14614
diff changeset
104 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
105 * @return an array where an element at index i holds the attributes of the register whose
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
106 * number is i
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
108 RegisterAttributes[] getAttributesMap();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 /**
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
111 * Determines if all {@link #getAllocatableRegisters() allocatable} registers are
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
112 * {@link #getCallerSaveRegisters() caller saved}.
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
113 */
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
114 boolean areAllAllocatableRegistersCallerSaved();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115 }