aboutsummaryrefslogtreecommitdiff
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-06 12:33:59 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-06 12:33:59 +0000
commitb9c18f56585ab146c6a25084bce00e4c52eefcc6 (patch)
tree20207c890dcc4976359e5e1e833fd48a70a6fc77 /tcg/tcg.c
parent34d5a9ff634b1cafdd164cfe19e167b55084f6b8 (diff)
tcg: add a CONST flag to TCG helpers
A const function only reads its arguments and does not use TCG globals variables. Hence a call to such a function does not save TCG globals variabes back to their canonical location. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7008 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index e5508507e2..c64043f690 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1122,9 +1122,11 @@ static void tcg_liveness_analysis(TCGContext *s)
dead_temps[arg] = 1;
}
- /* globals are live (they may be used by the call) */
- memset(dead_temps, 0, s->nb_globals);
-
+ if (!(call_flags & TCG_CALL_CONST)) {
+ /* globals are live (they may be used by the call) */
+ memset(dead_temps, 0, s->nb_globals);
+ }
+
/* input args are live */
dead_iargs = 0;
for(i = 0; i < nb_iargs; i++) {
@@ -1821,7 +1823,9 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
/* store globals and free associated registers (we assume the call
can modify any global. */
- save_globals(s, allocated_regs);
+ if (!(flags & TCG_CALL_CONST)) {
+ save_globals(s, allocated_regs);
+ }
tcg_out_op(s, opc, &func_arg, &const_func_arg);