alloca and labels as values

David Malcolm dmalcolm@redhat.com
Mon Jan 1 00:00:00 GMT 2018


On Mon, 2018-12-17 at 08:07 +0100, Marc Nieper-Wißkirchen wrote:
> Hi,
> 
> let me first say that libgccjit is a great project and that I like
> the 
> API very much!

Thanks.

> 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.


> Another thing that may be missing is label values as implemented by
> the 
> GCC C/C++ frontends.

Probably.  IIRC that isn't implemented.

> Thanks!
> 
> Marc

Dave



More information about the Jit mailing list