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

Signed-off-by: Emilio G. Cota <c...@braap.org>
---
  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