* Removed all Id tags.
[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 */
32
33
34 #ifndef _MD_ASM_H
35 #define _MD_ASM_H
36
37 /* register defines ***********************************************************/
38
39 #define a0       %r2
40 #define a1       %r3
41 #define a2       %r4
42 #define a3       %r5
43 #define a4       %r6
44
45 #define sp       %r15
46 #define itmp1    %r1
47 #define itmp2    %r12
48 #define itmp3    %r14
49 #define v0       %r2
50 #define pv       %r13
51 #define ra       %r14
52
53 #define mptr     itmp2
54 #define xptr     itmp1
55 #define xpc      itmp2
56
57 #define s0 %r7
58 #define s1 %r8
59 #define s2 %r9
60 #define s3 %r10
61 #define s4 %r11
62
63 #define fa0 %f0
64 #define fa1 %f2
65
66 /* save and restore macros ****************************************************/
67
68 /* Volatile float registers (all volatile in terms of C abi) */
69
70 #define LOAD_STORE_VOLATILE_FLOAT_REGISTERS(inst, off) \
71         inst    %f0, ((0 * 8) + (off))(sp); \
72         inst    %f2, ((1 * 8) + (off))(sp); \
73         inst    %f1, ((2 * 8) + (off))(sp); \
74         inst    %f3, ((3 * 8) + (off))(sp); \
75         inst    %f5, ((4 * 8) + (off))(sp); \
76         inst    %f7, ((5 * 8) + (off))(sp); \
77         inst    %f8, ((6 * 8) + (off))(sp); \
78         inst    %f9, ((7 * 8) + (off))(sp); \
79         inst    %f10, ((8 * 8) + (off))(sp); \
80         inst    %f11, ((9 * 8) + (off))(sp); \
81         inst    %f12, ((10 * 8) + (off))(sp); \
82         inst    %f13, ((11 * 8) + (off))(sp); \
83         inst    %f14, ((12 * 8) + (off))(sp); \
84         inst    %f15, ((13 * 8) + (off))(sp); 
85
86 #define VOLATILE_FLOAT_REGISTERS_SIZE (14 * 8)
87
88 #define LOAD_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(ld, off)
89 #define STORE_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(std, off)
90
91 /* Volatile integer registers (all volatile in terms of C abi) */
92
93 #define LOAD_STORE_VOLATILE_INTEGER_REGISTERS(instm, inst, off) \
94         instm   %r0, %r5, ((0 * 4) + (off))(sp); \
95         inst    %r14, ((6 * 4) + (off))(sp);
96
97 #define VOLATILE_INTEGER_REGISTERS_SIZE (7 * 4)
98
99 #define LOAD_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(lm, l, off)
100 #define STORE_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(stm, st, off)
101
102 /* Argument registers (in terms of JAVA an C abi) */
103
104 #define ARGUMENT_REGISTERS_SIZE ((5 * 4) + (2 * 8))
105
106 #define LOAD_STORE_ARGUMENT_REGISTERS(iinst, finst, off) \
107         iinst %r2, %r6, (off)(sp) ; \
108         finst %f0, (off +  (5 * 4))(sp) ; \
109         finst %f2, (off + (5 * 4) + 8)(sp)
110
111 #define STORE_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(stm, std, off)
112 #define LOAD_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(lm, ld, off)
113
114 /* Temporary registers (in terms of JAVA abi) */
115
116 #define TEMPORARY_REGISTERS_SIZE ((1 * 4) + (12 * 8))
117
118 #define LOAD_STORE_TEMPORARY_REGISTERS(iinst, finst, off) \
119         finst    %f1, ((0 * 8) + (off))(sp); \
120         finst    %f3, ((1 * 8) + (off))(sp); \
121         finst    %f5, ((2 * 8) + (off))(sp); \
122         finst    %f7, ((3 * 8) + (off))(sp); \
123         finst    %f8, ((4 * 8) + (off))(sp); \
124         finst    %f9, ((5 * 8) + (off))(sp); \
125         finst    %f10, ((6 * 8) + (off))(sp); \
126         finst    %f11, ((7 * 8) + (off))(sp); \
127         finst    %f12, ((8 * 8) + (off))(sp); \
128         finst    %f13, ((9 * 8) + (off))(sp); \
129         finst    %f14, ((10 * 8) + (off))(sp); \
130         finst    %f15, ((11 * 8) + (off))(sp); \
131         iinst    %r0, ((12 * 8) + (off))(sp);
132
133 #define LOAD_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(l, ld, off)
134 #define STORE_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(st, std, off)
135
136 #endif /* _MD_ASM_H */
137
138
139 /*
140  * These are local overrides for various environment variables in Emacs.
141  * Please do not remove this and leave it at the end of the file, where
142  * Emacs will automagically detect them.
143  * ---------------------------------------------------------------------
144  * Local variables:
145  * mode: c
146  * indent-tabs-mode: t
147  * c-basic-offset: 4
148  * tab-width: 4
149  * End:
150  */