public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Mahdi Mohammadinasab <mahdix@gmail.com>, jit@gcc.gnu.org
Subject: Re: Some basic questions
Date: Sun, 01 Jan 2017 00:00:00 -0000	[thread overview]
Message-ID: <1499361143.7656.151.camel@redhat.com> (raw)
In-Reply-To: <CABokNM7nSf=NQiec+LWQTs+nWf_CwRMA4pPMoBAd2AqAAgx=GQ@mail.gmail.com>

On Thu, 2017-07-06 at 17:51 +0100, Mahdi Mohammadinasab wrote:
> I have some basic questions regarding libgccjit. I could not find the
> answer in the documentation.
> 
> 1. Does libgccjit do optimizations when generating the machine code?

By default, no, but you can enable optimizations using
GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL:

e.g.

  gcc_jit_context_set_int_option(ctxt,
                                 GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL,
                                 2);

for the equivalent of -O2.

https://gcc.gnu.org/onlinedocs/jit/topics/contexts.html#GCC_JIT_INT_OPT
ION_OPTIMIZATION_LEVEL

You can also enable specific optimizations using:
  gcc_jit_context_add_command_line_option
e.g.:
  gcc_jit_context_add_command_line_option (ctxt, "-ffast-math");

> 2. Does it support other OSs like Windows?

In theory, yes, but I don't know of anyone who's used it on Windows,
and so in practice there are likely to be bugs that need solving.

I know people have used it on OS X (using an out-of-tree patch, which
is in the OS X Homebrew packages: see
https://github.com/Homebrew/homebrew-core/blob/master/Formula/gcc.rb#L4
6
which is an OS X-specific patch for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089 )

> 3. If the output application depends on a static library (.a) I will
> need to generate object file using libgccjit (call
> gcc_jit_context_compile_to_file with GCC_JIT_OUTPUT_KIND_OBJECT_FILE
> option) and use system linker to link it with the library. Is that
> the
> correct approach?

https://gcc.gnu.org/onlinedocs/jit/topics/compilation.html#GCC_JIT_OUTP
UT_KIND_EXECUTABLE says "There is currently no support for specifying
libraries to link against.".  Given that limitation, the approach you
suggest sounds correct.

Alternatively we could add support for passing linker options for use
with GCC_JIT_OUTPUT_KIND_EXECUTABLE (one might think that
gcc_jit_context_add_command_line_option could be used, but options
added this way are used in a different place).

> 4. Is there any planned feature missing from current codebase which
> prevents it moving out of alpha stage?

Not AFAIK.

Hope this is helpful
Dave

      reply	other threads:[~2017-07-06 17:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01  0:00 Mahdi Mohammadinasab
2017-01-01  0:00 ` David Malcolm [this message]

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=1499361143.7656.151.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=jit@gcc.gnu.org \
    --cc=mahdix@gmail.com \
    /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).