* Added and removed some function name defines
[cacao.git] / src / vm / jit / powerpc / darwin / md-asm.h
1 /* src/vm/jit/powerpc/darwin/md-asm.h - assembler defines for PowerPC Darwin ABI
2
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
7
8    This file is part of CACAO.
9
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.
14
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.
19
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
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Thalinger
28
29    Changes:
30
31    $Id: md-asm.h 2963 2005-07-09 18:08:52Z twisti $
32
33 */
34
35
36 #ifndef _MD_ASM_H
37 #define _MD_ASM_H
38
39 #include <mach/ppc/asm.h>
40
41
42 /* define register names compatible with Linux names **************************/
43
44 #define fr0     f0
45 #define fr1     f1
46 #define fr2     f2
47 #define fr3     f3
48 #define fr4     f4
49 #define fr5     f5
50 #define fr6     f6
51 #define fr7     f7
52 #define fr8     f8
53 #define fr9     f9
54 #define fr10    f10
55 #define fr11    f11
56 #define fr12    f12
57 #define fr13    f13
58 #define fr14    f14
59 #define fr15    f15
60 #define fr16    f16
61 #define fr17    f17
62 #define fr18    f18
63 #define fr19    f19
64 #define fr20    f20
65 #define fr21    f21
66 #define fr22    f22
67 #define fr23    f23
68 #define fr24    f24
69 #define fr25    f25
70 #define fr26    f26
71 #define fr27    f27
72 #define fr28    f28
73 #define fr29    f29
74 #define fr30    f30
75 #define fr31    f31
76
77
78 /* register defines ***********************************************************/
79
80 #define sp    r1
81
82 #define a0    r3
83 #define a1    r4
84 #define a2    r5
85 #define a3    r6
86 #define a4    r7
87 #define a5    r8
88 #define a6    r9
89 #define a7    r10
90
91 #define pv    r13
92
93 #define s0    r14
94 #define s1    r15
95
96 #define t0    r16
97 #define t1    r17
98 #define t2    r18
99 #define t3    r19
100 #define t4    r20
101 #define t5    r21
102 #define t6    r22
103 #define t7    r23
104
105 #define s2    r24
106 #define s3    r25
107 #define s4    r26
108 #define s5    r27
109 #define s6    r28
110 #define s7    r29
111 #define s8    r30
112 #define s9    r31
113
114 #define v0    a0
115 #define v1    a1
116
117 #define itmp1 r11
118 #define itmp2 r12
119 #define itmp3 r0
120
121 #define xptr  itmp1
122 #define xpc   itmp2
123
124 #define mptr  itmp2
125 #define mptrn 12
126
127
128 #define ftmp3 fr0
129
130 #define fa0   fr1
131 #define fa1   fr2
132 #define fa2   fr3
133 #define fa3   fr4
134 #define fa4   fr5
135 #define fa5   fr6
136 #define fa6   fr7
137
138 #define fa7   fr8
139 #define fa8   fr9
140 #define fa9   fr10
141 #define fa10  fr11
142 #define fa11  fr12
143 #define fa12  fr13
144
145 #define fs0   fr14
146 #define fs1   fr15
147
148 #define ftmp1 fr16
149 #define ftmp2 fr17
150
151 #define ft0   fr18
152 #define ft1   fr19
153 #define ft2   fr20
154 #define ft3   fr21
155 #define ft4   fr22
156 #define ft5   fr23
157
158 #define fs2   fr24
159 #define fs3   fr25
160 #define fs4   fr26
161 #define fs5   fr27
162 #define fs6   fr28
163 #define fs7   fr29
164 #define fs8   fr30
165 #define fs9   fr31
166
167 #define fv0   fa0
168
169
170 /* save and restore macros ****************************************************/
171
172 #define SAVE_ARGUMENT_REGISTERS(off) \
173         stw     a0,(0+(off))*4(sp); \
174         stw     a1,(1+(off))*4(sp); \
175         stw     a2,(2+(off))*4(sp); \
176         stw     a3,(3+(off))*4(sp); \
177         stw     a4,(4+(off))*4(sp); \
178         stw     a5,(5+(off))*4(sp); \
179         stw     a6,(6+(off))*4(sp); \
180         stw     a7,(7+(off))*4(sp); \
181         \
182         stfd    fa0,(8+(off))*4)(sp); \
183         stfd    fa1,(10+(off))*4)(sp); \
184         stfd    fa2,(12+(off))*4)(sp); \
185         stfd    fa3,(14+(off))*4)(sp); \
186         stfd    fa4,(16+(off))*4)(sp); \
187         stfd    fa5,(18+(off))*4)(sp); \
188         stfd    fa6,(20+(off))*4)(sp); \
189         stfd    fa7,(22+(off))*4)(sp); \
190         stfd    fa8,(24+(off))*4)(sp); \
191         stfd    fa9,(26+(off))*4)(sp); \
192         stfd    fa10,(28+(off))*4)(sp); \
193         stfd    fa11,(30+(off))*4)(sp); \
194         stfd    fa12,(32+(off))*4)(sp);
195
196 #define RESTORE_ARGUMENT_REGISTERS(off) \
197         lwz     a0,(0+(off))*4(sp); \
198         lwz     a1,(1+(off))*4(sp); \
199         lwz     a2,(2+(off))*4(sp); \
200         lwz     a3,(3+(off))*4(sp); \
201         lwz     a4,(4+(off))*4(sp); \
202         lwz     a5,(5+(off))*4(sp); \
203         lwz     a6,(6+(off))*4(sp); \
204         lwz     a7,(7+(off))*4(sp); \
205         \
206         lfd     fa0,(8+(off))*4)(sp); \
207         lfd     fa1,(10+(off))*4)(sp); \
208         lfd     fa2,(12+(off))*4)(sp); \
209         lfd     fa3,(14+(off))*4)(sp); \
210         lfd     fa4,(16+(off))*4)(sp); \
211         lfd     fa5,(18+(off))*4)(sp); \
212         lfd     fa6,(20+(off))*4)(sp); \
213         lfd     fa7,(22+(off))*4)(sp); \
214         lfd     fa8,(24+(off))*4)(sp); \
215         lfd     fa9,(26+(off))*4)(sp); \
216         lfd     fa10,(28+(off))*4)(sp); \
217         lfd     fa11,(30+(off))*4)(sp); \
218         lfd     fa12,(32+(off))*4)(sp);
219
220
221 /* Defines for darwin's old gnu assembler *************************************/
222
223 /* internal defines ***********************************************************/
224
225 #define asm_calljavafunction                  _asm_calljavafunction
226 #define asm_calljavafunction_int              _asm_calljavafunction_int
227
228 #define asm_calljavafunction2                 _asm_calljavafunction2
229 #define asm_calljavafunction2int              _asm_calljavafunction2int
230 #define asm_calljavafunction2long             _asm_calljavafunction2long
231 #define asm_calljavafunction2float            _asm_calljavafunction2float
232 #define asm_calljavafunction2double           _asm_calljavafunction2double
233
234 #define asm_call_jit_compiler                 _asm_call_jit_compiler
235
236 #define asm_handle_nat_exception              _asm_handle_nat_exception
237 #define asm_handle_exception                  _asm_handle_exception
238 #define asm_handle_nullptr_exception          _asm_handle_nullptr_exception
239
240 #define asm_wrapper_patcher                   _asm_wrapper_patcher
241
242 #define asm_cacheflush                        _asm_cacheflush
243 #define asm_initialize_thread_stack           _asm_initialize_thread_stack
244 #define asm_perform_threadswitch              _asm_perform_threadswitch
245 #define asm_switchstackandcall                _asm_switchstackandcall
246 #define asm_criticalsections                  _asm_criticalsections
247 #define asm_getclassvalues_atomic             _asm_getclassvalues_atomic
248
249
250 /* external defines ***********************************************************/
251
252 #define builtin_asm_get_exceptionptrptr       _builtin_asm_get_exceptionptrptr
253 #define builtin_canstore                      _builtin_canstore
254 #define builtin_arraycheckcast                _builtin_arraycheckcast
255 #define builtin_ldiv                          _builtin_ldiv
256 #define builtin_lrem                          _builtin_lrem
257
258 #if defined(USE_THREADS)
259 #define builtin_monitorexit                   _builtin_monitorexit
260 #endif
261
262 #define builtin_throw_exception               _builtin_throw_exception
263 #define builtin_trace_exception               _builtin_trace_exception
264 #define initialize_class                      _initialize_class
265 #define link_class                            _link_class
266 #define load_class_bootstrap                  _load_class_bootstrap
267 #define jit_compile                           _jit_compile
268
269 #define stacktrace_create_inline_stackframeinfo \
270         _stacktrace_create_inline_stackframeinfo
271
272 #define stacktrace_remove_stackframeinfo      _stacktrace_remove_stackframeinfo
273
274 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
275 #if 0
276 #define _exceptionptr                         __exceptionptr
277 #endif
278
279 _exceptionptr:
280         .globl          __exceptionptr
281 #endif
282
283
284 #endif /* _MD_ASM_H */
285
286
287 /*
288  * These are local overrides for various environment variables in Emacs.
289  * Please do not remove this and leave it at the end of the file, where
290  * Emacs will automagically detect them.
291  * ---------------------------------------------------------------------
292  * Local variables:
293  * mode: c
294  * indent-tabs-mode: t
295  * c-basic-offset: 4
296  * tab-width: 4
297  * End:
298  */