* src/vm/jit/powerpc/emit.c (vm/options.h): Added.
[cacao.git] / src / vm / jit / emit-common.h
1 /* src/vm/jit/emit-common.h - common code emitter functions
2
3    Copyright (C) 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    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    $Id: emitfuncs.c 4398 2006-01-31 23:43:08Z twisti $
30
31 */
32
33
34 #ifndef _EMIT_H
35 #define _EMIT_H
36
37 #include "vm/types.h"
38
39 #include "vm/jit/jit.h"
40
41
42 /* constant range macros ******************************************************/
43
44 #if SIZEOF_VOID_P == 8
45
46 # define IS_IMM8(c) \
47     (((s8) (c) >= -128) && ((s8) (c) <= 127))
48
49 # define IS_IMM32(c) \
50     (((s8) (c) >= (-2147483647-1)) && ((s8) (c) <= 2147483647))
51
52 #else
53
54 # define IS_IMM8(c) \
55     (((s4) (c) >= -128) && ((s4) (c) <= 127))
56
57 #endif
58
59
60 /* code generation functions **************************************************/
61
62 s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg);
63 s4 emit_load_s1(jitdata *jd, instruction *iptr, s4 tempreg);
64 s4 emit_load_s2(jitdata *jd, instruction *iptr, s4 tempreg);
65 s4 emit_load_s3(jitdata *jd, instruction *iptr, s4 tempreg);
66
67 #if SIZEOF_VOID_P == 4
68 s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg);
69 s4 emit_load_s1_low(jitdata *jd, instruction *iptr, s4 tempreg);
70 s4 emit_load_s2_low(jitdata *jd, instruction *iptr, s4 tempreg);
71 s4 emit_load_s3_low(jitdata *jd, instruction *iptr, s4 tempreg);
72
73 s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg);
74 s4 emit_load_s1_high(jitdata *jd, instruction *iptr, s4 tempreg);
75 s4 emit_load_s2_high(jitdata *jd, instruction *iptr, s4 tempreg);
76 s4 emit_load_s3_high(jitdata *jd, instruction *iptr, s4 tempreg);
77 #endif
78
79 void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d);
80 void emit_store_dst(jitdata *jd, instruction *iptr, s4 d);
81
82 #if SIZEOF_VOID_P == 4
83 void emit_store_low(jitdata *jd, instruction *iptr, varinfo *dst, s4 d);
84 void emit_store_high(jitdata *jd, instruction *iptr, varinfo *dst, s4 d);
85 #endif
86
87 void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst);
88
89 void emit_iconst(codegendata *cd, s4 d, s4 value);
90 void emit_lconst(codegendata *cd, s4 d, s8 value);
91
92 void emit_arithmetic_check(codegendata *cd, s4 reg);
93 void emit_arrayindexoutofbounds_check(codegendata *cd, s4 s1, s4 s2);
94 void emit_arraystore_check(codegendata *cd, s4 reg);
95 void emit_classcast_check(codegendata *cd, s4 condition, s4 reg, s4 s1);
96 void emit_nullpointer_check(codegendata *cd, s4 reg);
97 void emit_exception_check(codegendata *cd);
98
99 void emit_array_checks(codegendata *cd, instruction *iptr, s4 s1, s4 s2);
100
101 void emit_exception_stubs(jitdata *jd);
102 void emit_patcher_stubs(jitdata *jd);
103 void emit_replacement_stubs(jitdata *jd);
104
105 void emit_verbosecall_enter(jitdata *jd);
106 void emit_verbosecall_exit(jitdata *jd);
107
108 #endif /* _EMIT_H */
109
110
111 /*
112  * These are local overrides for various environment variables in Emacs.
113  * Please do not remove this and leave it at the end of the file, where
114  * Emacs will automagically detect them.
115  * ---------------------------------------------------------------------
116  * Local variables:
117  * mode: c
118  * indent-tabs-mode: t
119  * c-basic-offset: 4
120  * tab-width: 4
121  * End:
122  * vim:noexpandtab:sw=4:ts=4:
123  */