1 /* src/vm/jit/powerpc/darwin/md-abi.h - defines for PowerPC Darwin 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.h 2539 2005-05-31 15:55:54Z twisti $
39 /* preallocated registers *****************************************************/
41 /* integer registers */
43 #define REG_RESULT 3 /* to deliver method results */
44 #define REG_RESULT2 4 /* to deliver long method results */
46 #define REG_PV 13 /* procedure vector, must be provided by caller */
47 #define REG_METHODPTR 12 /* pointer to the place from where the procedure */
48 /* vector has been fetched */
49 #define REG_ITMP1 11 /* temporary register */
50 #define REG_ITMP2 12 /* temporary register and method pointer */
51 #define REG_ITMP3 0 /* temporary register */
53 #define REG_ITMP1_XPTR 11 /* exception pointer = temporary register 1 */
54 #define REG_ITMP2_XPC 12 /* exception pc = temporary register 2 */
56 #define REG_SP 1 /* stack pointer */
57 #define REG_ZERO 0 /* almost always zero: only in address calc. */
59 /* floating point registers */
61 #define REG_FRESULT 1 /* to deliver floating point method results */
62 #define REG_FTMP1 16 /* temporary floating point register */
63 #define REG_FTMP2 17 /* temporary floating point register */
64 #define REG_FTMP3 0 /* temporary floating point register */
66 #define REG_IFTMP 0 /* temporary integer and floating point register */
69 #define INT_REG_CNT 32 /* number of integer registers */
70 #define INT_SAV_CNT 10 /* number of int callee saved registers */
71 #define INT_ARG_CNT 8 /* number of int argument registers */
72 #define INT_TMP_CNT 8 /* number of integer temporary registers */
73 #define INT_RES_CNT 3 /* number of integer reserved registers */
75 #define FLT_REG_CNT 32 /* number of float registers */
76 #define FLT_SAV_CNT 10 /* number of float callee saved registers */
77 #define FLT_ARG_CNT 13 /* number of float argument registers */
78 #define FLT_TMP_CNT 6 /* number of float temporary registers */
79 #define FLT_RES_CNT 3 /* number of float reserved registers */
81 #define TRACE_ARGS_NUM 8
84 /* ABI defines ****************************************************************/
86 #define LA_SIZE 24 /* linkage area size */
87 #define LA_SIZE_ALIGNED 32 /* linkage area size aligned to 16-byte */
88 #define LA_WORD_SIZE 6 /* linkage area size in words: 6 * 4 = 24 */
90 #define LA_LR_OFFSET 8 /* link register offset in linkage area */
92 /* #define ALIGN_FRAME_SIZE(sp) (sp) */
95 /* SET_ARG_STACKSLOTS **********************************************************
97 Macro for stack.c to set Argument Stackslots
99 Sets the first call_argcount stackslots of curstack to varkind ARGVAR, if
100 they to not have the SAVEDVAR flag set. According to the calling
101 conventions these stackslots are assigned argument registers or memory
105 i,call_argcount: Number of arguments for this method
106 curstack: instack of the method invokation
107 call_returntype: return type
113 copy: Points to first stackslot after the parameters
114 rd->argintreguse: max. number of used integer argument register so far
115 rd->argfltreguse: max. number of used float argument register so far
116 rd->ifmemuse: max. number of stackslots used for spilling parameters
119 *******************************************************************************/
121 #define SET_ARG_STACKSLOTS \
131 for (;i > 0; i--) { \
132 stacksize += (IS_2_WORD_TYPE(copy->type)) ? 2 : 1; \
133 if (IS_FLT_DBL_TYPE(copy->type)) \
137 if (rd->argfltreguse < farg) \
138 rd->argfltreguse = farg; \
140 /* REG_FRESULT == FLOAT ARGUMENT REGISTER 0 */ \
141 if (IS_FLT_DBL_TYPE(call_returntype)) \
142 if (rd->argfltreguse < 1) \
143 rd->argfltreguse = 1; \
145 if (stacksize > rd->ifmemuse) \
146 rd->ifmemuse = stacksize; \
151 stacksize -= (IS_2_WORD_TYPE(copy->type)) ? 2 : 1; \
152 if (IS_FLT_DBL_TYPE(copy->type)) { \
154 if (!(copy->flags & SAVEDVAR)) { \
156 copy->varkind = ARGVAR; \
157 if (farg < rd->fltreg_argnum) { \
159 copy->regoff = rd->argfltregs[farg]; \
161 copy->flags = INMEMORY; \
162 copy->regoff = stacksize; \
166 iarg = stacksize - 6; \
167 if (iarg+(IS_2_WORD_TYPE(copy->type) ? 2 : 1) > iarg_max) \
168 iarg_max = iarg+(IS_2_WORD_TYPE(copy->type) ? 2 : 1); \
170 if (!(copy->flags & SAVEDVAR)) { \
172 copy->varkind = ARGVAR; \
173 if ((iarg+((IS_2_WORD_TYPE(copy->type)) ? 1 : 0)) < rd->intreg_argnum) { \
175 copy->regoff = rd->argintregs[iarg]; \
177 copy->flags = INMEMORY; \
178 copy->regoff = stacksize; \
184 if (rd->argintreguse < iarg_max) \
185 rd->argintreguse = iarg_max; \
186 if (IS_INT_LNG_TYPE(call_returntype)) { \
187 /* REG_RESULT == INTEGER ARGUMENT REGISTER 0 */ \
188 /* REG_RESULT2 == INTEGER ARGUMENT REGISTER 1 */ \
189 if (IS_2_WORD_TYPE(call_returntype)) { \
190 if (rd->argintreguse < 2) \
191 rd->argintreguse = 2; \
193 if (rd->argintreguse < 1) \
194 rd->argintreguse = 1; \
200 #endif /* _MD_ABI_H */
204 * These are local overrides for various environment variables in Emacs.
205 * Please do not remove this and leave it at the end of the file, where
206 * Emacs will automagically detect them.
207 * ---------------------------------------------------------------------
210 * indent-tabs-mode: t