VirtualBox

source: vbox/trunk/src/recompiler_new/gen-icount.h@ 18661

最後變更 在這個檔案從18661是 17040,由 vboxsync 提交於 16 年 前

recompiler_new: svn properties.

  • 屬性 svn:eol-style 設為 native
檔案大小: 1.7 KB
 
1/* Helpers for instruction counting code generation. */
2
3static TCGArg *icount_arg;
4static int icount_label;
5
6#ifndef VBOX
7static inline void gen_icount_start(void)
8#else /* VBOX */
9DECLINLINE(void) gen_icount_start(void)
10#endif /* VBOX */
11{
12 TCGv count;
13
14 if (!use_icount)
15 return;
16
17 icount_label = gen_new_label();
18 /* FIXME: This generates lousy code. We can't use tcg_new_temp because
19 count needs to live over the conditional branch. To workaround this
20 we allow the target to supply a convenient register temporary. */
21#ifndef ICOUNT_TEMP
22 count = tcg_temp_local_new(TCG_TYPE_I32);
23#else
24 count = ICOUNT_TEMP;
25#endif
26 tcg_gen_ld_i32(count, cpu_env, offsetof(CPUState, icount_decr.u32));
27 /* This is a horrid hack to allow fixing up the value later. */
28 icount_arg = gen_opparam_ptr + 1;
29 tcg_gen_subi_i32(count, count, 0xdeadbeef);
30
31 tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label);
32 tcg_gen_st16_i32(count, cpu_env, offsetof(CPUState, icount_decr.u16.low));
33#ifndef ICOUNT_TEMP
34 tcg_temp_free(count);
35#endif
36}
37
38static void gen_icount_end(TranslationBlock *tb, int num_insns)
39{
40 if (use_icount) {
41 *icount_arg = num_insns;
42 gen_set_label(icount_label);
43 tcg_gen_exit_tb((long)tb + 2);
44 }
45}
46
47#ifndef VBOX
48inline static void gen_io_start(void)
49#else
50DECLINLINE(void) gen_io_start(void)
51#endif
52{
53 TCGv tmp = tcg_const_i32(1);
54 tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUState, can_do_io));
55 tcg_temp_free(tmp);
56}
57
58#ifndef VBOX
59static inline void gen_io_end(void)
60#else /* VBOX */
61DECLINLINE(void) gen_io_end(void)
62#endif /* VBOX */
63{
64 TCGv tmp = tcg_const_i32(0);
65 tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUState, can_do_io));
66 tcg_temp_free(tmp);
67}
68
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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