1 /* src/vm/jit/sparc64/md-abi.c - functions for Sparc ABI
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Alexander Jordan
31 $Id: md-abi.h 4357 2006-01-22 23:33:38Z twisti $
39 #include "vm/jit/sparc64/md-abi.h"
41 #include "vm/descriptor.h"
42 #include "vm/global.h"
43 #include "vm/jit/abi.h"
46 /* register descripton array **************************************************/
48 /* callee point-of-view, after SAVE has been called */
50 /* zero itmp1/g1 itmp2/g2 itmp3/g3 temp/g4 temp/g5 sys/g6 sys/g7 */
51 REG_RES, REG_RES, REG_RES, REG_RES, REG_TMP, REG_TMP, REG_RES, REG_RES,
53 /* o0 o1 o2 o3 o4 o5 sp/o6 o7 */
54 REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_TMP,
56 /* l0 l1 l2 l3 l4 l5 l6 l7 */
57 REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
59 /* i0 i1 i2 i3 i4 pv/i5 fp/i6 ra/i7 */
60 REG_RET, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES,
63 /* XXX i1 - i4: SAV OR ARG ??? */
66 s4 nregdescfloat[] = {
67 REG_RET, REG_RES, REG_RES, REG_RES, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
68 REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
73 /* md_param_alloc **************************************************************
77 *******************************************************************************/
79 void md_param_alloc(methoddesc *md)
86 /* set default values */
91 /* get params field of methoddesc */
95 for (i = 0; i < md->paramcount; i++, pd++) {
96 switch (md->paramtypes[i].type) {
100 if (i < INT_ARG_CNT) {
101 pd->inmemory = false;
104 md->argintreguse = reguse;
108 pd->regoff = stacksize;
114 if (i < FLT_ARG_CNT) {
115 pd->inmemory = false;
118 md->argfltreguse = reguse;
121 pd->regoff = stacksize;
128 /* fill register and stack usage */
130 md->memuse = stacksize;
134 /* md_return_alloc *************************************************************
136 Precolor the Java Stackelement containing the Return Value. Since
137 alpha has a dedicated return register (not an reused arg or
138 reserved reg), this is striaghtforward possible, as long, as this
139 stackelement does not have to survive a method invokation
143 m: Methodinfo of current method
144 return_type: Return Type of the Method (TYPE_INT.. TYPE_ADR)
145 TYPE_VOID is not allowed!
146 stackslot: Java Stackslot to contain the Return Value
149 if precoloring was possible:
150 stackslot->varkind =ARGVAR
153 ->regoff =[REG_RESULT, REG_FRESULT]
155 *******************************************************************************/
157 void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
160 /* Only precolor the stackslot, if it is not used for parameter precoloring AND */
161 /* it is not a SAVEDVAR <-> has not to survive method invokations */
163 if (!m->isleafmethod || (m->parseddesc->paramcount == 0)) {
165 if (!(stackslot->flags & SAVEDVAR)) {
166 stackslot->varkind = ARGVAR;
167 stackslot->varnum = -1;
168 stackslot->flags = 0;
170 if (IS_INT_LNG_TYPE(return_type)) {
171 stackslot->regoff = REG_RESULT_CALLEE;
172 } else { /* float/double */
173 stackslot->regoff = REG_FRESULT;
181 * These are local overrides for various environment variables in Emacs.
182 * Please do not remove this and leave it at the end of the file, where
183 * Emacs will automagically detect them.
184 * ---------------------------------------------------------------------
187 * indent-tabs-mode: t