From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwE5A-0007sL-Ig for qemu-devel@nongnu.org; Tue, 31 Jul 2012 11:10:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwE54-0008Bw-9k for qemu-devel@nongnu.org; Tue, 31 Jul 2012 11:10:00 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:53227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwE53-0008Bg-Uz for qemu-devel@nongnu.org; Tue, 31 Jul 2012 11:09:54 -0400 Message-ID: <5017F53E.2060706@ac.upc.edu> Date: Tue, 31 Jul 2012 17:09:50 +0200 From: Jose Cano Reyes MIME-Version: 1.0 References: <5016B8EE.9060203@ac.upc.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Adding a parameter to a helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: qemu-devel@nongnu.org Many thanks for your response Laurent. - So, how ca I obtain the value that TCGv_i32 represents? - I don't understand well how a helper functions. For instance,=20 cosidering this call to a helper again: gen_helper_flds_ST0(cpu_tmp2_i32, tcg_const_i32(MY_INT_VALUE)) Can I obtain the parameters "cpu_tmp2_i32" and=20 "tcg_const_i32(MY_INT_VALUE)" from the args[0] and args[1] described in=20 DEF_HELPER_FLAGS_2??? Jose. El 31/07/12 15:19, Laurent Desnogues escribi=F3: > On Mon, Jul 30, 2012 at 6:40 PM, Jose Cano Reyes wro= te: >> I am trying to add a new integer parameter to an existing helper and c= all >> this helper in "targeti386/translate.c". I have several problems: >> >> 1) I cannot add an integer parameter to the helper, the compiler says = that >> it must be "TCGv_i32", despite I declare this new parameter as "int" i= n >> "target-i386/helper.h". Why? > Helpers only accept TCGv parameters. > >> 2) If I use the the function "tcg_const_i32" in order to convert my in= teger >> to TCGv_i32 I always obtain the same output value, that is: >> >> tcg_const_i32(10) =3D 1074260520 >> tcg_const_i32(22) =3D 1074260520 >> tcg_const_i32(30) =3D 1074260520 >> ... > TCGv is an index, not the value it represents. Think of it > as an id. > > tcg_const will allocate a TCGv and then emit a TCG mov > instruction to assign it a value. > >> 3) Moreover, wen I pass this value in the helper call "gen_helper_flds= _ST0", >> that is: >> >> gen_helper_flds_ST0(cpu_tmp2_i32, tcg_const_i32(MY_INT_VALUE)); >> >> How can I use MY_INT_VALUE later in the function "tcg_gen_helperN= " . >> This function is called by DEF_HELPER_FLAGS2, which corresponds to >> DEF_HELPER_2 (definition of my helper). > Look at helper_aam, that should help :-) > > > Laurent