[Orc] Add a Kaleidoscope/Orc tutorial demonstrating lazy-irgen.

This tutorial builds on the lazy_codegen kaleidoscope/orc tutorial by making
a small set of changes (~75 lines diff) to defer ir-generation for function
definitions until functions are actually referenced.

llvm-svn: 228466
This commit is contained in:
Lang Hames 2015-02-06 23:26:33 +00:00
parent 03d099fa2a
commit ea9398780d
3 changed files with 1366 additions and 0 deletions

View File

@ -0,0 +1,9 @@
.PHONY: all
all: toy
toy: toy.cpp
clang++ -std=c++11 toy.cpp -g -O0 -rdynamic -fno-rtti `llvm-config --cppflags --ldflags --system-libs --libs core orcjit native` -o toy
.PHONY: clean
clean:
rm -f toy

View File

@ -0,0 +1,16 @@
//===----------------------------------------------------------------------===/
// Kaleidoscope with Orc - Lazy IRGen Version
//===----------------------------------------------------------------------===//
This version of Kaleidoscope with Orc demonstrates lazy IR-generation.
Building on the lazy-codegen version of the tutorial, this version reduces the
amount of up-front work that must be done by lazily IRgen'ing ASTs. When a
function definition is entered, its AST is added to a map of available
definitions. No IRGen is performed at this point and nothing is added to the JIT.
When attempting to resolve symbol addresses, the lambda in
KaleidoscopeJIT::getSymbolAddress will scan the AST map and generate IR on the
fly.
This directory contains a Makefile that allows the code to be built in a
standalone manner, independent of the larger LLVM build infrastructure. To build
the program you will need to have 'clang++' and 'llvm-config' in your path.

File diff suppressed because it is too large Load Diff