CACAO
md-asm.hpp
Go to the documentation of this file.
1 /* src/vm/jit/x86_64/md-asm.hpp - assembler defines for s390 Linux ABI
2 
3  Copyright (C) 1996-2013
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 
23  Contact: cacao@cacaojvm.org
24 */
25 
26 
27 #ifndef _MD_ASM_H
28 #define _MD_ASM_H
29 
30 /* register defines ***********************************************************/
31 
32 #define a0 %r2
33 #define a1 %r3
34 #define a2 %r4
35 #define a3 %r5
36 #define a4 %r6
37 
38 #define sp %r15
39 #define itmp1 %r1
40 #define itmp2 %r14
41 #define itmp3 %r0
42 #define v0 %r2
43 #define pv %r13
44 #define ra %r14
45 
46 #define mptr itmp1
47 #define xptr itmp3
48 #define xpc itmp1
49 
50 #define s0 %r7
51 #define s1 %r8
52 #define s2 %r9
53 #define s3 %r10
54 #define s4 %r11
55 #define s5 %r12
56 
57 #define fa0 %f0
58 #define fa1 %f2
59 #define ftmp1 %r4
60 #define ftmp2 %r6
61 
62 /* save and restore macros ****************************************************/
63 
64 /* Volatile float registers (all volatile in terms of C abi) */
65 
66 #define LOAD_STORE_VOLATILE_FLOAT_REGISTERS(inst, off) \
67  inst %f0, ((0 * 8) + (off))(sp); \
68  inst %f2, ((1 * 8) + (off))(sp); \
69  inst %f1, ((2 * 8) + (off))(sp); \
70  inst %f3, ((3 * 8) + (off))(sp); \
71  inst %f5, ((4 * 8) + (off))(sp); \
72  inst %f7, ((5 * 8) + (off))(sp); \
73  inst %f8, ((6 * 8) + (off))(sp); \
74  inst %f9, ((7 * 8) + (off))(sp); \
75  inst %f10, ((8 * 8) + (off))(sp); \
76  inst %f11, ((9 * 8) + (off))(sp); \
77  inst %f12, ((10 * 8) + (off))(sp); \
78  inst %f13, ((11 * 8) + (off))(sp); \
79  inst %f14, ((12 * 8) + (off))(sp); \
80  inst %f15, ((13 * 8) + (off))(sp);
81 
82 #define VOLATILE_FLOAT_REGISTERS_SIZE (14 * 8)
83 
84 #define LOAD_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(ld, off)
85 #define STORE_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(std, off)
86 
87 /* Volatile integer registers (all volatile in terms of C abi) */
88 
89 #define LOAD_STORE_VOLATILE_INTEGER_REGISTERS(instm, inst, off) \
90  instm %r0, %r5, ((0 * 4) + (off))(sp); \
91  inst %r14, ((6 * 4) + (off))(sp);
92 
93 #define VOLATILE_INTEGER_REGISTERS_SIZE (7 * 4)
94 
95 #define LOAD_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(lm, l, off)
96 #define STORE_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(stm, st, off)
97 
98 /* Argument registers (in terms of JAVA an C abi) */
99 
100 #define ARGUMENT_REGISTERS_SIZE ((5 * 4) + (2 * 8))
101 
102 #define LOAD_STORE_ARGUMENT_REGISTERS(iinst, finst, off) \
103  iinst %r2, %r6, (off)(sp) ; \
104  finst %f0, (off + (5 * 4))(sp) ; \
105  finst %f2, (off + (5 * 4) + 8)(sp)
106 
107 #define STORE_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(stm, std, off)
108 #define LOAD_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(lm, ld, off)
109 
110 /* Temporary registers (in terms of JAVA abi) */
111 
112 #define TEMPORARY_REGISTERS_SIZE ((1 * 4) + (12 * 8))
113 
114 #define LOAD_STORE_TEMPORARY_REGISTERS(iinst, finst, off) \
115  finst %f1, ((0 * 8) + (off))(sp); \
116  finst %f3, ((1 * 8) + (off))(sp); \
117  finst %f5, ((2 * 8) + (off))(sp); \
118  finst %f7, ((3 * 8) + (off))(sp); \
119  finst %f8, ((4 * 8) + (off))(sp); \
120  finst %f9, ((5 * 8) + (off))(sp); \
121  finst %f10, ((6 * 8) + (off))(sp); \
122  finst %f11, ((7 * 8) + (off))(sp); \
123  finst %f12, ((8 * 8) + (off))(sp); \
124  finst %f13, ((9 * 8) + (off))(sp); \
125  finst %f14, ((10 * 8) + (off))(sp); \
126  finst %f15, ((11 * 8) + (off))(sp); \
127  iinst %r0, ((12 * 8) + (off))(sp);
128 
129 #define LOAD_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(l, ld, off)
130 #define STORE_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(st, std, off)
131 
132 #endif /* _MD_ASM_H */
133 
134 
135 /*
136  * These are local overrides for various environment variables in Emacs.
137  * Please do not remove this and leave it at the end of the file, where
138  * Emacs will automagically detect them.
139  * ---------------------------------------------------------------------
140  * Local variables:
141  * mode: c++
142  * indent-tabs-mode: t
143  * c-basic-offset: 4
144  * tab-width: 4
145  * End:
146  * vim:noexpandtab:sw=4:ts=4:
147  */