1 /* src/vm/jit/i386/md-abi.c - functions for i386 Linux ABI
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 #include "vm/jit/i386/md-abi.h"
31 #include "vm/descriptor.hpp"
32 #include "vm/global.h"
34 #include "vm/jit/abi.h"
37 /* register descripton - array ************************************************/
40 REG_RET, REG_RES, REG_RES, REG_TMP, REG_RES, REG_SAV, REG_SAV, REG_SAV,
44 const char *abi_registers_integer_name[] = {
45 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
48 const s4 abi_registers_integer_argument[] = {
52 const s4 abi_registers_integer_saved[] = {
58 const s4 abi_registers_integer_temporary[] = {
63 s4 nregdescfloat[] = {
64 /* rounding problems with callee saved registers */
65 /* REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_RES, REG_RES, */
66 /* REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, */
67 REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
71 const s4 abi_registers_float_argument[] = {
75 const s4 abi_registers_float_saved[] = {
79 const s4 abi_registers_float_temporary[] = {
84 /* md_param_alloc **************************************************************
86 Allocate Arguments to Stackslots according the Calling Conventions
89 md->paramcount: Number of arguments for this method
90 md->paramtypes[].type: Argument types
93 md->params[].inmemory: Argument spilled on stack
94 md->params[].regoff: Stack offset or rd->arg[int|flt]regs index
95 md->memuse: Stackslots needed for argument spilling
96 md->argintreguse: max number of integer arguments used
97 md->argfltreguse: max number of float arguments used
99 *******************************************************************************/
101 void md_param_alloc(methoddesc *md)
110 for (i = 0; i < md->paramcount; i++, pd++) {
112 pd->index = stacksize;
113 pd->regoff = stacksize * 8;
117 md->memuse = stacksize;
118 md->argintreguse = 0;
119 md->argfltreguse = 0;
123 /* md_param_alloc_native *******************************************************
125 Pre-allocate arguments according the native ABI.
127 *******************************************************************************/
129 void md_param_alloc_native(methoddesc *md)
138 for (i = 0; i < md->paramcount; i++, pd++) {
140 pd->index = stacksize;
141 pd->regoff = stacksize * 4;
142 stacksize += IS_2_WORD_TYPE(md->paramtypes[i].type) ? 2 : 1;
145 md->memuse = stacksize;
146 md->argintreguse = 0;
147 md->argfltreguse = 0;
151 /* md_return_alloc *************************************************************
153 No straight forward precoloring of the Java Stackelement containing
154 the return value possible for i386, since it uses "reserved"
155 registers for return values
157 *******************************************************************************/
159 void md_return_alloc(jitdata *jd, stackelement_t *stackslot)
166 * These are local overrides for various environment variables in Emacs.
167 * Please do not remove this and leave it at the end of the file, where
168 * Emacs will automagically detect them.
169 * ---------------------------------------------------------------------
172 * indent-tabs-mode: t