qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] TCG is hard to understand!
@ 2009-12-10 16:44 Jun Koi
  2009-12-10 22:21 ` Andreas Färber
  0 siblings, 1 reply; 7+ messages in thread
From: Jun Koi @ 2009-12-10 16:44 UTC (permalink / raw)
  To: qemu-devel

Hi,

I am trying to understand how TCG works. For example, I look at the
LLDT insn on x86.

In target-i386/translate.c, we translate LLDT to TCG code, like below:


static TCGv_i32 cpu_tmp2_i32;                                      // 1
...
gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 0);   // 2
gen_jmp_im(pc_start - s->cs_base);                                // 3
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);                // 4
gen_helper_lldt(cpu_tmp2_i32);                                       // 5


This is quite confused. I understand that:

- In line (2), we retrieve the operand and save it into cpu_T[0].

- Line (3) generates jump code, but I dont understand why we need that ????

- Line (4) generate the code to copy cpu_T[0] to the (local) variable
cpu_tmp2_i32.
However, as tcg_gen_trunc_tl_i32() put the *value* of that variable,
but not its *address*, into the generated code, I dont see how next
line (5) can generate code that use the same variable.
Clearly there is no connection between cpu_tmp2_i32 on line (4) and
line (5), so how the generated code works here??

Thanks a lot,
Jun

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-11  8:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 16:44 [Qemu-devel] TCG is hard to understand! Jun Koi
2009-12-10 22:21 ` Andreas Färber
2009-12-11  2:34   ` Jun Koi
2009-12-11  3:02     ` Alexander Graf
2009-12-11  3:18       ` Jun Koi
2009-12-11  7:36         ` Laurent Desnogues
2009-12-11  8:40           ` Jun Koi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).