OSDN Git Service

tcg: rewrite tcg_reg_alloc_mov()
authorAurelien Jarno <aurelien@aurel32.net>
Tue, 9 Oct 2012 19:53:07 +0000 (21:53 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 28 Oct 2012 13:54:22 +0000 (14:54 +0100)
commitc29c1d7edfc57fc4ab15e30b3cea990a5685dd7a
treea229a0c4d3eb4dd386346b550f02aace9d4f3d40
parent4c4e1ab26bfc9b3f9b3097ecd0643bc20d0e2f0d
tcg: rewrite tcg_reg_alloc_mov()

Now that the liveness analysis provides more information, rewrite
tcg_reg_alloc_mov(). This changes the behaviour about propagating
constants and memory accesses. We now take the assumption that once
a value is loaded into a register (from memory or from a constant),
it's better to keep it there than to reload it later. This assumption
is now always almost correct given that we are now sure the
corresponding temp is going to be used later (otherwise it would have
been synchronized and marked as dead already). The assumption is wrong
if one of the op after clobbers some registers including the one
of the holding the temp (this can be avoided by allocating clobbered
registers last, which is what most TCG target do), or in case of lack
of available register.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/tcg.c