3e469acac29c68a9b61dea8d09ff0956005c9b98
[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, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, 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., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Contact: cacao@cacaojvm.org
26
27    Authors: Christian Thalinger
28
29    Changes:
30
31    $Id: md-asm.h 8274 2007-08-08 15:58:17Z twisti $
32
33 */
34
35
36 #ifndef _MD_ASM_H
37 #define _MD_ASM_H
38
39 /* define register names compatible with Linux names **************************/
40
41 #define fr0     f0
42 #define fr1     f1
43 #define fr2     f2
44 #define fr3     f3
45 #define fr4     f4
46 #define fr5     f5
47 #define fr6     f6
48 #define fr7     f7
49 #define fr8     f8
50 #define fr9     f9
51 #define fr10    f10
52 #define fr11    f11
53 #define fr12    f12
54 #define fr13    f13
55 #define fr14    f14
56 #define fr15    f15
57 #define fr16    f16
58 #define fr17    f17
59 #define fr18    f18
60 #define fr19    f19
61 #define fr20    f20
62 #define fr21    f21
63 #define fr22    f22
64 #define fr23    f23
65 #define fr24    f24
66 #define fr25    f25
67 #define fr26    f26
68 #define fr27    f27
69 #define fr28    f28
70 #define fr29    f29
71 #define fr30    f30
72 #define fr31    f31
73
74
75 /* register defines ***********************************************************/
76
77 #define zero  r0
78 #define sp    r1
79
80 #define t0    r2
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 itmp1 r11
92 #define itmp2 r12
93 #define pv    r13
94
95 #define s0    r14
96 #define s1    r15
97
98 #define itmp3 r16
99 #define t1    r17
100 #define t2    r18
101 #define t3    r19
102 #define t4    r20
103 #define t5    r21
104 #define t6    r22
105 #define t7    r23
106
107 #define s2    r24
108 #define s3    r25
109 #define s4    r26
110 #define s5    r27
111 #define s6    r28
112 #define s7    r29
113 #define s8    r30
114 #define s9    r31
115
116 #define v0    a0
117 #define v1    a1
118
119 #define xptr  itmp1
120 #define xpc   itmp2
121
122 #define mptr  itmp2
123 #define mptrn 12
124
125
126 #define ftmp3 f0
127
128 #define fa0   f1
129 #define fa1   f2
130 #define fa2   f3
131 #define fa3   f4
132 #define fa4   f5
133 #define fa5   f6
134 #define fa6   f7
135
136 #define fa7   f8
137 #define fa8   f9
138 #define fa9   f10
139 #define fa10  f11
140 #define fa11  f12
141 #define fa12  f13
142
143 #define fs0   f14
144 #define fs1   f15
145
146 #define ftmp1 f16
147 #define ftmp2 f17
148
149 #define ft0   f18
150 #define ft1   f19
151 #define ft2   f20
152 #define ft3   f21
153 #define ft4   f22
154 #define ft5   f23
155
156 #define fs2   f24
157 #define fs3   f25
158 #define fs4   f26
159 #define fs5   f27
160 #define fs6   f28
161 #define fs7   f29
162 #define fs8   f30
163 #define fs9   f31
164
165 #define fv0   fa0
166
167
168 /* save and restore macros ****************************************************/
169
170 #define SAVE_ARGUMENT_REGISTERS(off) \
171         stw     a0,(0+(off))*4(sp); \
172         stw     a1,(1+(off))*4(sp); \
173         stw     a2,(2+(off))*4(sp); \
174         stw     a3,(3+(off))*4(sp); \
175         stw     a4,(4+(off))*4(sp); \
176         stw     a5,(5+(off))*4(sp); \
177         stw     a6,(6+(off))*4(sp); \
178         stw     a7,(7+(off))*4(sp); \
179         \
180         stfd    fa0,(8+(off))*4)(sp); \
181         stfd    fa1,(10+(off))*4)(sp); \
182         stfd    fa2,(12+(off))*4)(sp); \
183         stfd    fa3,(14+(off))*4)(sp); \
184         stfd    fa4,(16+(off))*4)(sp); \
185         stfd    fa5,(18+(off))*4)(sp); \
186         stfd    fa6,(20+(off))*4)(sp); \
187         stfd    fa7,(22+(off))*4)(sp); \
188         stfd    fa8,(24+(off))*4)(sp); \
189         stfd    fa9,(26+(off))*4)(sp); \
190         stfd    fa10,(28+(off))*4)(sp); \
191         stfd    fa11,(30+(off))*4)(sp); \
192         stfd    fa12,(32+(off))*4)(sp);
193
194 #define RESTORE_ARGUMENT_REGISTERS(off) \
195         lwz     a0,(0+(off))*4(sp); \
196         lwz     a1,(1+(off))*4(sp); \
197         lwz     a2,(2+(off))*4(sp); \
198         lwz     a3,(3+(off))*4(sp); \
199         lwz     a4,(4+(off))*4(sp); \
200         lwz     a5,(5+(off))*4(sp); \
201         lwz     a6,(6+(off))*4(sp); \
202         lwz     a7,(7+(off))*4(sp); \
203         \
204         lfd     fa0,(8+(off))*4)(sp); \
205         lfd     fa1,(10+(off))*4)(sp); \
206         lfd     fa2,(12+(off))*4)(sp); \
207         lfd     fa3,(14+(off))*4)(sp); \
208         lfd     fa4,(16+(off))*4)(sp); \
209         lfd     fa5,(18+(off))*4)(sp); \
210         lfd     fa6,(20+(off))*4)(sp); \
211         lfd     fa7,(22+(off))*4)(sp); \
212         lfd     fa8,(24+(off))*4)(sp); \
213         lfd     fa9,(26+(off))*4)(sp); \
214         lfd     fa10,(28+(off))*4)(sp); \
215         lfd     fa11,(30+(off))*4)(sp); \
216         lfd     fa12,(32+(off))*4)(sp);
217
218
219 /* Defines for darwin's old gnu assembler *************************************/
220
221 /* internal defines ***********************************************************/
222
223 #define asm_vm_call_method                    _asm_vm_call_method
224 #define asm_vm_call_method_int                _asm_vm_call_method_int
225 #define asm_vm_call_method_long               _asm_vm_call_method_long
226 #define asm_vm_call_method_float              _asm_vm_call_method_float
227 #define asm_vm_call_method_double             _asm_vm_call_method_double
228 #define asm_vm_call_method_end                _asm_vm_call_method_end
229
230 #define asm_vm_call_method_exception_handler  _asm_vm_call_method_exception_handler
231
232 #define jumptable_int                         _jumptable_int
233 #define jumptable_long                        _jumptable_long
234
235 #define asm_call_jit_compiler                 _asm_call_jit_compiler
236
237 #define asm_handle_nat_exception              _asm_handle_nat_exception
238 #define asm_handle_exception                  _asm_handle_exception
239
240 #define asm_abstractmethoderror               _asm_abstractmethoderror
241
242 #define asm_patcher_wrapper                   _asm_patcher_wrapper
243
244 #define asm_replacement_out                   _asm_replacement_out
245 #define asm_replacement_in                    _asm_replacement_in
246
247 #define asm_cacheflush                        _asm_cacheflush
248
249
250 /* external defines ***********************************************************/
251
252 #define exceptions_get_and_clear_exception \
253     L_exceptions_get_and_clear_exception$stub
254
255 #define builtin_throw_exception               L_builtin_throw_exception$stub
256
257 #define md_codegen_get_pv_from_pc             L_md_codegen_get_pv_from_pc$stub
258 #define exceptions_handle_exception           L_exceptions_handle_exception$stub
259
260 #define jit_asm_compile                       L_jit_asm_compile$stub
261
262 #define exceptions_asm_new_abstractmethoderror \
263     L_exceptions_asm_new_abstractmethoderror$stub
264
265 #define patcher_wrapper                       L_patcher_wrapper$stub
266
267 #define replace_me                            L_replace_me$stub
268 #define replace_build_execution_state         L_replace_build_execution_state$stub
269 #define replace_free_safestack                L_replace_free_safestack$stub
270
271 #define stacktrace_create_extern_stackframeinfo \
272     L_stacktrace_create_extern_stackframeinfo$stub
273
274 #define stacktrace_remove_stackframeinfo \
275     L_stacktrace_remove_stackframeinfo$stub
276
277 #endif /* _MD_ASM_H */
278
279
280 /*
281  * These are local overrides for various environment variables in Emacs.
282  * Please do not remove this and leave it at the end of the file, where
283  * Emacs will automagically detect them.
284  * ---------------------------------------------------------------------
285  * Local variables:
286  * mode: c
287  * indent-tabs-mode: t
288  * c-basic-offset: 4
289  * tab-width: 4
290  * End:
291  */