* src/vm/jit/codegen-common.c: Use ENABLE_DISASSEMBLER.
[cacao.git] / src / vm / jit / disass.h
1 /* src/vm/jit/disass.h - disassembler header
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: disass.h 4709 2006-03-30 10:14:22Z twisti $
32
33 */
34
35
36 #ifndef _DISASS_H
37 #define _DISASS_H
38
39 #include "config.h"
40
41 #if defined(WITH_BINUTILS_DISASSEMBLER)
42 # include <dis-asm.h>
43 #endif
44
45 #include "vm/types.h"
46
47 #if defined(ENABLE_DISASSEMBLER)
48
49 /* some macros ****************************************************************/
50
51 #if defined(ENABLE_JIT)
52 # if defined(ENABLE_INTRP)
53
54 #define DISASSINSTR(code) \
55     do { \
56         if (opt_intrp) \
57             (code) = intrp_disassinstr((code)); \
58         else \
59             (code) = disassinstr((code)); \
60     } while (0)
61
62 #define DISASSEMBLE(start,end) \
63     do { \
64         if (opt_intrp) \
65             intrp_disassemble((start), (end)); \
66         else \
67             disassemble((start), (end)); \
68     } while (0)
69
70 # else /* defined(ENABLE_INTRP) */
71
72 #define DISASSINSTR(code) \
73     (code) = disassinstr((code))
74
75 #define DISASSEMBLE(start,end) \
76     disassemble((start), (end))
77
78 # endif /* defined(ENABLE_INTRP) */
79 #else /* defined(ENABLE_JIT) */
80
81 #define DISASSINSTR(code) \
82     (code) = intrp_disassinstr((code))
83
84 #define DISASSEMBLE(start,end) \
85     intrp_disassemble((start), (end))
86
87 #endif /* defined(ENABLE_JIT) */
88
89
90 /* export global variables ****************************************************/
91
92 #if defined(WITH_BINUTILS_DISASSEMBLER)
93 extern disassemble_info info;
94 extern bool disass_initialized;
95 #endif
96
97 extern char *regs[];
98
99 #if defined(__I386__) || defined(__X86_64__)
100 extern char disass_buf[512];
101 extern s4   disass_len;
102 #endif
103
104
105 /* function prototypes *******************************************************/
106
107 #if defined(ENABLE_JIT)
108 void disassemble(u1 *start, u1 *end);
109 #endif
110
111 #if defined(WITH_BINUTILS_DISASSEMBLER)
112 void disass_printf(PTR p, const char *fmt, ...);
113
114 int disass_buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info);
115 #endif
116
117 /* machine dependent functions */
118
119 #if defined(ENABLE_JIT)
120 u1 *disassinstr(u1 *code);
121 #endif
122
123 #if defined(ENABLE_INTRP)
124 u1 *intrp_disassinstr(u1 *code);
125 void intrp_disassemble(u1 *start, u1 *end);
126 #endif
127
128 #endif /* defined(ENABLE_DISASSEMBLER) */
129
130 #endif /* _DISASS_H */
131
132
133 /*
134  * These are local overrides for various environment variables in Emacs.
135  * Please do not remove this and leave it at the end of the file, where
136  * Emacs will automagically detect them.
137  * ---------------------------------------------------------------------
138  * Local variables:
139  * mode: c
140  * indent-tabs-mode: t
141  * c-basic-offset: 4
142  * tab-width: 4
143  * End:
144  */