Mercurial > hg > graal-compiler
comparison graal/com.oracle.max.cri/src/com/sun/cri/ri/RiRegisterConfig.java @ 3733:e233f5660da4
Added Java files from Maxine project.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 17 Dec 2011 19:59:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3732:3e2e8b8abdaf | 3733:e233f5660da4 |
---|---|
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.sun.cri.ri; | |
24 | |
25 import java.util.*; | |
26 | |
27 import com.sun.cri.ci.*; | |
28 import com.sun.cri.ci.CiCallingConvention.Type; | |
29 import com.sun.cri.ci.CiRegister.RegisterFlag; | |
30 | |
31 /** | |
32 * A register configuration binds roles and {@linkplain RiRegisterAttributes attributes} | |
33 * to physical registers. | |
34 */ | |
35 public interface RiRegisterConfig { | |
36 | |
37 /** | |
38 * Gets the register to be used for returning a value of a given kind. | |
39 */ | |
40 CiRegister getReturnRegister(CiKind kind); | |
41 | |
42 /** | |
43 * Gets the register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound. | |
44 */ | |
45 CiRegister getFrameRegister(); | |
46 | |
47 CiRegister getScratchRegister(); | |
48 | |
49 /** | |
50 * Gets the calling convention describing how arguments are passed. | |
51 * | |
52 * @param type the type of calling convention being requested | |
53 * @param parameters the types of the arguments of the call | |
54 * @param target the target platform | |
55 * @param stackOnly ignore registers | |
56 */ | |
57 CiCallingConvention getCallingConvention(Type type, CiKind[] parameters, CiTarget target, boolean stackOnly); | |
58 | |
59 /** | |
60 * Gets the ordered set of registers that are can be used to pass parameters | |
61 * according to a given calling convention. | |
62 * | |
63 * @param type the type of calling convention | |
64 * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or | |
65 * {@linkplain} RegisterFlag#FPU floating point} parameters are being requested | |
66 * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type} | |
67 */ | |
68 CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag); | |
69 | |
70 /** | |
71 * Gets the set of registers that can be used by the register allocator. | |
72 */ | |
73 CiRegister[] getAllocatableRegisters(); | |
74 | |
75 /** | |
76 * Gets the set of registers that can be used by the register allocator, | |
77 * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register {@linkplain RegisterFlag flags}. | |
78 * | |
79 * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters() | |
80 * allocatable} registers for which the flag is {@linkplain #isSet(RegisterFlag) set} | |
81 * | |
82 */ | |
83 EnumMap<RegisterFlag, CiRegister[]> getCategorizedAllocatableRegisters(); | |
84 | |
85 /** | |
86 * Gets the registers whose values must be preserved by a method across any call it makes. | |
87 */ | |
88 CiRegister[] getCallerSaveRegisters(); | |
89 | |
90 /** | |
91 * Gets the layout of the callee save area of this register configuration. | |
92 * | |
93 * @return {@code null} if there is no callee save area | |
94 */ | |
95 CiCalleeSaveLayout getCalleeSaveLayout(); | |
96 | |
97 /** | |
98 * Gets a map from register {@linkplain CiRegister#number numbers} to register | |
99 * {@linkplain RiRegisterAttributes attributes} for this register configuration. | |
100 * | |
101 * @return an array where an element at index i holds the attributes of the register whose number is i | |
102 * @see CiRegister#categorize(CiRegister[]) | |
103 */ | |
104 RiRegisterAttributes[] getAttributesMap(); | |
105 | |
106 /** | |
107 * Gets the register corresponding to a runtime-defined role. | |
108 * | |
109 * @param id the identifier of a runtime-defined register role | |
110 * @return the register playing the role specified by {@code id} | |
111 */ | |
112 CiRegister getRegisterForRole(int id); | |
113 } |