CACAO
icmd.hpp
Go to the documentation of this file.
1 /* src/vm/jit/ir/icmd.hpp - Intermediate Commands
2 
3  Copyright (C) 2008-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 */
24 
25 
26 #ifndef ICMD_HPP_
27 #define ICMD_HPP_ 1
28 
29 #include "config.h"
30 
31 #include <stdint.h>
32 
33 #include "vm/jit/ir/bytecode.hpp"
34 
35 
36 // JavaVM operation codes (sorted).
37 enum ICMD {
39 
41 
43 
45 
46  /* 3 */
47  /* 4 */
48 
51 
52  /* 7 */
53  /* 8 */
54 
56 
58 
60 
61  /* 12 */
62  /* 13 */
63 
65 
66  ICMD_COPY = 15,
67  ICMD_MOVE = 16,
68 
69  /* 17 */
70  /* 18 */
71  /* 19 */
72  /* 20 */
73 
74  /* Order of LOAD instructions must be equal to order of TYPE_*
75  defines. */
76 
82 
89 
93 
95 
102 
106 
108 
117 
118  /* Order of STORE instructions must be equal to order of TYPE_*
119  defines. */
120 
126 
133 
140 
141  /* 71 */
142  /* 72 */
143  /* 73 */
144  /* 74 */
145  /* 75 */
146  /* 76 */
147  /* 77 */
148  /* 78 */
149 
158 
168 
173 
178 
183 
188 
193 
198 
205 
212 
214 
227 
231 
237 
244 
253 
257 
260 
267 
272 
277 
278  /* 186 */
279 
283 
285 
287 
290 
293 
294  /* 196 */
295 
297 
300 
301  /* 200 */
302  /* 201 */
303 
305 
314 
317 
320 
322  ICMD_PHI = 250,
323 
324  ICMD_INLINE_START = 251, /* instruction before inlined method */
325  ICMD_INLINE_END = 252, /* instruction after inlined method */
326  ICMD_INLINE_BODY = 253, /* start of inlined body */
327 
328  ICMD_BUILTIN = 255 /* internal opcode */
329 };
330 
331 
332 /* data-flow constants for the ICMD table ************************************/
333 
334 #define DF_0_TO_0 0
335 #define DF_1_TO_0 1
336 #define DF_2_TO_0 2
337 #define DF_3_TO_0 3
338 
339 #define DF_DST_BASE 4 /* from this value on, iptr->dst is a variable */
340 
341 #define DF_0_TO_1 (DF_DST_BASE + 0)
342 #define DF_1_TO_1 (DF_DST_BASE + 1)
343 #define DF_2_TO_1 (DF_DST_BASE + 2)
344 #define DF_3_TO_1 (DF_DST_BASE + 3)
345 #define DF_N_TO_1 (DF_DST_BASE + 4)
346 
347 #define DF_INVOKE (DF_DST_BASE + 5)
348 #define DF_BUILTIN (DF_DST_BASE + 6)
349 
350 #define DF_COPY (DF_DST_BASE + 7)
351 #define DF_MOVE (DF_DST_BASE + 8)
352 
353 #define DF_DUP -1
354 #define DF_DUP_X1 -1
355 #define DF_DUP_X2 -1
356 #define DF_DUP2 -1
357 #define DF_DUP2_X1 -1
358 #define DF_DUP2_X2 -1
359 #define DF_SWAP -1
360 
361 /* special data-flow recognized by verify/generate.pl: */
362 #define DF_LOAD DF_COPY
363 #define DF_STORE DF_MOVE
364 #define DF_IINC DF_1_TO_1
365 #define DF_POP DF_1_TO_0
366 #define DF_POP2 DF_2_TO_0
367 
368 
369 // Control-flow constants for the ICMD table.
370 #define CF_NORMAL 0
371 #define CF_IF 1
372 
373 #define CF_END_BASE 2 /* from here on, they mark the end of a superblock */
374 
375 #define CF_END (CF_END_BASE + 0)
376 #define CF_GOTO (CF_END_BASE + 1)
377 #define CF_TABLE (CF_END_BASE + 2)
378 #define CF_LOOKUP (CF_END_BASE + 3)
379 #define CF_JSR (CF_END_BASE + 4)
380 #define CF_RET (CF_END_BASE + 5)
381 
382 
383 // Flag constants for the ICMD table.
384 #define ICMDTABLE_PEI 0x0001 /* ICMD may throw an exception */
385 #define ICMDTABLE_CALLS 0x0002 /* needs registers to be saved, may call */
386 
387 
388 // ICMD table entry.
390 
392 #if !defined(NDEBUG)
393  const char* name; /* name, without ICMD_ prefix */
394 #endif
395  int32_t dataflow; /* a DF_ constant, see above */
396  int32_t controlflow; /* a CF_ constant, see above */
397  int32_t flags; /* a combination of ICMDTABLE_ flags */
398 };
399 
400 
401 // The ICMD table.
402 extern icmdtable_entry_t icmd_table[256];
403 
404 #endif // ICMD_HPP_
405 
406 
407 /*
408  * These are local overrides for various environment variables in Emacs.
409  * Please do not remove this and leave it at the end of the file, where
410  * Emacs will automagically detect them.
411  * ---------------------------------------------------------------------
412  * Local variables:
413  * mode: c++
414  * indent-tabs-mode: t
415  * c-basic-offset: 4
416  * tab-width: 4
417  * End:
418  * vim:noexpandtab:sw=4:ts=4:
419  */
const char * name
Definition: icmd.hpp:393
int32_t dataflow
Definition: icmd.hpp:395
ICMD
Definition: icmd.hpp:37
icmdtable_entry_t icmd_table[256]
Definition: icmd.cpp:60
int32_t controlflow
Definition: icmd.hpp:396
Definition: icmd.hpp:391
int32_t flags
Definition: icmd.hpp:397