[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH v0 7/8] Spill globals early if their next use i
From: |
Kirill Batuzov |
Subject: |
[Qemu-devel] [RFC][PATCH v0 7/8] Spill globals early if their next use is at the BB end. |
Date: |
Mon, 23 May 2011 18:40:53 +0400 |
Spill globals early if their next use is at the BB end. They'll be spilled
anyway in this case.
Signed-off-by: Kirill Batuzov <address@hidden>
---
tcg/tcg.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index ad5bd71..022eef9 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1179,11 +1179,16 @@ static inline void tcg_la_func_end(TCGContext *s,
uint8_t *dead_temps)
/* liveness analysis: end of basic block: globals are live, temps are
dead, local temps are live. */
static inline void tcg_la_bb_end(TCGContext *s, uint8_t *dead_temps,
- int *temp_next_use)
+ int *temp_next_use, int op_index)
{
int i;
TCGTemp *ts;
+#ifdef USE_ADVANCED_REGALLOC
+ for (i = 0; i < s->nb_globals; i++) {
+ temp_next_use[i] = op_index;
+ }
+#endif
memset(dead_temps, 0, s->nb_globals);
ts = &s->temps[s->nb_globals];
for(i = s->nb_globals; i < s->nb_temps; i++) {
@@ -1328,7 +1333,7 @@ static void tcg_liveness_analysis(TCGContext *s)
args--;
next_use_ptr--;
/* mark end of basic block */
- tcg_la_bb_end(s, dead_temps, temp_next_use);
+ tcg_la_bb_end(s, dead_temps, temp_next_use, op_index);
break;
case INDEX_op_debug_insn_start:
args -= def->nb_args;
@@ -1394,7 +1399,7 @@ static void tcg_liveness_analysis(TCGContext *s)
/* if end of basic block, update */
if (def->flags & TCG_OPF_BB_END) {
- tcg_la_bb_end(s, dead_temps, temp_next_use);
+ tcg_la_bb_end(s, dead_temps, temp_next_use, op_index);
} else if (def->flags & TCG_OPF_CALL_CLOBBER) {
/* globals are live */
memset(dead_temps, 0, s->nb_globals);
@@ -2203,7 +2208,7 @@ static inline int tcg_gen_code_common(TCGContext *s,
uint8_t *gen_code_buf,
#ifdef USE_ADVANCED_REGALLOC
if (args[0] < s->nb_globals) {
if (tcg_op_defs[gen_opc_buf[param_next_use_ptr[0]]].flags
- & TCG_OPF_CALL_CLOBBER) {
+ & (TCG_OPF_CALL_CLOBBER | TCG_OPF_BB_END)) {
tcg_reg_free(s, s->temps[args[0]].reg);
}
}
--
1.7.4.1
- [Qemu-devel] [RFC][PATCH v0 0/8] Improve register allocator, Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 4/8] Calculate NEXT_CALL liveness information., Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 6/8] Spill globals early if their next use is in call., Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 2/8] Propagate REG_NEXT_USE value through process of register allocation., Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 5/8] Track call-clobbered uses of registers, Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 1/8] Compute additional liveness information for register allocator., Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 8/8] Add spill count profiling., Kirill Batuzov, 2011/05/23
- [Qemu-devel] [RFC][PATCH v0 7/8] Spill globals early if their next use is at the BB end.,
Kirill Batuzov <=
- [Qemu-devel] [RFC][PATCH v0 3/8] Do better spill choice., Kirill Batuzov, 2011/05/23
- Re: [Qemu-devel] [RFC][PATCH v0 0/8] Improve register allocator, Aurelien Jarno, 2011/05/23