1 /* src/vm/jit/alpha/md-abi.c - functions for Alpha ABI
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 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., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Thalinger
29 Changes: Christian Ullrich
31 $Id: md-abi.c 4069 2006-01-02 16:03:57Z twisti $
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 **************************************************************
68 *******************************************************************************/
70 void md_param_alloc(methoddesc *md)
77 /* set default values */
82 /* get params field of methoddesc */
86 for (i = 0; i < md->paramcount; i++, pd++) {
87 switch (md->paramtypes[i].type) {
91 if (i < INT_ARG_CNT) {
95 md->argintreguse = reguse;
99 pd->regoff = stacksize;
105 if (i < FLT_ARG_CNT) {
106 pd->inmemory = false;
109 md->argfltreguse = reguse;
112 pd->regoff = stacksize;
119 /* fill register and stack usage */
121 md->memuse = stacksize;
125 /* md_return_alloc *************************************************************
127 Precolor the Java Stackelement containing the Return Value. Since
128 alpha has a dedicated return register (not an reused arg or
129 reserved reg), this is striaghtforward possible, as long, as this
130 stackelement does not have to survive a method invokation
134 m: Methodinfo of current method
135 return_type: Return Type of the Method (TYPE_INT.. TYPE_ADR)
136 TYPE_VOID is not allowed!
137 stackslot: Java Stackslot to contain the Return Value
140 if precoloring was possible:
141 stackslot->varkind =ARGVAR
144 ->regoff =[REG_RESULT, REG_FRESULT]
146 *******************************************************************************/
148 void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
151 /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has not */
152 /* to survive method invokations */
154 if (!(stackslot->flags & SAVEDVAR)) {
155 stackslot->varkind = ARGVAR;
156 stackslot->varnum = -1;
157 stackslot->flags = 0;
159 if (IS_INT_LNG_TYPE(return_type)) {
160 stackslot->regoff = REG_RESULT;
161 } else { /* float/double */
162 stackslot->regoff = REG_FRESULT;
169 * These are local overrides for various environment variables in Emacs.
170 * Please do not remove this and leave it at the end of the file, where
171 * Emacs will automagically detect them.
172 * ---------------------------------------------------------------------
175 * indent-tabs-mode: t