dotgnu-libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libjit-developers] What happens if I branch to a label that has not


From: Aleksey Demakov
Subject: Re: [Libjit-developers] What happens if I branch to a label that has not been defined?
Date: Fri, 14 Sep 2007 09:37:30 +0700

Hi Paul,

On 9/14/07, Paul Brannan <address@hidden> wrote:
> On Thu, Sep 13, 2007 at 07:13:29PM +0200, Klaus Treichel wrote:
> > Hi Paul,
> >
> > this behavior happens if the label is initialiy not initialized like
> > jit_label_t label = jit_label_undefined; or the label is not inserted in
> > the code of the jit_function with jit_insn_label(func, &label).
> > There is no problem if the label is used as a branch target and the
> > label is inserted later in the compile process of the current function.
>
> But what happens if the label is never inserted?
>

I would say in this case the behavior is undefined.
It is not intended to be used like this. Probably
the most correct behavior on the side of libjit
would be to raise an error if there are undefined
branch targets.

If I got correctly what you want perhaps we need
to add a function that explicitly converts a given
instruction into a no-op.

Meanwhile it might work if you insert a label just
after the branch and in case you need to remove
the branch you generate an extra code that
branches back to that label:

          br label_1
label_2:
          ...
          return
label_1:
          br label_2

These extra branches should be removed by
the branch optimization pass and will not get
into the final code.

Regards,
Aleksey


reply via email to

[Prev in Thread] Current Thread [Next in Thread]