qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 36/45] tcg: dynamically allocate optimizer gl


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 36/45] tcg: dynamically allocate optimizer globals + fold into TCGContext
Date: Mon, 17 Jul 2017 17:53:33 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/16/2017 10:04 AM, Emilio G. Cota wrote:
Groundwork for supporting multiple TCG contexts.

Signed-off-by: Emilio G. Cota <address@hidden>
---
  tcg/tcg.h      | 12 ++++++++++++
  tcg/optimize.c | 40 +++++++++++++++++++++++-----------------
  2 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/tcg/tcg.h b/tcg/tcg.h
index 569f823..175d4de 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -641,6 +641,14 @@ QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 14));
  /* Make sure that we don't overflow 64 bits without noticing.  */
  QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8);
+struct tcg_temp_info {
+    bool is_const;
+    uint16_t prev_copy;
+    uint16_t next_copy;
+    tcg_target_ulong val;
+    tcg_target_ulong mask;
+};
+
  struct TCGContext {
      uint8_t *pool_cur, *pool_end;
      TCGPool *pool_first, *pool_current, *pool_first_large;
@@ -717,6 +725,10 @@ struct TCGContext {
      TCGTempSet free_temps[TCG_TYPE_COUNT * 2];
      TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */
+ /* optimizer */
+    struct tcg_temp_info *opt_temps;
+    TCGTempSet opt_temps_used;

I would prefer either

  (1) Dynamic allocation.  I know we eschew that most places during,
      but surely this is the exact situation for which it's handy.

  (2) Make opt_temps an array of TCG_MAX_TEMPS and drop the pointer.

I think the TCGTempSet should be a local within tcg_optimize.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]