1 /* src/vm/jit/x86_64/md-abi.c - functions for x86_64 Linux 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
31 $Id: md-abi.c 2872 2005-06-29 12:42:19Z christian $
36 #include "vm/jit/x86_64/types.h"
37 #include "vm/jit/x86_64/md-abi.h"
39 #include "vm/descriptor.h"
40 #include "vm/global.h"
43 /* md_param_alloc **************************************************************
47 *******************************************************************************/
49 void md_param_alloc(methoddesc *md)
57 /* set default values */
63 /* get params field of methoddesc */
67 for (i = 0; i < md->paramcount; i++, pd++) {
68 switch (md->paramtypes[i].type) {
72 if (iarg < INT_ARG_CNT) {
78 pd->regoff = stacksize;
80 if (iarg < INT_ARG_CNT)
87 if (farg < FLT_ARG_CNT) {
92 pd->regoff = stacksize;
94 if (farg < FLT_ARG_CNT)
102 /* fill register and stack usage */
104 md->argintreguse = iarg;
105 md->argfltreguse = farg;
106 md->memuse = stacksize;
109 /* md_return_alloc *************************************************************
111 Precolor the Java Stackelement containing the Return Value. Only for float/
112 double types straight forward possible, since INT_LNG types use "reserved"
114 Float/Double values use a00 as return register.
117 m: Methodinfo of current method
118 return_type: Return Type of the Method (TYPE_INT.. TYPE_ADR)
119 TYPE_VOID is not allowed!
120 stackslot: Java Stackslot to contain the Return Value
123 if precoloring was possible:
124 stackslot->varkind =ARGVAR
127 ->regoff =[REG_RESULT, (REG_RESULT2/REG_RESULT), REG_FRESULT]
128 rd->arg[flt|int]reguse set to a value according the register usage
131 *******************************************************************************/
132 void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
133 stackptr stackslot) {
134 /* precoloring only straightforward possible with flt/dbl types */
135 if (IS_FLT_DBL_TYPE(return_type)) {
136 /* In Leafmethods Local Vars holding parameters are precolored to */
137 /* their argument register -> so leafmethods with paramcount > 0 could*/
138 /* already use a00! */
139 if (!m->isleafmethod || (m->paramcount == 0)) {
140 /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has */
141 /* not to survive method invokations */
142 if (!(stackslot->flags & SAVEDVAR)) {
143 stackslot->varkind = ARGVAR;
144 stackslot->varnum = -1;
145 stackslot->flags = 0;
147 if (rd->argfltreguse < 1) rd->argfltreguse = 1;
148 stackslot->regoff = REG_FRESULT;
155 * These are local overrides for various environment variables in Emacs.
156 * Please do not remove this and leave it at the end of the file, where
157 * Emacs will automagically detect them.
158 * ---------------------------------------------------------------------
161 * indent-tabs-mode: t