llvm.org GIT mirror llvm / 71d351f
[Kaleidoscope][BuildingAJIT] Add docs for Chapter 3 of the Building A JIT tutorial. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270917 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 3 years ago
1 changed file(s) with 47 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 =============================================
1 Building a JIT: Per-function Lazy Compilation
2 =============================================
3
4 .. contents::
5 :local:
6
7 **This tutorial is under active development. It is incomplete and details may
8 change frequently.** Nonetheless we invite you to try it out as it stands, and
9 we welcome any feedback.
10
11 Chapter 3 Introduction
12 ======================
13
14 Welcome to Chapter 3 of the "Building an ORC-based JIT in LLVM" tutorial. This
15 chapter discusses lazy JITing and shows you how to enable it by adding an ORC
16 CompileOnDemand layer the JIT from `Chapter 2 `_.
17
18 **To be done:**
19
20 **(1) Describe lazy function-at-a-time JITing and how it differs from the kind
21 of eager module-at-a-time JITing that we've been doing so far. **
22
23 **(2) Discuss CompileCallbackManagers and IndirectStubManagers.**
24
25 **(3) Describe CompileOnDemandLayer (automates these components and builds stubs
26 and lazy compilation callbacks for IR) and how to add it to the JIT. **
27
28 Full Code Listing
29 =================
30
31 Here is the complete code listing for our running example with a CompileOnDemand
32 layer added to enable lazy function-at-a-time compilation. To build this example, use:
33
34 .. code-block:: bash
35
36 # Compile
37 clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core orc native` -O3 -o toy
38 # Run
39 ./toy
40
41 Here is the code:
42
43 .. literalinclude:: ../../examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
44 :language: c++
45
46 `Next: Extreme Laziness -- Using Compile Callbacks to JIT directly from ASTs `_