VirtualBox

source: vbox/trunk/src/recompiler_new/tcg/tcg-opc.h@ 18093

Last change on this file since 18093 was 18083, checked in by vboxsync, 16 years ago

eol

  • Property svn:eol-style set to native
File size: 8.0 KB
Line 
1/*
2 * Tiny Code Generator for QEMU
3 *
4 * Copyright (c) 2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24/*
25 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
26 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
27 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
28 * a choice of LGPL license versions is made available with the language indicating
29 * that LGPLv2 or any later version may be used, or where a choice of which version
30 * of the LGPL is applied is otherwise unspecified.
31 */
32#ifdef CONFIG_DYNGEN_OP
33#include "dyngen-opc.h"
34#endif
35
36#ifndef DEF2
37#define DEF2(name, oargs, iargs, cargs, flags) DEF(name, oargs + iargs + cargs, 0)
38#endif
39
40/* predefined ops */
41DEF2(end, 0, 0, 0, 0) /* must be kept first */
42DEF2(nop, 0, 0, 0, 0)
43DEF2(nop1, 0, 0, 1, 0)
44DEF2(nop2, 0, 0, 2, 0)
45DEF2(nop3, 0, 0, 3, 0)
46DEF2(nopn, 0, 0, 1, 0) /* variable number of parameters */
47
48DEF2(discard, 1, 0, 0, 0)
49
50DEF2(set_label, 0, 0, 1, 0)
51DEF2(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */
52DEF2(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
53DEF2(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
54
55DEF2(mov_i32, 1, 1, 0, 0)
56DEF2(movi_i32, 1, 0, 1, 0)
57/* load/store */
58DEF2(ld8u_i32, 1, 1, 1, 0)
59DEF2(ld8s_i32, 1, 1, 1, 0)
60DEF2(ld16u_i32, 1, 1, 1, 0)
61DEF2(ld16s_i32, 1, 1, 1, 0)
62DEF2(ld_i32, 1, 1, 1, 0)
63DEF2(st8_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
64DEF2(st16_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
65DEF2(st_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
66/* arith */
67DEF2(add_i32, 1, 2, 0, 0)
68DEF2(sub_i32, 1, 2, 0, 0)
69DEF2(mul_i32, 1, 2, 0, 0)
70#ifdef TCG_TARGET_HAS_div_i32
71DEF2(div_i32, 1, 2, 0, 0)
72DEF2(divu_i32, 1, 2, 0, 0)
73DEF2(rem_i32, 1, 2, 0, 0)
74DEF2(remu_i32, 1, 2, 0, 0)
75#else
76DEF2(div2_i32, 2, 3, 0, 0)
77DEF2(divu2_i32, 2, 3, 0, 0)
78#endif
79DEF2(and_i32, 1, 2, 0, 0)
80DEF2(or_i32, 1, 2, 0, 0)
81DEF2(xor_i32, 1, 2, 0, 0)
82/* shifts */
83DEF2(shl_i32, 1, 2, 0, 0)
84DEF2(shr_i32, 1, 2, 0, 0)
85DEF2(sar_i32, 1, 2, 0, 0)
86
87DEF2(brcond_i32, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
88#if TCG_TARGET_REG_BITS == 32
89DEF2(add2_i32, 2, 4, 0, 0)
90DEF2(sub2_i32, 2, 4, 0, 0)
91DEF2(brcond2_i32, 0, 4, 2, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
92DEF2(mulu2_i32, 2, 2, 0, 0)
93#endif
94#ifdef TCG_TARGET_HAS_ext8s_i32
95DEF2(ext8s_i32, 1, 1, 0, 0)
96#endif
97#ifdef TCG_TARGET_HAS_ext16s_i32
98DEF2(ext16s_i32, 1, 1, 0, 0)
99#endif
100#ifdef TCG_TARGET_HAS_bswap_i32
101DEF2(bswap_i32, 1, 1, 0, 0)
102#endif
103
104#if TCG_TARGET_REG_BITS == 64
105DEF2(mov_i64, 1, 1, 0, 0)
106DEF2(movi_i64, 1, 0, 1, 0)
107/* load/store */
108DEF2(ld8u_i64, 1, 1, 1, 0)
109DEF2(ld8s_i64, 1, 1, 1, 0)
110DEF2(ld16u_i64, 1, 1, 1, 0)
111DEF2(ld16s_i64, 1, 1, 1, 0)
112DEF2(ld32u_i64, 1, 1, 1, 0)
113DEF2(ld32s_i64, 1, 1, 1, 0)
114DEF2(ld_i64, 1, 1, 1, 0)
115DEF2(st8_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
116DEF2(st16_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
117DEF2(st32_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
118DEF2(st_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
119/* arith */
120DEF2(add_i64, 1, 2, 0, 0)
121DEF2(sub_i64, 1, 2, 0, 0)
122DEF2(mul_i64, 1, 2, 0, 0)
123#ifdef TCG_TARGET_HAS_div_i64
124DEF2(div_i64, 1, 2, 0, 0)
125DEF2(divu_i64, 1, 2, 0, 0)
126DEF2(rem_i64, 1, 2, 0, 0)
127DEF2(remu_i64, 1, 2, 0, 0)
128#else
129DEF2(div2_i64, 2, 3, 0, 0)
130DEF2(divu2_i64, 2, 3, 0, 0)
131#endif
132DEF2(and_i64, 1, 2, 0, 0)
133DEF2(or_i64, 1, 2, 0, 0)
134DEF2(xor_i64, 1, 2, 0, 0)
135/* shifts */
136DEF2(shl_i64, 1, 2, 0, 0)
137DEF2(shr_i64, 1, 2, 0, 0)
138DEF2(sar_i64, 1, 2, 0, 0)
139
140DEF2(brcond_i64, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
141#ifdef TCG_TARGET_HAS_ext8s_i64
142DEF2(ext8s_i64, 1, 1, 0, 0)
143#endif
144#ifdef TCG_TARGET_HAS_ext16s_i64
145DEF2(ext16s_i64, 1, 1, 0, 0)
146#endif
147#ifdef TCG_TARGET_HAS_ext32s_i64
148DEF2(ext32s_i64, 1, 1, 0, 0)
149#endif
150#ifdef TCG_TARGET_HAS_bswap_i64
151DEF2(bswap_i64, 1, 1, 0, 0)
152#endif
153#endif
154#ifdef TCG_TARGET_HAS_neg_i32
155DEF2(neg_i32, 1, 1, 0, 0)
156#endif
157#ifdef TCG_TARGET_HAS_neg_i64
158DEF2(neg_i64, 1, 1, 0, 0)
159#endif
160
161/* QEMU specific */
162#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
163DEF2(debug_insn_start, 0, 0, 2, 0)
164#else
165DEF2(debug_insn_start, 0, 0, 1, 0)
166#endif
167DEF2(exit_tb, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
168DEF2(goto_tb, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
169/* Note: even if TARGET_LONG_BITS is not defined, the INDEX_op
170 constants must be defined */
171#if TCG_TARGET_REG_BITS == 32
172#if TARGET_LONG_BITS == 32
173DEF2(qemu_ld8u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
174#else
175DEF2(qemu_ld8u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
176#endif
177#if TARGET_LONG_BITS == 32
178DEF2(qemu_ld8s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
179#else
180DEF2(qemu_ld8s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
181#endif
182#if TARGET_LONG_BITS == 32
183DEF2(qemu_ld16u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
184#else
185DEF2(qemu_ld16u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
186#endif
187#if TARGET_LONG_BITS == 32
188DEF2(qemu_ld16s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
189#else
190DEF2(qemu_ld16s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
191#endif
192#if TARGET_LONG_BITS == 32
193DEF2(qemu_ld32u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
194#else
195DEF2(qemu_ld32u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
196#endif
197#if TARGET_LONG_BITS == 32
198DEF2(qemu_ld32s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
199#else
200DEF2(qemu_ld32s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
201#endif
202#if TARGET_LONG_BITS == 32
203DEF2(qemu_ld64, 2, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
204#else
205DEF2(qemu_ld64, 2, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
206#endif
207
208#if TARGET_LONG_BITS == 32
209DEF2(qemu_st8, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
210#else
211DEF2(qemu_st8, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
212#endif
213#if TARGET_LONG_BITS == 32
214DEF2(qemu_st16, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
215#else
216DEF2(qemu_st16, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
217#endif
218#if TARGET_LONG_BITS == 32
219DEF2(qemu_st32, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
220#else
221DEF2(qemu_st32, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
222#endif
223#if TARGET_LONG_BITS == 32
224DEF2(qemu_st64, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
225#else
226DEF2(qemu_st64, 0, 4, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
227#endif
228
229#else /* TCG_TARGET_REG_BITS == 32 */
230
231DEF2(qemu_ld8u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
232DEF2(qemu_ld8s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
233DEF2(qemu_ld16u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
234DEF2(qemu_ld16s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
235DEF2(qemu_ld32u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
236DEF2(qemu_ld32s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
237DEF2(qemu_ld64, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
238
239DEF2(qemu_st8, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
240DEF2(qemu_st16, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
241DEF2(qemu_st32, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
242DEF2(qemu_st64, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
243
244#endif /* TCG_TARGET_REG_BITS != 32 */
245
246#undef DEF2
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette