VirtualBox

source: vbox/trunk/src/recompiler/tcg/tcg-opc.h@ 29715

Last change on this file since 29715 was 29520, checked in by vboxsync, 15 years ago

fix wrong license headers

  • Property svn:eol-style set to native
File size: 7.5 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#ifdef CONFIG_DYNGEN_OP
26#include "dyngen-opc.h"
27#endif
28
29#ifndef DEF2
30#define DEF2(name, oargs, iargs, cargs, flags) DEF(name, oargs + iargs + cargs, 0)
31#endif
32
33/* predefined ops */
34DEF2(end, 0, 0, 0, 0) /* must be kept first */
35DEF2(nop, 0, 0, 0, 0)
36DEF2(nop1, 0, 0, 1, 0)
37DEF2(nop2, 0, 0, 2, 0)
38DEF2(nop3, 0, 0, 3, 0)
39DEF2(nopn, 0, 0, 1, 0) /* variable number of parameters */
40
41DEF2(discard, 1, 0, 0, 0)
42
43DEF2(set_label, 0, 0, 1, 0)
44DEF2(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */
45DEF2(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
46DEF2(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
47
48DEF2(mov_i32, 1, 1, 0, 0)
49DEF2(movi_i32, 1, 0, 1, 0)
50/* load/store */
51DEF2(ld8u_i32, 1, 1, 1, 0)
52DEF2(ld8s_i32, 1, 1, 1, 0)
53DEF2(ld16u_i32, 1, 1, 1, 0)
54DEF2(ld16s_i32, 1, 1, 1, 0)
55DEF2(ld_i32, 1, 1, 1, 0)
56DEF2(st8_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
57DEF2(st16_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
58DEF2(st_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
59/* arith */
60DEF2(add_i32, 1, 2, 0, 0)
61DEF2(sub_i32, 1, 2, 0, 0)
62DEF2(mul_i32, 1, 2, 0, 0)
63#ifdef TCG_TARGET_HAS_div_i32
64DEF2(div_i32, 1, 2, 0, 0)
65DEF2(divu_i32, 1, 2, 0, 0)
66DEF2(rem_i32, 1, 2, 0, 0)
67DEF2(remu_i32, 1, 2, 0, 0)
68#else
69DEF2(div2_i32, 2, 3, 0, 0)
70DEF2(divu2_i32, 2, 3, 0, 0)
71#endif
72DEF2(and_i32, 1, 2, 0, 0)
73DEF2(or_i32, 1, 2, 0, 0)
74DEF2(xor_i32, 1, 2, 0, 0)
75/* shifts */
76DEF2(shl_i32, 1, 2, 0, 0)
77DEF2(shr_i32, 1, 2, 0, 0)
78DEF2(sar_i32, 1, 2, 0, 0)
79
80DEF2(brcond_i32, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
81#if TCG_TARGET_REG_BITS == 32
82DEF2(add2_i32, 2, 4, 0, 0)
83DEF2(sub2_i32, 2, 4, 0, 0)
84DEF2(brcond2_i32, 0, 4, 2, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
85DEF2(mulu2_i32, 2, 2, 0, 0)
86#endif
87#ifdef TCG_TARGET_HAS_ext8s_i32
88DEF2(ext8s_i32, 1, 1, 0, 0)
89#endif
90#ifdef TCG_TARGET_HAS_ext16s_i32
91DEF2(ext16s_i32, 1, 1, 0, 0)
92#endif
93#ifdef TCG_TARGET_HAS_bswap_i32
94DEF2(bswap_i32, 1, 1, 0, 0)
95#endif
96
97#if TCG_TARGET_REG_BITS == 64
98DEF2(mov_i64, 1, 1, 0, 0)
99DEF2(movi_i64, 1, 0, 1, 0)
100/* load/store */
101DEF2(ld8u_i64, 1, 1, 1, 0)
102DEF2(ld8s_i64, 1, 1, 1, 0)
103DEF2(ld16u_i64, 1, 1, 1, 0)
104DEF2(ld16s_i64, 1, 1, 1, 0)
105DEF2(ld32u_i64, 1, 1, 1, 0)
106DEF2(ld32s_i64, 1, 1, 1, 0)
107DEF2(ld_i64, 1, 1, 1, 0)
108DEF2(st8_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
109DEF2(st16_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
110DEF2(st32_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
111DEF2(st_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS)
112/* arith */
113DEF2(add_i64, 1, 2, 0, 0)
114DEF2(sub_i64, 1, 2, 0, 0)
115DEF2(mul_i64, 1, 2, 0, 0)
116#ifdef TCG_TARGET_HAS_div_i64
117DEF2(div_i64, 1, 2, 0, 0)
118DEF2(divu_i64, 1, 2, 0, 0)
119DEF2(rem_i64, 1, 2, 0, 0)
120DEF2(remu_i64, 1, 2, 0, 0)
121#else
122DEF2(div2_i64, 2, 3, 0, 0)
123DEF2(divu2_i64, 2, 3, 0, 0)
124#endif
125DEF2(and_i64, 1, 2, 0, 0)
126DEF2(or_i64, 1, 2, 0, 0)
127DEF2(xor_i64, 1, 2, 0, 0)
128/* shifts */
129DEF2(shl_i64, 1, 2, 0, 0)
130DEF2(shr_i64, 1, 2, 0, 0)
131DEF2(sar_i64, 1, 2, 0, 0)
132
133DEF2(brcond_i64, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
134#ifdef TCG_TARGET_HAS_ext8s_i64
135DEF2(ext8s_i64, 1, 1, 0, 0)
136#endif
137#ifdef TCG_TARGET_HAS_ext16s_i64
138DEF2(ext16s_i64, 1, 1, 0, 0)
139#endif
140#ifdef TCG_TARGET_HAS_ext32s_i64
141DEF2(ext32s_i64, 1, 1, 0, 0)
142#endif
143#ifdef TCG_TARGET_HAS_bswap_i64
144DEF2(bswap_i64, 1, 1, 0, 0)
145#endif
146#endif
147#ifdef TCG_TARGET_HAS_neg_i32
148DEF2(neg_i32, 1, 1, 0, 0)
149#endif
150#ifdef TCG_TARGET_HAS_neg_i64
151DEF2(neg_i64, 1, 1, 0, 0)
152#endif
153
154/* QEMU specific */
155#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
156DEF2(debug_insn_start, 0, 0, 2, 0)
157#else
158DEF2(debug_insn_start, 0, 0, 1, 0)
159#endif
160DEF2(exit_tb, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
161DEF2(goto_tb, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
162/* Note: even if TARGET_LONG_BITS is not defined, the INDEX_op
163 constants must be defined */
164#if TCG_TARGET_REG_BITS == 32
165#if TARGET_LONG_BITS == 32
166DEF2(qemu_ld8u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
167#else
168DEF2(qemu_ld8u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
169#endif
170#if TARGET_LONG_BITS == 32
171DEF2(qemu_ld8s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
172#else
173DEF2(qemu_ld8s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
174#endif
175#if TARGET_LONG_BITS == 32
176DEF2(qemu_ld16u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
177#else
178DEF2(qemu_ld16u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
179#endif
180#if TARGET_LONG_BITS == 32
181DEF2(qemu_ld16s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
182#else
183DEF2(qemu_ld16s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
184#endif
185#if TARGET_LONG_BITS == 32
186DEF2(qemu_ld32u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
187#else
188DEF2(qemu_ld32u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
189#endif
190#if TARGET_LONG_BITS == 32
191DEF2(qemu_ld32s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
192#else
193DEF2(qemu_ld32s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
194#endif
195#if TARGET_LONG_BITS == 32
196DEF2(qemu_ld64, 2, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
197#else
198DEF2(qemu_ld64, 2, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
199#endif
200
201#if TARGET_LONG_BITS == 32
202DEF2(qemu_st8, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
203#else
204DEF2(qemu_st8, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
205#endif
206#if TARGET_LONG_BITS == 32
207DEF2(qemu_st16, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
208#else
209DEF2(qemu_st16, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
210#endif
211#if TARGET_LONG_BITS == 32
212DEF2(qemu_st32, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
213#else
214DEF2(qemu_st32, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
215#endif
216#if TARGET_LONG_BITS == 32
217DEF2(qemu_st64, 0, 3, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
218#else
219DEF2(qemu_st64, 0, 4, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
220#endif
221
222#else /* TCG_TARGET_REG_BITS == 32 */
223
224DEF2(qemu_ld8u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
225DEF2(qemu_ld8s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
226DEF2(qemu_ld16u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
227DEF2(qemu_ld16s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
228DEF2(qemu_ld32u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
229DEF2(qemu_ld32s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
230DEF2(qemu_ld64, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
231
232DEF2(qemu_st8, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
233DEF2(qemu_st16, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
234DEF2(qemu_st32, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
235DEF2(qemu_st64, 0, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)
236
237#endif /* TCG_TARGET_REG_BITS != 32 */
238
239#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