1 /* src/vm/jit/alpha/md-abi.c - functions for Alpha ABI
3 Copyright (C) 1996-2005, 2006, 2007 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 $Id: md-abi.c 7637 2007-04-02 20:58:30Z twisti $
33 #include "vm/jit/alpha/md-abi.h"
35 #include "vm/global.h"
37 #include "vm/jit/abi.h"
39 #include "vmcore/descriptor.h"
42 /* register descripton array **************************************************/
45 /* v0, t0, t1, t2, t3, t4, t5, t6, */
46 REG_RET, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
48 /* t7, s0, s1, s2, s3, s4, s5, s6, */
49 REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
51 /* a0, a1, a2, a3, a4, a5, t8, t9, */
52 REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
54 /* t10, itmp1, ra, pv, at, itmp3, sp, zero, */
55 REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
60 const char *abi_registers_integer_name[] = {
61 "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
62 "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
63 "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
64 "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"
67 const s4 abi_registers_integer_argument[] = {
76 const s4 abi_registers_integer_saved[] = {
86 const s4 abi_registers_integer_temporary[] = {
101 s4 nregdescfloat[] = {
102 REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
103 REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
104 REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
105 REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
110 /* md_param_alloc **************************************************************
112 Allocate the parameters of the given method descriptor according to the
113 calling convention of the platform.
115 *******************************************************************************/
117 void md_param_alloc(methoddesc *md)
124 /* set default values */
129 /* get params field of methoddesc */
133 for (i = 0; i < md->paramcount; i++, pd++) {
134 switch (md->paramtypes[i].type) {
138 if (i < INT_ARG_CNT) {
139 pd->inmemory = false;
142 md->argintreguse = reguse;
146 pd->regoff = stacksize;
153 if (i < FLT_ARG_CNT) {
154 pd->inmemory = false;
157 md->argfltreguse = reguse;
161 pd->regoff = stacksize;
168 /* fill register and stack usage */
170 md->memuse = stacksize;
174 /* md_param_alloc_native *******************************************************
176 Pre-allocate arguments according to the native ABI.
178 *******************************************************************************/
180 void md_param_alloc_native(methoddesc *md)
182 /* On Alpha we use the same ABI for JIT method calls as for native
189 /* md_return_alloc *************************************************************
191 Precolor the Java Stackelement containing the Return Value. Since
192 alpha has a dedicated return register (not an reused arg or
193 reserved reg), this is striaghtforward possible, as long, as this
194 stackelement does not have to survive a method invokation
198 jd: jitdata of the current method
199 stackslot: Java Stackslot to contain the Return Value
202 if precoloring was possible:
203 VAR(stackslot->varnum)->flags = PREALLOC
204 ->vv.regoff = [REG_RESULT|REG_FRESULT]
205 rd->arg[flt|int]reguse set to a value according the register usage
207 NOTE: Do not pass a LOCALVAR in stackslot->varnum.
208 *******************************************************************************/
210 void md_return_alloc(jitdata *jd, stackptr stackslot)
215 /* get required compiler data */
221 /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has
222 not to survive method invokations. */
224 if (!(stackslot->flags & SAVEDVAR)) {
226 VAR(stackslot->varnum)->flags = PREALLOC;
228 if (IS_INT_LNG_TYPE(md->returntype.type))
229 VAR(stackslot->varnum)->vv.regoff = REG_RESULT;
231 VAR(stackslot->varnum)->vv.regoff = REG_FRESULT;
237 * These are local overrides for various environment variables in Emacs.
238 * Please do not remove this and leave it at the end of the file, where
239 * Emacs will automagically detect them.
240 * ---------------------------------------------------------------------
243 * indent-tabs-mode: t