qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [7008] tcg: add a CONST flag to TCG helpers
Date: Mon, 06 Apr 2009 12:34:00 +0000	[thread overview]
Message-ID: <E1Lqo1Y-0004XW-D4@cvs.savannah.gnu.org> (raw)

Revision: 7008
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7008
Author:   aurel32
Date:     2009-04-06 12:33:59 +0000 (Mon, 06 Apr 2009)
Log Message:
-----------
tcg: add a CONST flag to TCG helpers

A const function only reads its arguments and does not use TCG
globals variables. Hence a call to such a function does not
save TCG globals variabes back to their canonical location.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

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

Modified: trunk/tcg/tcg.c
===================================================================
--- trunk/tcg/tcg.c	2009-04-06 12:33:51 UTC (rev 7007)
+++ trunk/tcg/tcg.c	2009-04-06 12:33:59 UTC (rev 7008)
@@ -1122,9 +1122,11 @@
                         dead_temps[arg] = 1;
                     }
                     
-                    /* globals are live (they may be used by the call) */
-                    memset(dead_temps, 0, s->nb_globals);
-                    
+                    if (!(call_flags & TCG_CALL_CONST)) {
+                        /* globals are live (they may be used by the call) */
+                        memset(dead_temps, 0, s->nb_globals);
+                    }
+
                     /* input args are live */
                     dead_iargs = 0;
                     for(i = 0; i < nb_iargs; i++) {
@@ -1821,7 +1823,9 @@
     
     /* store globals and free associated registers (we assume the call
        can modify any global. */
-    save_globals(s, allocated_regs);
+    if (!(flags & TCG_CALL_CONST)) {
+        save_globals(s, allocated_regs);
+    }
 
     tcg_out_op(s, opc, &func_arg, &const_func_arg);
     

Modified: trunk/tcg/tcg.h
===================================================================
--- trunk/tcg/tcg.h	2009-04-06 12:33:51 UTC (rev 7007)
+++ trunk/tcg/tcg.h	2009-04-06 12:33:59 UTC (rev 7008)
@@ -178,6 +178,10 @@
    and cannot raise exceptions. Hence a call to a pure function can be
    safely suppressed if the return value is not used. */
 #define TCG_CALL_PURE           0x0010 
+/* A const function only reads its arguments and does not use TCG
+   globals variables. Hence a call to such a function does not
+   save TCG globals variabes back to their canonical location. */
+#define TCG_CALL_CONST          0x0020
 
 /* used to align parameters */
 #define TCG_CALL_DUMMY_TCGV     MAKE_TCGV_I32(-1)

                 reply	other threads:[~2009-04-06 12:34 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=E1Lqo1Y-0004XW-D4@cvs.savannah.gnu.org \
    --to=aurelien@aurel32.net \
    --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).