12c4a0a9e25a5c214ce56327775b7d65aaff7bbc
[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 */
26
27
28 #ifndef _MD_ASM_H
29 #define _MD_ASM_H
30
31 /* define register names compatible with Linux names **************************/
32
33 #define fr0     f0
34 #define fr1     f1
35 #define fr2     f2
36 #define fr3     f3
37 #define fr4     f4
38 #define fr5     f5
39 #define fr6     f6
40 #define fr7     f7
41 #define fr8     f8
42 #define fr9     f9
43 #define fr10    f10
44 #define fr11    f11
45 #define fr12    f12
46 #define fr13    f13
47 #define fr14    f14
48 #define fr15    f15
49 #define fr16    f16
50 #define fr17    f17
51 #define fr18    f18
52 #define fr19    f19
53 #define fr20    f20
54 #define fr21    f21
55 #define fr22    f22
56 #define fr23    f23
57 #define fr24    f24
58 #define fr25    f25
59 #define fr26    f26
60 #define fr27    f27
61 #define fr28    f28
62 #define fr29    f29
63 #define fr30    f30
64 #define fr31    f31
65
66
67 /* register defines ***********************************************************/
68
69 #define zero  r0
70 #define sp    r1
71
72 #define t0    r2
73
74 #define a0    r3
75 #define a1    r4
76 #define a2    r5
77 #define a3    r6
78 #define a4    r7
79 #define a5    r8
80 #define a6    r9
81 #define a7    r10
82
83 #define itmp1 r11
84 #define itmp2 r12
85 #define pv    r13
86
87 #define s0    r14
88 #define s1    r15
89
90 #define itmp3 r16
91 #define t1    r17
92 #define t2    r18
93 #define t3    r19
94 #define t4    r20
95 #define t5    r21
96 #define t6    r22
97 #define t7    r23
98
99 #define s2    r24
100 #define s3    r25
101 #define s4    r26
102 #define s5    r27
103 #define s6    r28
104 #define s7    r29
105 #define s8    r30
106 #define s9    r31
107
108 #define v0    a0
109 #define v1    a1
110
111 #define xptr  itmp1
112 #define xpc   itmp2
113
114 #define mptr  itmp2
115 #define mptrn 12
116
117
118 #define ftmp3 f0
119
120 #define fa0   f1
121 #define fa1   f2
122 #define fa2   f3
123 #define fa3   f4
124 #define fa4   f5
125 #define fa5   f6
126 #define fa6   f7
127
128 #define fa7   f8
129 #define fa8   f9
130 #define fa9   f10
131 #define fa10  f11
132 #define fa11  f12
133 #define fa12  f13
134
135 #define fs0   f14
136 #define fs1   f15
137
138 #define ftmp1 f16
139 #define ftmp2 f17
140
141 #define ft0   f18
142 #define ft1   f19
143 #define ft2   f20
144 #define ft3   f21
145 #define ft4   f22
146 #define ft5   f23
147
148 #define fs2   f24
149 #define fs3   f25
150 #define fs4   f26
151 #define fs5   f27
152 #define fs6   f28
153 #define fs7   f29
154 #define fs8   f30
155 #define fs9   f31
156
157 #define fv0   fa0
158
159
160 /* save and restore macros ****************************************************/
161
162 #define SAVE_ARGUMENT_REGISTERS(off) \
163         stw     a0,(0+(off))*4(sp); \
164         stw     a1,(1+(off))*4(sp); \
165         stw     a2,(2+(off))*4(sp); \
166         stw     a3,(3+(off))*4(sp); \
167         stw     a4,(4+(off))*4(sp); \
168         stw     a5,(5+(off))*4(sp); \
169         stw     a6,(6+(off))*4(sp); \
170         stw     a7,(7+(off))*4(sp); \
171         \
172         stfd    fa0,(8+(off))*4)(sp); \
173         stfd    fa1,(10+(off))*4)(sp); \
174         stfd    fa2,(12+(off))*4)(sp); \
175         stfd    fa3,(14+(off))*4)(sp); \
176         stfd    fa4,(16+(off))*4)(sp); \
177         stfd    fa5,(18+(off))*4)(sp); \
178         stfd    fa6,(20+(off))*4)(sp); \
179         stfd    fa7,(22+(off))*4)(sp); \
180         stfd    fa8,(24+(off))*4)(sp); \
181         stfd    fa9,(26+(off))*4)(sp); \
182         stfd    fa10,(28+(off))*4)(sp); \
183         stfd    fa11,(30+(off))*4)(sp); \
184         stfd    fa12,(32+(off))*4)(sp);
185
186 #define RESTORE_ARGUMENT_REGISTERS(off) \
187         lwz     a0,(0+(off))*4(sp); \
188         lwz     a1,(1+(off))*4(sp); \
189         lwz     a2,(2+(off))*4(sp); \
190         lwz     a3,(3+(off))*4(sp); \
191         lwz     a4,(4+(off))*4(sp); \
192         lwz     a5,(5+(off))*4(sp); \
193         lwz     a6,(6+(off))*4(sp); \
194         lwz     a7,(7+(off))*4(sp); \
195         \
196         lfd     fa0,(8+(off))*4)(sp); \
197         lfd     fa1,(10+(off))*4)(sp); \
198         lfd     fa2,(12+(off))*4)(sp); \
199         lfd     fa3,(14+(off))*4)(sp); \
200         lfd     fa4,(16+(off))*4)(sp); \
201         lfd     fa5,(18+(off))*4)(sp); \
202         lfd     fa6,(20+(off))*4)(sp); \
203         lfd     fa7,(22+(off))*4)(sp); \
204         lfd     fa8,(24+(off))*4)(sp); \
205         lfd     fa9,(26+(off))*4)(sp); \
206         lfd     fa10,(28+(off))*4)(sp); \
207         lfd     fa11,(30+(off))*4)(sp); \
208         lfd     fa12,(32+(off))*4)(sp);
209
210
211 /* Defines for darwin's old gnu assembler *************************************/
212
213 /* internal defines ***********************************************************/
214
215 #define asm_vm_call_method                    _asm_vm_call_method
216 #define asm_vm_call_method_int                _asm_vm_call_method_int
217 #define asm_vm_call_method_long               _asm_vm_call_method_long
218 #define asm_vm_call_method_float              _asm_vm_call_method_float
219 #define asm_vm_call_method_double             _asm_vm_call_method_double
220 #define asm_vm_call_method_end                _asm_vm_call_method_end
221
222 #define asm_vm_call_method_exception_handler  _asm_vm_call_method_exception_handler
223
224 #define asm_handle_nat_exception              _asm_handle_nat_exception
225 #define asm_handle_exception                  _asm_handle_exception
226
227 #define asm_abstractmethoderror               _asm_abstractmethoderror
228
229 #define asm_cacheflush                        _asm_cacheflush
230
231
232 /* external defines ***********************************************************/
233
234 #define builtin_throw_exception               L_builtin_throw_exception$stub
235
236 #define md_codegen_get_pv_from_pc             L_md_codegen_get_pv_from_pc$stub
237 #define exceptions_handle_exception           L_exceptions_handle_exception$stub
238
239 #define exceptions_asm_new_abstractmethoderror \
240     L_exceptions_asm_new_abstractmethoderror$stub
241
242 #endif /* _MD_ASM_H */
243
244
245 /*
246  * These are local overrides for various environment variables in Emacs.
247  * Please do not remove this and leave it at the end of the file, where
248  * Emacs will automagically detect them.
249  * ---------------------------------------------------------------------
250  * Local variables:
251  * mode: c
252  * indent-tabs-mode: t
253  * c-basic-offset: 4
254  * tab-width: 4
255  * End:
256  */