qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	qemu-devel@nongnu.org
Cc: aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH 2.3 7/8] tcg: Implement insert_op_before
Date: Fri, 14 Nov 2014 15:46:44 +0100	[thread overview]
Message-ID: <546615D4.6010504@twiddle.net> (raw)
In-Reply-To: <54661ECC.2010901@mail.uni-paderborn.de>

On 11/14/2014 04:25 PM, Bastian Koppelmann wrote:
> 
> On 11/11/2014 04:24 PM, Richard Henderson wrote:
>> Rather reserving space in the op stream for optimization,
>> let the optimizer add ops as necessary.
>>
>> Signed-off-by: Richard Henderson <rth@twiddle.net>
>> ---
>>   tcg/optimize.c | 57 +++++++++++++++++++++++++++++++++++----------------------
>>   tcg/tcg-op.c   | 16 ----------------
>>   2 files changed, 35 insertions(+), 38 deletions(-)
>>
>> diff --git a/tcg/optimize.c b/tcg/optimize.c
>> index 973fbb4..067917c 100644
>> --- a/tcg/optimize.c
>> +++ b/tcg/optimize.c
>> @@ -67,6 +67,37 @@ static void reset_temp(TCGArg temp)
>>       temps[temp].mask = -1;
>>   }
>>   +static TCGOp *insert_op_before(TCGContext *s, TCGOp *old_op,
>> +                                TCGOpcode opc, int nargs)
>> +{
>> +    int oi = s->gen_next_op_idx;
>> +    int pi = s->gen_next_parm_idx;
>> +    int prev = old_op->prev;
>> +    int next = old_op - s->gen_op_buf;
>> +    TCGOp *new_op;
>> +
>> +    tcg_debug_assert(oi < OPC_BUF_SIZE);
>> +    tcg_debug_assert(pi + nargs <= OPPARAM_BUF_SIZE);
> I thinks it is better to assure these assertion always hold, e.g.
> 
>     if (oi < OPC_BUF_SIZE || pi + nargs <= OPPARAM_BUF_SIZE) {
>         return NULL;
>     }
>     ...
>     TCGOp *op2 = insert_op_before(s, op, INDEX_op_movi_i32, 2);
>     if (op2) {
>         *args2 = &s->gen_opparam_buf[op2->args];
>     }
> 
> Or how do we know they always hold?

For the same reason we don't bother checking during initial generation of the
opcodes.  We simply assume there's enough space.  Not a good answer but...

> All references on tcg_gen_op0 are gone, so lets remove it.

Fair enough.


r~

  reply	other threads:[~2014-11-14 14:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 16:24 [Qemu-devel] [PATCH 2.3 0/8] Linked list for tcg ops Richard Henderson
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 1/8] tcg: Move some opcode generation functions out of line Richard Henderson
2014-11-14 18:01   ` Bastian Koppelmann
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 2/8] tcg: Reduce ifdefs in tcg-op.c Richard Henderson
2014-11-14 18:20   ` Bastian Koppelmann
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 3/8] tcg: Move emit of INDEX_op_end into gen_tb_end Richard Henderson
2014-11-13 15:57   ` Bastian Koppelmann
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 4/8] tcg: Introduce tcg_op_buf_count and tcg_op_buf_full Richard Henderson
2014-11-13 16:13   ` Bastian Koppelmann
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 5/8] tcg: Put opcodes in a linked list Richard Henderson
2014-11-14 15:03   ` Bastian Koppelmann
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 6/8] tcg: Remove opcodes instead of noping them out Richard Henderson
2014-11-14 15:08   ` Bastian Koppelmann
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 7/8] tcg: Implement insert_op_before Richard Henderson
2014-11-14 15:25   ` Bastian Koppelmann
2014-11-14 14:46     ` Richard Henderson [this message]
2014-11-11 16:24 ` [Qemu-devel] [PATCH 2.3 8/8] tcg: Remove unused opcodes Richard Henderson
2014-11-14 15:31   ` Bastian Koppelmann
2014-11-14 14:47     ` Richard Henderson
2014-11-14 18:22 ` [Qemu-devel] [PATCH 2.3 0/8] Linked list for tcg ops Bastian Koppelmann
2015-01-03  8:46 ` Paolo Bonzini

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=546615D4.6010504@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=kbastian@mail.uni-paderborn.de \
    --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).