comparison graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterConfig.java @ 21556:48c1ebd24120

renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 May 2015 00:36:16 +0200
parents graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java@badbe99cfaa4
children
comparison
equal deleted inserted replaced
21555:d12eaef9af72 21556:48c1ebd24120
1 /*
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.jvmci.code;
24
25 import com.oracle.jvmci.meta.Kind;
26 import com.oracle.jvmci.meta.JavaType;
27 import com.oracle.jvmci.meta.PlatformKind;
28 import com.oracle.jvmci.code.CallingConvention.Type;
29
30 /**
31 * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
32 * registers.
33 */
34 public interface RegisterConfig {
35
36 /**
37 * Gets the register to be used for returning a value of a given kind.
38 */
39 Register getReturnRegister(Kind kind);
40
41 /**
42 * Gets the maximum allowed size of the frame.
43 */
44 default int getMaximumFrameSize() {
45 return Integer.MAX_VALUE;
46 }
47
48 /**
49 * Gets the register to which {@link Register#Frame} and {@link Register#CallerFrame} are bound.
50 */
51 Register getFrameRegister();
52
53 /**
54 * Gets the calling convention describing how arguments are passed.
55 *
56 * @param type the type of calling convention being requested
57 * @param returnType the return type (can be null for methods returning {@code void})
58 * @param parameterTypes the types of the arguments of the call
59 * @param target the target platform
60 * @param stackOnly ignore registers
61 */
62 CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly);
63
64 /**
65 * Gets the ordered set of registers that are can be used to pass parameters according to a
66 * given calling convention.
67 *
68 * @param type the type of calling convention
69 * @param kind specifies what kind of registers is being requested
70 * @return the ordered set of registers that may be used to pass parameters in a call conforming
71 * to {@code type}
72 */
73 Register[] getCallingConventionRegisters(Type type, Kind kind);
74
75 /**
76 * Gets the set of all registers that might be used by the register allocator.
77 *
78 * To get the set of registers the register allocator is allowed to use see
79 * {@link RegisterAllocationConfig#getAllocatableRegisters()}
80 */
81 @SuppressWarnings("javadoc")
82 Register[] getAllocatableRegisters();
83
84 /**
85 * Filters a set of registers and returns only those that can be used by the register allocator
86 * for a value of a particular kind.
87 */
88 Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers);
89
90 /**
91 * Gets the registers whose values must be preserved by a method across any call it makes.
92 */
93 Register[] getCallerSaveRegisters();
94
95 /**
96 * Gets the layout of the callee save area of this register configuration.
97 *
98 * @return {@code null} if there is no callee save area
99 */
100 CalleeSaveLayout getCalleeSaveLayout();
101
102 /**
103 * Gets a map from register {@linkplain Register#number numbers} to register
104 * {@linkplain RegisterAttributes attributes} for this register configuration.
105 *
106 * @return an array where an element at index i holds the attributes of the register whose
107 * number is i
108 */
109 RegisterAttributes[] getAttributesMap();
110
111 /**
112 * Gets the register corresponding to a runtime-defined role.
113 *
114 * @param id the identifier of a runtime-defined register role
115 * @return the register playing the role specified by {@code id}
116 */
117 Register getRegisterForRole(int id);
118
119 /**
120 * Determines if all {@link #getAllocatableRegisters() allocatable} registers are
121 * {@link #getCallerSaveRegisters() caller saved}.
122 */
123 boolean areAllAllocatableRegistersCallerSaved();
124 }