diff mbox

[RFC,v0,5/8] Track call-clobbered uses of registers

Message ID 1306161654-4388-6-git-send-email-batuzovk@ispras.ru
State New
Headers show

Commit Message

Kirill Batuzov May 23, 2011, 2:40 p.m. UTC
Adjust next use for call-clobbered registers.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
---
 tcg/tcg.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 799b245..8ab556d 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2125,6 +2125,9 @@  static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
     int nb_args;
     unsigned int dead_iargs;
     const TCGArg *args;
+#ifdef USE_ADVANCED_REGALLOC
+    int reg;
+#endif
 
 #ifdef DEBUG_DISAS
     if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) {
@@ -2166,6 +2169,15 @@  static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
         tcg_table_op_count[opc]++;
 #endif
         def = &tcg_op_defs[opc];
+
+#ifdef USE_ADVANCED_REGALLOC
+        for (reg = 0; reg < TCG_TARGET_NB_REGS; reg++) {
+            if (tcg_regset_test_reg(tcg_target_call_clobber_regs, reg)
+                    && s->reg_next_use[reg] > s->next_call[op_index]) {
+                s->reg_next_use[reg] = s->next_call[op_index];
+            }
+        }
+#endif
 #if 0
         printf("%s: %d %d %d\n", def->name,
                def->nb_oargs, def->nb_iargs, def->nb_cargs);