* src/vm/jit/codegen-common.c (methodtree_comparator): Fixed S390 related comment.
[cacao.git] / src / vm / jit / s390 / md-asm.h
1 /* src/vm/jit/x86_64/md-asm.h - assembler defines for x86_64 Linux 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 7403 2007-02-25 21:31:58Z pm $
32
33 */
34
35
36 #ifndef _MD_ASM_H
37 #define _MD_ASM_H
38
39 /* register defines ***********************************************************/
40
41 #if 0
42
43 #define v0       %rax
44 #define v0l      %eax
45 #define itmp1    v0
46
47 #define a3       %rcx
48 #define a2       %rdx
49
50 #define t0       %rbx
51 #define t0l      %ebx
52
53 #define sp       %rsp
54 #define s0       %rbp
55
56 #define a1       %rsi
57 #define a0       %rdi
58 #define a0l      %edi
59
60 #define a4       %r8
61 #define a5       %r9
62
63 #define itmp2    %r10
64 #define itmp3    %r14
65
66 #define s1       %r12
67 #define s2       %r13
68 #define s3       %r14
69 #define s4       %r15
70
71
72 #define bp       s0
73
74 #define itmp1l   %eax
75 #define itmp2l   %r10d
76 #define itmp3l   %r11d
77
78 #define xptr     itmp1
79 #define xpc      itmp2
80 #define mptr     itmp2
81
82
83 #define fa0      %xmm0
84 #define fa1      %xmm1
85 #define fa2      %xmm2
86 #define fa3      %xmm3
87 #define fa4      %xmm4
88 #define fa5      %xmm5
89 #define fa6      %xmm6
90 #define fa7      %xmm7
91
92 #define ftmp1    %xmm8
93 #define ftmp2    %xmm9
94 #define ftmp3    %xmm10
95
96 #define ft0      %xmm11
97 #define ft1      %xmm12
98 #define ft2      %xmm13
99 #define ft3      %xmm14
100 #define ft4      %xmm15
101
102 #endif
103
104 #define a0       %r2
105 #define a1       %r3
106 #define a2       %r4
107 #define a3       %r5
108 #define a4       %r6
109
110 #define sp       %r15
111 #define itmp1    %r1
112 #define itmp2    %r12
113 #define itmp3    %r14
114 #define v0       %r2
115 #define pv       %r13
116
117 #define mptr     itmp2
118 #define xptr     itmp1
119 #define xpc      itmp2
120
121 #define s0 %r7
122 #define s1 %r8
123 #define s2 %r9
124 #define s3 %r10
125 #define s4 %r11
126
127 #define fa0 %f0
128 #define fa1 %f2
129
130 /* save and restore macros ****************************************************/
131
132 #define SAVE_ARGUMENT_REGISTERS(off) \
133         mov     a0,(0+(off))*8(sp)   ; \
134         mov     a1,(1+(off))*8(sp)   ; \
135         mov     a2,(2+(off))*8(sp)   ; \
136         mov     a3,(3+(off))*8(sp)   ; \
137         mov     a4,(4+(off))*8(sp)   ; \
138         mov     a5,(5+(off))*8(sp)   ; \
139         \
140         movq    fa0,(6+(off))*8(sp)  ; \
141         movq    fa1,(7+(off))*8(sp)  ; \
142         movq    fa2,(8+(off))*8(sp)  ; \
143         movq    fa3,(9+(off))*8(sp)  ; \
144         movq    fa4,(10+(off))*8(sp) ; \
145         movq    fa5,(11+(off))*8(sp) ; \
146         movq    fa6,(12+(off))*8(sp) ; \
147         movq    fa7,(13+(off))*8(sp) ;
148
149
150 #define RESTORE_ARGUMENT_REGISTERS(off) \
151         mov     (0+(off))*8(sp),a0   ; \
152         mov     (1+(off))*8(sp),a1   ; \
153         mov     (2+(off))*8(sp),a2   ; \
154         mov     (3+(off))*8(sp),a3   ; \
155         mov     (4+(off))*8(sp),a4   ; \
156         mov     (5+(off))*8(sp),a5   ; \
157         \
158         movq    (6+(off))*8(sp),fa0  ; \
159         movq    (7+(off))*8(sp),fa1  ; \
160         movq    (8+(off))*8(sp),fa2  ; \
161         movq    (9+(off))*8(sp),fa3  ; \
162         movq    (10+(off))*8(sp),fa4 ; \
163         movq    (11+(off))*8(sp),fa5 ; \
164         movq    (12+(off))*8(sp),fa6 ; \
165         movq    (13+(off))*8(sp),fa7 ;
166
167
168 #define SAVE_TEMPORARY_REGISTERS(off) \
169         mov     t0,(0+(off))*8(sp)   ; \
170         movq    ft0,(1+(off))*8(sp)  ; \
171         movq    ft1,(2+(off))*8(sp)  ; \
172         movq    ft2,(3+(off))*8(sp)  ; \
173         movq    ft3,(4+(off))*8(sp)  ;
174
175
176 #define RESTORE_TEMPORARY_REGISTERS(off) \
177         mov     (0+(off))*8(sp),t0   ; \
178         movq    (1+(off))*8(sp),ft0  ; \
179         movq    (2+(off))*8(sp),ft1  ; \
180         movq    (3+(off))*8(sp),ft2  ; \
181         movq    (4+(off))*8(sp),ft3  ;
182
183 /* Volatile float registers (all volatile in terms of C abi) */
184
185 #define LOAD_STORE_VOLATILE_FLOAT_REGISTERS(inst, off) \
186         inst    %f0, ((0 * 8) + (off))(sp); \
187         inst    %f2, ((1 * 8) + (off))(sp); \
188         inst    %f1, ((2 * 8) + (off))(sp); \
189         inst    %f3, ((3 * 8) + (off))(sp); \
190         inst    %f5, ((4 * 8) + (off))(sp); \
191         inst    %f7, ((5 * 8) + (off))(sp); \
192         inst    %f8, ((6 * 8) + (off))(sp); \
193         inst    %f9, ((7 * 8) + (off))(sp); \
194         inst    %f10, ((8 * 8) + (off))(sp); \
195         inst    %f11, ((9 * 8) + (off))(sp); \
196         inst    %f12, ((10 * 8) + (off))(sp); \
197         inst    %f13, ((11 * 8) + (off))(sp); \
198         inst    %f14, ((12 * 8) + (off))(sp); \
199         inst    %f15, ((13 * 8) + (off))(sp); 
200
201 #define VOLATILE_FLOAT_REGISTERS_SIZE (14 * 8)
202
203 #define LOAD_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(ld, off)
204 #define STORE_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(std, off)
205
206 /* Volatile integer registers (all volatile in terms of C abi) */
207
208 #define LOAD_STORE_VOLATILE_INTEGER_REGISTERS(instm, inst, off) \
209         instm   %r0, %r5, ((0 * 4) + (off))(sp); \
210         inst    %r14, ((6 * 4) + (off))(sp);
211
212 #define VOLATILE_INTEGER_REGISTERS_SIZE (7 * 4)
213
214 #define LOAD_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(lm, l, off)
215 #define STORE_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(stm, st, off)
216
217 /* Argument registers (in terms of JAVA an C abi) */
218
219 #define ARGUMENT_REGISTERS_SIZE ((5 * 4) + (2 * 8))
220
221 #define LOAD_STORE_ARGUMENT_REGISTERS(iinst, finst, off) \
222         iinst %r2, %r6, (off)(sp) ; \
223         finst %f0, (off +  (5 * 4))(sp) ; \
224         finst %f2, (off + (5 * 4) + 8)(sp)
225
226 #define STORE_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(stm, std, off)
227 #define LOAD_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(lm, ld, off)
228
229 /* Temporary registers (in terms of JAVA abi) */
230
231 #define TEMPORARY_REGISTERS_SIZE ((1 * 4) + (12 * 8))
232
233 #define LOAD_STORE_TEMPORARY_REGISTERS(iinst, finst, off) \
234         finst    %f1, ((0 * 8) + (off))(sp); \
235         finst    %f3, ((1 * 8) + (off))(sp); \
236         finst    %f5, ((2 * 8) + (off))(sp); \
237         finst    %f7, ((3 * 8) + (off))(sp); \
238         finst    %f8, ((4 * 8) + (off))(sp); \
239         finst    %f9, ((5 * 8) + (off))(sp); \
240         finst    %f10, ((6 * 8) + (off))(sp); \
241         finst    %f11, ((7 * 8) + (off))(sp); \
242         finst    %f12, ((8 * 8) + (off))(sp); \
243         finst    %f13, ((9 * 8) + (off))(sp); \
244         finst    %f14, ((10 * 8) + (off))(sp); \
245         finst    %f15, ((11 * 8) + (off))(sp); \
246         iinst    %r0, ((12 * 8) + (off))(sp);
247
248 #define LOAD_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(l, ld, off)
249 #define STORE_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(st, sd, off)
250
251 #endif /* _MD_ASM_H */
252
253
254 /*
255  * These are local overrides for various environment variables in Emacs.
256  * Please do not remove this and leave it at the end of the file, where
257  * Emacs will automagically detect them.
258  * ---------------------------------------------------------------------
259  * Local variables:
260  * mode: c
261  * indent-tabs-mode: t
262  * c-basic-offset: 4
263  * tab-width: 4
264  * End:
265  */