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