From: David Malcolm <dmalcolm@redhat.com>
To: "Marc Nieper-Wißkirchen" <marc@nieper-wisskirchen.de>, jit@gcc.gnu.org
Subject: Re: alloca and labels as values
Date: Mon, 01 Jan 2018 00:00:00 -0000 [thread overview]
Message-ID: <1545141762.4619.244.camel@redhat.com> (raw)
In-Reply-To: <9bf4ad79-88dd-cac9-babf-c83d59acf7c5@nieper-wisskirchen.de>
On Tue, 2018-12-18 at 08:12 +0100, Marc Nieper-WiÃkirchen wrote:
> > > 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?
I think you'd need a configure check.
> -- 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).
There isn't currently a way to do thread local variables. I suspect
that something like a variant of gcc_jit_context_new_global could do
it, e.g. "gcc_jit_context_new_thread_local" or somesuch. Or maybe a
way to mark the result of gcc_jit_context_new_global as being thread-
local.
Dave
next prev parent reply other threads:[~2018-12-18 14:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-01 0:00 Marc Nieper-Wißkirchen
2018-01-01 0:00 ` David Malcolm [this message]
2019-01-01 0:00 ` Marc Nieper-Wißkirchen
2018-01-01 0:00 Marc Nieper-Wißkirchen
2018-01-01 0:00 ` David Malcolm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1545141762.4619.244.camel@redhat.com \
--to=dmalcolm@redhat.com \
--cc=jit@gcc.gnu.org \
--cc=marc@nieper-wisskirchen.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).