qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4512] fixed dead global variable update
Date: Wed, 21 May 2008 16:24:22 +0000	[thread overview]
Message-ID: <E1Jyr70-0002Tj-NZ@cvs.savannah.gnu.org> (raw)

Revision: 4512
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4512
Author:   bellard
Date:     2008-05-21 16:24:20 +0000 (Wed, 21 May 2008)

Log Message:
-----------
fixed dead global variable update

Modified Paths:
--------------
    trunk/tcg/tcg.c

Modified: trunk/tcg/tcg.c
===================================================================
--- trunk/tcg/tcg.c	2008-05-21 13:34:27 UTC (rev 4511)
+++ trunk/tcg/tcg.c	2008-05-21 16:24:20 UTC (rev 4512)
@@ -1293,10 +1293,9 @@
     tcg_abort();
 }
 
-/* at the end of a basic block, we assume all temporaries are dead and
-   all globals are stored at their canonical location */
-/* XXX: optimize by handling constants in another array ? */
-void tcg_reg_alloc_bb_end(TCGContext *s)
+/* save globals to their cannonical location and assume they can be
+   modified be the following code. */
+static void save_globals(TCGContext *s)
 {
     TCGTemp *ts;
     int i;
@@ -1306,10 +1305,23 @@
         if (!ts->fixed_reg) {
             if (ts->val_type == TEMP_VAL_REG) {
                 tcg_reg_free(s, ts->reg);
+            } else if (ts->val_type == TEMP_VAL_DEAD) {
+                ts->val_type = TEMP_VAL_MEM;
             }
         }
     }
+}
 
+/* at the end of a basic block, we assume all temporaries are dead and
+   all globals are stored at their canonical location */
+/* XXX: optimize by handling constants in another array ? */
+void tcg_reg_alloc_bb_end(TCGContext *s)
+{
+    TCGTemp *ts;
+    int i;
+
+    save_globals(s);
+
     for(i = s->nb_globals; i < s->nb_temps; i++) {
         ts = &s->temps[i];
         if (ts->val_type != TEMP_VAL_CONST) {
@@ -1481,14 +1493,7 @@
 
         /* store globals and free associated registers (we assume the insn
            can modify any global. */
-        for(i = 0; i < s->nb_globals; i++) {
-            ts = &s->temps[i];
-            if (!ts->fixed_reg) {
-                if (ts->val_type == TEMP_VAL_REG) {
-                    tcg_reg_free(s, ts->reg);
-                }
-            }
-        }
+        save_globals(s);
     }
 
     /* satisfy the output constraints */
@@ -1680,14 +1685,7 @@
     
     /* store globals and free associated registers (we assume the call
        can modify any global. */
-    for(i = 0; i < s->nb_globals; i++) {
-        ts = &s->temps[i];
-        if (!ts->fixed_reg) {
-            if (ts->val_type == TEMP_VAL_REG) {
-                tcg_reg_free(s, ts->reg);
-            }
-        }
-    }
+    save_globals(s);
 
     tcg_out_op(s, opc, &func_arg, &const_func_arg);
     

                 reply	other threads:[~2008-05-21 16:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1Jyr70-0002Tj-NZ@cvs.savannah.gnu.org \
    --to=fabrice@bellard.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).