alloca and labels as values
Marc Nieper-Wißkirchen
marc@nieper-wisskirchen.de
Mon Jan 1 00:00:00 GMT 2018
> > Is `alloca' currently possible with libgccjit? I haven't found
> > anything
> > about it in the documentation. If it isn't possible at the moment,
> > I'd
> > love to see it added to libgccjit very soon. (One use case would be
> > a
> > compiler like the Chicken Scheme compiler that employs Cheney-on-the-
> > MTA
> > where the youngest heap generation is allocated on the stack.)
>
> I haven't tested this, but I believe you ought to be able to access it
> via the "__builtin_alloca" builtin, via something like:
>
>
> gcc_jit_function *fn_alloca
> Â = gcc_jit_context_get_builtin_function (ctxt, "__builtin_alloca");
>
>
> gcc_jit_rvalue *call =
> Â Â Â Â gcc_jit_context_new_call (ctxt,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â loc,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â fn_alloc_a,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 1, &size_t_arg);
>
> Â gcc_jit_block_add_assignment (block, loc,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â dst_lvalue,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â call);
>
> ...or something like that.
That was helpful; thank you very much. I overlooked the procedure
`gcc_jit_context_get_builtin_function' in the documentation. Is there a
way to determine which builtins are supported by a specific version of
the library or would I have to add a few scripts to my project's
`configure.ac <http://configure.ac>' myself?
-- Marc
P.S.: Another thing I wasn't able to find so far was how to declare
variables as thread local (i.e. GCC's __thread or C11's thread_local).
More information about the Jit
mailing list