[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Basic blocks, jump targets and locals
On 11 June 2015 at 21:31, David Malcolm <dmalcolm@redhat.com> wrote:
>> Can one create several blocks in advance - and set a block that is not
>> yet inserted into the function as the target for a jump?
>
> Yes. See e.g.:
> https://gcc.gnu.org/onlinedocs/jit/intro/tutorial04.html#populating-the-function
> which does two passes:
> (i) iterates through all of the bytecodes in a function, creating
> gcc_jit_block instances for each one
> (ii) iterates again, populating the gcc_jit_block instances with
> statements
>
>
>> Finally - how are local variable related to blocks. In LLVM one has to
>> create the local vars in the entry block of the function. Is it the
>> same with libgccjit?
>
> 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).
>
> Hope this is clear
Thanks Dave - all very clear.