1 /* src/vm/jit/alpha/md-abi.c - functions for Alpha 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: Christian Thalinger
29 Changes: Christian Ullrich
31 $Id: md-abi.c 4960 2006-05-26 12:19:43Z edwin $
39 #include "vm/jit/alpha/md-abi.h"
41 #include "vm/descriptor.h"
42 #include "vm/global.h"
45 /* register descripton array **************************************************/
48 REG_RET, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
49 REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
50 REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
51 REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
55 s4 nregdescfloat[] = {
56 REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
57 REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
58 REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
59 REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
64 /* md_param_alloc **************************************************************
66 Allocate the parameters of the given method descriptor according to the
67 calling convention of the platform.
69 *******************************************************************************/
71 void md_param_alloc(methoddesc *md)
78 /* set default values */
83 /* get params field of methoddesc */
87 for (i = 0; i < md->paramcount; i++, pd++) {
88 switch (md->paramtypes[i].type) {
92 if (i < INT_ARG_CNT) {
96 md->argintreguse = reguse;
100 pd->regoff = stacksize;
106 if (i < FLT_ARG_CNT) {
107 pd->inmemory = false;
110 md->argfltreguse = reguse;
113 pd->regoff = stacksize;
120 /* fill register and stack usage */
122 md->memuse = stacksize;
126 /* md_return_alloc *************************************************************
128 Precolor the Java Stackelement containing the Return Value. Since
129 alpha has a dedicated return register (not an reused arg or
130 reserved reg), this is striaghtforward possible, as long, as this
131 stackelement does not have to survive a method invokation
135 m: Methodinfo of current method
136 return_type: Return Type of the Method (TYPE_INT.. TYPE_ADR)
137 TYPE_VOID is not allowed!
138 stackslot: Java Stackslot to contain the Return Value
141 if precoloring was possible:
142 stackslot->varkind =ARGVAR
145 ->regoff =[REG_RESULT, REG_FRESULT]
147 *******************************************************************************/
149 void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
152 /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has not */
153 /* to survive method invokations */
155 if (!(stackslot->flags & SAVEDVAR)) {
156 stackslot->varkind = ARGVAR;
157 stackslot->varnum = -1;
158 stackslot->flags = 0;
160 if (IS_INT_LNG_TYPE(return_type)) {
161 stackslot->regoff = REG_RESULT;
162 } else { /* float/double */
163 stackslot->regoff = REG_FRESULT;
170 * These are local overrides for various environment variables in Emacs.
171 * Please do not remove this and leave it at the end of the file, where
172 * Emacs will automagically detect them.
173 * ---------------------------------------------------------------------
176 * indent-tabs-mode: t