From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lqo1b-0007Dt-6n for qemu-devel@nongnu.org; Mon, 06 Apr 2009 08:34:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lqo1Z-0007Cr-Sp for qemu-devel@nongnu.org; Mon, 06 Apr 2009 08:34:02 -0400 Received: from [199.232.76.173] (port=57836 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lqo1Z-0007Ci-LJ for qemu-devel@nongnu.org; Mon, 06 Apr 2009 08:34:01 -0400 Received: from savannah.gnu.org ([199.232.41.3]:44321 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lqo1Z-0002YS-BR for qemu-devel@nongnu.org; Mon, 06 Apr 2009 08:34:01 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Lqo1Y-0004Xa-Ns for qemu-devel@nongnu.org; Mon, 06 Apr 2009 12:34:00 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1Lqo1Y-0004XW-D4 for qemu-devel@nongnu.org; Mon, 06 Apr 2009 12:34:00 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Mon, 06 Apr 2009 12:34:00 +0000 Subject: [Qemu-devel] [7008] tcg: add a CONST flag to TCG helpers Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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)