Hi, gen_intermediate_code_internal in ./target-i386/translate.c is a good starting point. This is where Basic Blocks are translated into native code by TCG. I recently did some patches for program analysis in the i386 part so dont hesitate to contact me.
regards, felix