* Removed all Id tags.
[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 */
32
33
34 #ifndef _MD_ASM_H
35 #define _MD_ASM_H
36
37 /* define register names compatible with Linux names **************************/
38
39 #define fr0     f0
40 #define fr1     f1
41 #define fr2     f2
42 #define fr3     f3
43 #define fr4     f4
44 #define fr5     f5
45 #define fr6     f6
46 #define fr7     f7
47 #define fr8     f8
48 #define fr9     f9
49 #define fr10    f10
50 #define fr11    f11
51 #define fr12    f12
52 #define fr13    f13
53 #define fr14    f14
54 #define fr15    f15
55 #define fr16    f16
56 #define fr17    f17
57 #define fr18    f18
58 #define fr19    f19
59 #define fr20    f20
60 #define fr21    f21
61 #define fr22    f22
62 #define fr23    f23
63 #define fr24    f24
64 #define fr25    f25
65 #define fr26    f26
66 #define fr27    f27
67 #define fr28    f28
68 #define fr29    f29
69 #define fr30    f30
70 #define fr31    f31
71
72
73 /* register defines ***********************************************************/
74
75 #define zero  r0
76 #define sp    r1
77
78 #define t0    r2
79
80 #define a0    r3
81 #define a1    r4
82 #define a2    r5
83 #define a3    r6
84 #define a4    r7
85 #define a5    r8
86 #define a6    r9
87 #define a7    r10
88
89 #define itmp1 r11
90 #define itmp2 r12
91 #define pv    r13
92
93 #define s0    r14
94 #define s1    r15
95
96 #define itmp3 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 xptr  itmp1
118 #define xpc   itmp2
119
120 #define mptr  itmp2
121 #define mptrn 12
122
123
124 #define ftmp3 f0
125
126 #define fa0   f1
127 #define fa1   f2
128 #define fa2   f3
129 #define fa3   f4
130 #define fa4   f5
131 #define fa5   f6
132 #define fa6   f7
133
134 #define fa7   f8
135 #define fa8   f9
136 #define fa9   f10
137 #define fa10  f11
138 #define fa11  f12
139 #define fa12  f13
140
141 #define fs0   f14
142 #define fs1   f15
143
144 #define ftmp1 f16
145 #define ftmp2 f17
146
147 #define ft0   f18
148 #define ft1   f19
149 #define ft2   f20
150 #define ft3   f21
151 #define ft4   f22
152 #define ft5   f23
153
154 #define fs2   f24
155 #define fs3   f25
156 #define fs4   f26
157 #define fs5   f27
158 #define fs6   f28
159 #define fs7   f29
160 #define fs8   f30
161 #define fs9   f31
162
163 #define fv0   fa0
164
165
166 /* save and restore macros ****************************************************/
167
168 #define SAVE_ARGUMENT_REGISTERS(off) \
169         stw     a0,(0+(off))*4(sp); \
170         stw     a1,(1+(off))*4(sp); \
171         stw     a2,(2+(off))*4(sp); \
172         stw     a3,(3+(off))*4(sp); \
173         stw     a4,(4+(off))*4(sp); \
174         stw     a5,(5+(off))*4(sp); \
175         stw     a6,(6+(off))*4(sp); \
176         stw     a7,(7+(off))*4(sp); \
177         \
178         stfd    fa0,(8+(off))*4)(sp); \
179         stfd    fa1,(10+(off))*4)(sp); \
180         stfd    fa2,(12+(off))*4)(sp); \
181         stfd    fa3,(14+(off))*4)(sp); \
182         stfd    fa4,(16+(off))*4)(sp); \
183         stfd    fa5,(18+(off))*4)(sp); \
184         stfd    fa6,(20+(off))*4)(sp); \
185         stfd    fa7,(22+(off))*4)(sp); \
186         stfd    fa8,(24+(off))*4)(sp); \
187         stfd    fa9,(26+(off))*4)(sp); \
188         stfd    fa10,(28+(off))*4)(sp); \
189         stfd    fa11,(30+(off))*4)(sp); \
190         stfd    fa12,(32+(off))*4)(sp);
191
192 #define RESTORE_ARGUMENT_REGISTERS(off) \
193         lwz     a0,(0+(off))*4(sp); \
194         lwz     a1,(1+(off))*4(sp); \
195         lwz     a2,(2+(off))*4(sp); \
196         lwz     a3,(3+(off))*4(sp); \
197         lwz     a4,(4+(off))*4(sp); \
198         lwz     a5,(5+(off))*4(sp); \
199         lwz     a6,(6+(off))*4(sp); \
200         lwz     a7,(7+(off))*4(sp); \
201         \
202         lfd     fa0,(8+(off))*4)(sp); \
203         lfd     fa1,(10+(off))*4)(sp); \
204         lfd     fa2,(12+(off))*4)(sp); \
205         lfd     fa3,(14+(off))*4)(sp); \
206         lfd     fa4,(16+(off))*4)(sp); \
207         lfd     fa5,(18+(off))*4)(sp); \
208         lfd     fa6,(20+(off))*4)(sp); \
209         lfd     fa7,(22+(off))*4)(sp); \
210         lfd     fa8,(24+(off))*4)(sp); \
211         lfd     fa9,(26+(off))*4)(sp); \
212         lfd     fa10,(28+(off))*4)(sp); \
213         lfd     fa11,(30+(off))*4)(sp); \
214         lfd     fa12,(32+(off))*4)(sp);
215
216
217 /* Defines for darwin's old gnu assembler *************************************/
218
219 /* internal defines ***********************************************************/
220
221 #define asm_vm_call_method                    _asm_vm_call_method
222 #define asm_vm_call_method_int                _asm_vm_call_method_int
223 #define asm_vm_call_method_long               _asm_vm_call_method_long
224 #define asm_vm_call_method_float              _asm_vm_call_method_float
225 #define asm_vm_call_method_double             _asm_vm_call_method_double
226 #define asm_vm_call_method_end                _asm_vm_call_method_end
227
228 #define asm_vm_call_method_exception_handler  _asm_vm_call_method_exception_handler
229
230 #define jumptable_int                         _jumptable_int
231 #define jumptable_long                        _jumptable_long
232
233 #define asm_call_jit_compiler                 _asm_call_jit_compiler
234
235 #define asm_handle_nat_exception              _asm_handle_nat_exception
236 #define asm_handle_exception                  _asm_handle_exception
237
238 #define asm_abstractmethoderror               _asm_abstractmethoderror
239
240 #define asm_patcher_wrapper                   _asm_patcher_wrapper
241
242 #define asm_replacement_out                   _asm_replacement_out
243 #define asm_replacement_in                    _asm_replacement_in
244
245 #define asm_cacheflush                        _asm_cacheflush
246
247
248 /* external defines ***********************************************************/
249
250 #define exceptions_get_and_clear_exception \
251     L_exceptions_get_and_clear_exception$stub
252
253 #define builtin_throw_exception               L_builtin_throw_exception$stub
254
255 #define md_codegen_get_pv_from_pc             L_md_codegen_get_pv_from_pc$stub
256 #define exceptions_handle_exception           L_exceptions_handle_exception$stub
257
258 #define jit_asm_compile                       L_jit_asm_compile$stub
259
260 #define exceptions_asm_new_abstractmethoderror \
261     L_exceptions_asm_new_abstractmethoderror$stub
262
263 #define patcher_wrapper                       L_patcher_wrapper$stub
264
265 #define replace_me                            L_replace_me$stub
266 #define replace_build_execution_state         L_replace_build_execution_state$stub
267 #define replace_free_safestack                L_replace_free_safestack$stub
268
269 #define stacktrace_create_extern_stackframeinfo \
270     L_stacktrace_create_extern_stackframeinfo$stub
271
272 #define stacktrace_remove_stackframeinfo \
273     L_stacktrace_remove_stackframeinfo$stub
274
275 #endif /* _MD_ASM_H */
276
277
278 /*
279  * These are local overrides for various environment variables in Emacs.
280  * Please do not remove this and leave it at the end of the file, where
281  * Emacs will automagically detect them.
282  * ---------------------------------------------------------------------
283  * Local variables:
284  * mode: c
285  * indent-tabs-mode: t
286  * c-basic-offset: 4
287  * tab-width: 4
288  * End:
289  */