public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Some basic questions
  2017-01-01  0:00 Some basic questions Mahdi Mohammadinasab
@ 2017-01-01  0:00 ` David Malcolm
  0 siblings, 0 replies; 2+ messages in thread
From: David Malcolm @ 2017-01-01  0:00 UTC (permalink / raw)
  To: Mahdi Mohammadinasab, jit

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Some basic questions
@ 2017-01-01  0:00 Mahdi Mohammadinasab
  2017-01-01  0:00 ` David Malcolm
  0 siblings, 1 reply; 2+ messages in thread
From: Mahdi Mohammadinasab @ 2017-01-01  0:00 UTC (permalink / raw)
  To: jit

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?
2. Does it support other OSs like Windows?
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?
4. Is there any planned feature missing from current codebase which
prevents it moving out of alpha stage?

Thanks,
Mahdi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-06 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-01  0:00 Some basic questions Mahdi Mohammadinasab
2017-01-01  0:00 ` David Malcolm

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