1d43e36c67731d2be969848b503a50a2370b495d
[cacao.git] / src / vm / jit / arm / md-asm.h
1 /* src/vm/jit/arm/md-asm.h - assembler defines for arm ABI
2
3    Copyright (C) 1996-2005, 2006, 2007 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: Michael Starzinger
28             Christian Thalinger
29
30    $Id: md-asm.h 7227 2007-01-18 13:21:36Z twisti $
31
32 */
33
34
35 #ifndef _MD_ASM_H
36 #define _MD_ASM_H
37
38 #include "config.h"
39
40
41 /* register defines ***********************************************************/
42
43 #define res1    r0  /* result registers         */
44 #define res2    r1
45
46 #define a0      r0  /* argument registers       */
47 #define a1      r1
48 #define a2      r2
49 #define a3      r3
50
51 #define v1      r4  /* variable registers       */
52 #define v2      r5
53 #define v3      r6
54 #define v4      r7
55 #define v5      r8
56 #define v6      r9
57 #define v7      r10
58 #define v8      r11
59
60 #define pc      r15 /* program counter          */
61 #define lr      r14 /* return address           */
62 #define sp      r13 /* stack pointer            */
63 #define ip      r12 /* something like pv        */
64 #define fp      r11 /* frame pointer (not used) */
65
66 #define itmp1   v7  /* temporary scratch regs   */
67 #define itmp2   v8
68 #define itmp3   v6
69
70 #define mptr    v8
71
72 #define xptr  itmp1 /* exception registers      */
73 #define xpc   itmp2
74
75
76 /* save and restore macros ****************************************************/
77
78 #define SAVE_ARGUMENT_REGISTERS \
79         stmfd   sp!, {a0,a1,a2,a3,lr}
80
81 #define SAVE_ARGUMENT_REGISTERS_IP \
82         stmfd   sp!, {a0,a1,a2,a3,ip,lr}
83
84 #if defined(ENABLE_SOFTFLOAT)
85 # define SAVE_FLOAT_REGISTERS
86 #else
87 # define SAVE_FLOAT_REGISTERS \
88         sfmfd   f0, 4, [sp]!; \
89         sfmfd   f4, 4, [sp]!
90 #endif
91
92 #define SAVE_SCRATCH_REGISTERS \
93         stmfd   sp!, {itmp3,itmp1,itmp2,lr}
94
95
96 #define RESTORE_ARGUMENT_REGISTERS \
97         ldmfd   sp!, {a0,a1,a2,a3,lr}
98
99 #define RESTORE_ARGUMENT_REGISTERS_IP \
100         ldmfd   sp!, {a0,a1,a2,a3,ip,lr}
101
102 #if defined(ENABLE_SOFTFLOAT)
103 # define RESTORE_FLOAT_REGISTERS
104 #else
105 # define RESTORE_FLOAT_REGISTERS \
106         lfmfd   f4, 4, [sp]!; \
107         lfmfd   f0, 4, [sp]!
108 #endif
109
110 #define RESTORE_SCRATCH_REGS_AND_RETURN \
111         ldmfd   sp!, {itmp3,itmp1,itmp2,pc}
112
113 #endif /* _MD_ASM_H */
114
115
116 /*
117  * These are local overrides for various environment variables in Emacs.
118  * Please do not remove this and leave it at the end of the file, where
119  * Emacs will automagically detect them.
120  * ---------------------------------------------------------------------
121  * Local variables:
122  * mode: c
123  * indent-tabs-mode: t
124  * c-basic-offset: 4
125  * tab-width: 4
126  * End:
127  * vim:noexpandtab:sw=4:ts=4:
128  */