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

Re: Basic blocks, jump targets and locals



On Sat, 2015-06-13 at 21:25 +0100, Dibyendu Majumdar wrote:
> On 11 June 2015 at 21:31, David Malcolm <dmalcolm@redhat.com> wrote:
> > Local variables in libgccjit are local to a *function*; there's no
> > association between them and blocks.  Blocks in libgccjit relate to
> > control flow, not to scope.
> >
> > Note that any initialization of a local variable has to be done
> > explicitly, by adding an assignment statement.  Typically that
> > assignment statement would be added to the initial block, as in the
> > example above (so I suppose that's an association of sorts between
> > locals and the entry block).
> >
> 
> Can an assignment statement be added to a block that is already terminated?

No; you'll get an error like:

adding to terminated block: entry (already terminated by: goto foo)

So you may want to wait until you've added all the initializations
before adding the jump from the entry block to the block for the first
bytecode.