From: Filip Navara <filip.navara@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/3] Get rid of temporary variable cache.
Date: Mon, 29 Jun 09 19:49:47 Central Europe Standard Time [thread overview]
Message-ID: <E1MLKzD-0006FS-Sv@lists.gnu.org> (raw)
The temporary variable cache actually hurts TCG more than it helps. Empirical results show that when running the Dhrystone benchmark with this patch improves the speed by about 2%.
---
target-arm/translate.c | 31 +++----------------------------
1 files changed, 3 insertions(+), 28 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 9a39536..2b8b770 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -111,44 +111,20 @@ void arm_translate_init(void)
#include "helpers.h"
}
-/* The code generator doesn't like lots of temporaries, so maintain our own
- cache for reuse within a function. */
-#define MAX_TEMPS 8
static int num_temps;
-static TCGv temps[MAX_TEMPS];
/* Allocate a temporary variable. */
static TCGv_i32 new_tmp(void)
{
- TCGv tmp;
- if (num_temps == MAX_TEMPS)
- abort();
-
- if (GET_TCGV_I32(temps[num_temps]))
- return temps[num_temps++];
-
- tmp = tcg_temp_new_i32();
- temps[num_temps++] = tmp;
- return tmp;
+ num_temps++;
+ return tcg_temp_new_i32();
}
/* Release a temporary variable. */
static void dead_tmp(TCGv tmp)
{
- int i;
+ tcg_temp_free(tmp);
num_temps--;
- i = num_temps;
- if (TCGV_EQUAL(temps[i], tmp))
- return;
-
- /* Shuffle this temp to the last slot. */
- while (!TCGV_EQUAL(temps[i], tmp))
- i--;
- while (i < num_temps) {
- temps[i] = temps[i + 1];
- i++;
- }
- temps[i] = tmp;
}
static inline TCGv load_cpu_offset(int offset)
@@ -8761,7 +8737,6 @@ static inline void gen_intermediate_code_internal(CPUState *env,
/* generate intermediate code */
num_temps = 0;
- memset(temps, 0, sizeof(temps));
pc_start = tb->pc;
--
1.6.3.msysgit.0
next reply other threads:[~2009-06-29 17:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-29 17:49 Filip Navara [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-06-29 18:34 [Qemu-devel] [PATCH 2/3] Get rid of temporary variable cache Paul Brook
2009-06-29 18:57 ` Filip Navara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1MLKzD-0006FS-Sv@lists.gnu.org \
--to=filip.navara@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.