annotate llvm/docs/tutorial/BuildingAJIT4.rst @ 235:edfff9242030 cbc-llvm13

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 21 Jul 2021 11:30:30 +0900
parents 2e18cbf3894f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
1 =======================================================================
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
2 Building a JIT: Extreme Laziness - Using LazyReexports to JIT from ASTs
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
3 =======================================================================
150
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 .. contents::
anatofuz
parents:
diff changeset
6 :local:
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 **This tutorial is under active development. It is incomplete and details may
anatofuz
parents:
diff changeset
9 change frequently.** Nonetheless we invite you to try it out as it stands, and
anatofuz
parents:
diff changeset
10 we welcome any feedback.
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 Chapter 4 Introduction
anatofuz
parents:
diff changeset
13 ======================
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 Welcome to Chapter 4 of the "Building an ORC-based JIT in LLVM" tutorial. This
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
16 chapter introduces custom MaterializationUnits and Layers, and the lazy
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
17 reexports API. Together these will be used to replace the CompileOnDemandLayer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
18 from `Chapter 3 <BuildingAJIT3.html>`_ with a custom lazy-JITing scheme that JITs
150
anatofuz
parents:
diff changeset
19 directly from Kaleidoscope ASTs.
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 **To be done:**
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 **(1) Describe the drawbacks of JITing from IR (have to compile to IR first,
anatofuz
parents:
diff changeset
24 which reduces the benefits of laziness).**
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 **(2) Describe CompileCallbackManagers and IndirectStubManagers in detail.**
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 **(3) Run through the implementation of addFunctionAST.**
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 Full Code Listing
anatofuz
parents:
diff changeset
31 =================
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 Here is the complete code listing for our running example that JITs lazily from
anatofuz
parents:
diff changeset
34 Kaleidoscope ASTS. To build this example, use:
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 .. code-block:: bash
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 # Compile
anatofuz
parents:
diff changeset
39 clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core orcjit native` -O3 -o toy
anatofuz
parents:
diff changeset
40 # Run
anatofuz
parents:
diff changeset
41 ./toy
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 Here is the code:
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 .. literalinclude:: ../../examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
anatofuz
parents:
diff changeset
46 :language: c++
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 `Next: Remote-JITing -- Process-isolation and laziness-at-a-distance <BuildingAJIT5.html>`_