annotate gcc/jit/docs/cp/topics/compilation.rst @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1 .. Copyright (C) 2014-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
2 Originally contributed by David Malcolm <dmalcolm@redhat.com>
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This is free software: you can redistribute it and/or modify it
kono
parents:
diff changeset
5 under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
6 the Free Software Foundation, either version 3 of the License, or
kono
parents:
diff changeset
7 (at your option) any later version.
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 This program is distributed in the hope that it will be useful, but
kono
parents:
diff changeset
10 WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
kono
parents:
diff changeset
12 General Public License for more details.
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
15 along with this program. If not, see
kono
parents:
diff changeset
16 <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 .. default-domain:: cpp
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 Compiling a context
kono
parents:
diff changeset
21 ===================
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 Once populated, a :class:`gccjit::context` can be compiled to
kono
parents:
diff changeset
24 machine code, either in-memory via :func:`gccjit::context::compile` or
kono
parents:
diff changeset
25 to disk via :func:`gccjit::context::compile_to_file`.
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 You can compile a context multiple times (using either form of
kono
parents:
diff changeset
28 compilation), although any errors that occur on the context will
kono
parents:
diff changeset
29 prevent any future compilation of that context.
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 In-memory compilation
kono
parents:
diff changeset
32 *********************
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 .. function:: gcc_jit_result *\
kono
parents:
diff changeset
35 gccjit::context::compile ()
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 This calls into GCC and builds the code, returning a
kono
parents:
diff changeset
38 `gcc_jit_result *`.
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 This is a thin wrapper around the
kono
parents:
diff changeset
41 :c:func:`gcc_jit_context_compile` API entrypoint.
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 Ahead-of-time compilation
kono
parents:
diff changeset
44 *************************
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 Although libgccjit is primarily aimed at just-in-time compilation, it
kono
parents:
diff changeset
47 can also be used for implementing more traditional ahead-of-time
kono
parents:
diff changeset
48 compilers, via the :func:`gccjit::context::compile_to_file` method.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 .. function:: void \
kono
parents:
diff changeset
51 gccjit::context::compile_to_file (enum gcc_jit_output_kind,\
kono
parents:
diff changeset
52 const char *output_path)
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 Compile the :class:`gccjit::context` to a file of the given
kono
parents:
diff changeset
55 kind.
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 This is a thin wrapper around the
kono
parents:
diff changeset
58 :c:func:`gcc_jit_context_compile_to_file` API entrypoint.