aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/2022-07-07-llvm-orc-jit/index.md
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2022-12-19 18:54:41 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2022-12-19 18:54:41 +0100
commit1c123a75e9b17858b783fbc6533417bdfa9794eb (patch)
tree72b0e3d48553b31b37cc2271de446f9ddfd915ef /content/2022-07-07-llvm-orc-jit/index.md
parentdf9ac27b1048713207d2314407079586a080fc4f (diff)
downloadblog-1c123a75e9b17858b783fbc6533417bdfa9794eb.tar.gz
blog-1c123a75e9b17858b783fbc6533417bdfa9794eb.zip
Migrate pages with assets according to zola best practice
https://www.getzola.org/documentation/content/overview/#asset-colocation
Diffstat (limited to 'content/2022-07-07-llvm-orc-jit/index.md')
-rw-r--r--content/2022-07-07-llvm-orc-jit/index.md42
1 files changed, 42 insertions, 0 deletions
diff --git a/content/2022-07-07-llvm-orc-jit/index.md b/content/2022-07-07-llvm-orc-jit/index.md
new file mode 100644
index 0000000..4b2add0
--- /dev/null
+++ b/content/2022-07-07-llvm-orc-jit/index.md
@@ -0,0 +1,42 @@
++++
+title = "Jit C in memory using LLVM ORC api"
+
+[taxonomies]
+tags = ["llvm", "clang", "c++"]
++++
+
+Based on the in-memory compiler shared in the last post ([C to LLVM IR in
+memory using libclang](@/2022-06-18-libclang-c-to-llvm-ir/index.md)), this post
+demonstrates a small *just in time (JIT)* compiler which allows to compile C
+code to host native code in-memory.
+
+The JIT compiler is based on the LLVM [ORCv2 API][llvm-orc2] (the newest LLVM
+JIT API at the time of writing) and the crucial parts are taken from the [JIT
+tutorial][llvm-jit-tut].
+
+The sources are available under [llvm-orc-jit][post-src].
+
+### main.cc
+```cpp
+{{ include(path="content/2022-07-07-llvm-orc-jit/main.cc") }}
+```
+
+### jit.h
+```cpp
+{{ include(path="content/2022-07-07-llvm-orc-jit/jit.h") }}
+```
+
+### compiler.h
+```cpp
+{{ include(path="content/2022-07-07-llvm-orc-jit/ccompiler.h") }}
+```
+
+### Makefile
+```make
+{{ include(path="content/2022-07-07-llvm-orc-jit/Makefile") }}
+```
+[post-src]: https://git.memzero.de/blog/tree/content/2022-07-07-llvm-orc-jit?h=main
+[src-clang]: https://github.com/llvm/llvm-project/tree/main/clang
+[blog-clang-in-memory]: https://blog.audio-tk.com/2018/09/18/compiling-c-code-in-memory-with-clang/
+[llvm-jit-tut]: https://www.llvm.org/docs/tutorial/BuildingAJIT1.html
+[llvm-orc2]: https://www.llvm.org/docs/ORCv2.html