0670257c18298daed2983fac42b0a99afde1ec81
[cacao.git] / src / vm / jit / emit.h
1 /* src/vm/jit/emit.h - code emitter functions
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: emitfuncs.c 4398 2006-01-31 23:43:08Z twisti $
32
33 */
34
35
36 #ifndef _EMIT_H
37 #define _EMIT_H
38
39 #include "vm/types.h"
40
41 #include "vm/jit/jit.h"
42
43
44 /* constant range macros ******************************************************/
45
46 #if SIZEOF_VOID_P == 8
47
48 # define IS_IMM8(c) \
49     (((s8) (c) >= -128) && ((s8) (c) <= 127))
50
51 # define IS_IMM32(c) \
52     (((s8) (c) >= (-2147483647-1)) && ((s8) (c) <= 2147483647))
53
54 #else
55
56 # define IS_IMM8(c) \
57     (((s4) (c) >= -128) && ((s4) (c) <= 127))
58
59 #endif
60
61
62 /* code generation functions **************************************************/
63
64 s4 emit_load(jitdata *jd, instruction *iptr, stackptr src, s4 tempreg);
65 s4 emit_load_s1(jitdata *jd, instruction *iptr, s4 tempreg);
66 s4 emit_load_s2(jitdata *jd, instruction *iptr, s4 tempreg);
67 s4 emit_load_s3(jitdata *jd, instruction *iptr, s4 tempreg);
68
69 #if SIZEOF_VOID_P == 4
70 s4 emit_load_s1_low(jitdata *jd, instruction *iptr, s4 tempreg);
71 s4 emit_load_s2_low(jitdata *jd, instruction *iptr, s4 tempreg);
72 s4 emit_load_s3_low(jitdata *jd, instruction *iptr, s4 tempreg);
73
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, stackptr 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, stackptr dst, s4 d);
84 void emit_store_high(jitdata *jd, instruction *iptr, stackptr dst, s4 d);
85 #endif
86
87 void emit_copy(jitdata *jd, instruction *iptr, stackptr src, stackptr 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_exception_stubs(jitdata *jd);
93 void emit_patcher_stubs(jitdata *jd);
94 void emit_replacement_stubs(jitdata *jd);
95
96 void emit_verbosecall_enter(jitdata *jd);
97 void emit_verbosecall_exit(jitdata *jd);
98
99 #endif /* _EMIT_H */
100
101
102 /*
103  * These are local overrides for various environment variables in Emacs.
104  * Please do not remove this and leave it at the end of the file, where
105  * Emacs will automagically detect them.
106  * ---------------------------------------------------------------------
107  * Local variables:
108  * mode: c
109  * indent-tabs-mode: t
110  * c-basic-offset: 4
111  * tab-width: 4
112  * End:
113  * vim:noexpandtab:sw=4:ts=4:
114  */