From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKAxB-00046Y-Pc for qemu-devel@nongnu.org; Fri, 15 Jan 2016 15:26:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKAx6-0001vK-Hp for qemu-devel@nongnu.org; Fri, 15 Jan 2016 15:26:37 -0500 Received: from mail-qg0-x241.google.com ([2607:f8b0:400d:c04::241]:35619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKAx6-0001vF-DO for qemu-devel@nongnu.org; Fri, 15 Jan 2016 15:26:32 -0500 Received: by mail-qg0-x241.google.com with SMTP id b35so50273179qge.2 for ; Fri, 15 Jan 2016 12:26:32 -0800 (PST) Sender: Richard Henderson References: <145287209895.25408.12995870835200275306.stgit@localhost> <145287210479.25408.17499099590726683703.stgit@localhost> <56993854.1030802@twiddle.net> <87egdi1u1y.fsf@fimbulvetr.bsc.es> From: Richard Henderson Message-ID: <569955F4.4000607@twiddle.net> Date: Fri, 15 Jan 2016 12:26:28 -0800 MIME-Version: 1.0 In-Reply-To: <87egdi1u1y.fsf@fimbulvetr.bsc.es> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v1 1/2] tcg: Add support for constant value promises List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Llu=c3=ads_Vilanova?= Cc: "Edgar E . Iglesias" , qemu-devel@nongnu.org, peter.maydell@linaro.org On 01/15/2016 12:12 PM, Lluís Vilanova wrote: > Richard Henderson writes: > >> On 01/15/2016 07:35 AM, Lluís Vilanova wrote: >>> +TCGv_i64 tcg_promise_i64(TCGv_promise_i64 *promise) >>> +{ >>> + int pi = tcg_ctx.gen_next_parm_idx; >>> + *promise = (TCGv_promise_i64)&tcg_ctx.gen_opparam_buf[pi]; >>> + return tcg_const_i64(0xdeadcafe); >>> +} > >> This doesn't work for a 32-bit host. The constant may be split across two >> different parameter indices, and you don't know exactly where the second will be. > >> Because of that, I think this is over-engineered, and really prefer the simpler >> interface that Edgar posted last week. > > In this case, 'tcg_set_promise_i64' sets the two arguments accordingly on 32-bit > targets. Both solutions depend on TCG internals (in this specific case the > implementation of 'tcg_gen_movi_i64'), but now it's all implemented inside TCG. > > Alternatively, promises could use the longer route of recording the opcode index > (as Edgar did AFAIR), and retrieve the argument pointer from there. Still, for > 32-bit targets we have to assume the two immediate moves are gonna generate two > consecutive opcodes. Your solution also doesn't help Edgar, since he's interested in modifying an argument to the insn_start opcode, not modifying a literal constant in a move. r~