# Would it be possible to write LLVM in Julia?

**URL:** <https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925>\
**Category:** General Usage\
**Created:** [September 16, 2023, 11:47am UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925 "2023-09-16T11:47:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![R.T.A.M](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/r.t.a.m/32/22289_2.png) [@R.T.A.M](https://discourse.julialang.org/u/R.T.A.M)\
**Post date:** [September 16, 2023, 11:47am UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/1 "2023-09-16T11:47:47Z")

</div>

I was reading the Developer Documentation on Eval of Julia code and the 10,000 foot view of the whole process. I wondered if this is still up to date since there were speed ups in 1.9.3 ?

I was also wondering if, **Hypothetically** , it would be possible to write LLVM in Julia?

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 16, 2023, 12:49pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/3 "2023-09-16T12:49:46Z")

</div>

(I’ve moved this to the “General” section, as this is not about development of julia internals)

In theory, yes - but practically, that’s quite a huge amount of work.

---

<div class="post-metadata">

**Author:** ![R.T.A.M](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/r.t.a.m/32/22289_2.png) [@R.T.A.M](https://discourse.julialang.org/u/R.T.A.M)\
**Post date:** [September 16, 2023, 1:06pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/4 "2023-09-16T13:06:03Z")

</div>

Google Bard agreed that it would be a massive undertaking.

---

<div class="post-metadata">

**Author:** ![AMJ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amj/32/214096_2.png) [@AMJ](https://discourse.julialang.org/u/AMJ)\
**Post date:** [September 16, 2023, 1:38pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/5 "2023-09-16T13:38:04Z")

</div>

There are new compilers popping up. Like [Tilde](https://github.com/RealNeGate/Cuik/tree/master/tb) (project still in its infancy)that is a backend for [Cuik](https://github.com/RealNeGate/Cuik/) C compiler. Odin-lang will also be using Tilde as their backend in future. Nevertheless hard and ambitious to replace LLVM.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [September 16, 2023, 5:06pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/6 "2023-09-16T17:06:49Z")

</div>

On the one hand, can the Julia language express a compiler? Yes, certainly, it’s Turing complete so it can express anything. On the other hand does it make sense to try? Not at the moment, LLVM is doing its job so the best place to spend effort is on making Julia able to do things we all want like threaded GC and latency reduction / cached code and compiling to a small binary for some people’s uses, and such.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 3, 2025, 3:18pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/7 "2025-09-03T15:18:05Z")

</div>

> [@R.T.A.M](#):
>
> would be possible to write LLVM in Julia?

yes, but I believe better to _bypass_ LLVM (for non-default Julia [mode]) as Zig did:

> Debug compilation is 5 times faster with Zig’s x86 Backend selected by default

> **[0.15.1 Release Notes ⚡ The Zig Programming Language](https://ziglang.org/download/0.15.1/release-notes.html#x86-Backend)**

> Using the self-hosted x86 backend also means you are not subject to the effects of upstream LLVM bugs, of which we are currently tracking over 60. In fact, the self-hosted x86 backend already passes a larger subset of our “behavior test suite” than the LLVM backend does (1984/2008 vs 1977/2008). In other words, this backend provides a more complete and correct implementation of the Zig language.

Zig used to default to LLVM, and still does in some cases like on Windows.

Note LLVM is Julia’s default (huge) compiler backend. You can see lowered code, then LLVM bitcode with `@code_llvm`, and in the end native code with `@code_native`. In many cases you wouldn’t need to see or use the LLVM bitcode, if code is already precompiled you would get most of its befefits, but you still need to bundle the huge LLVM with Julia, though not if I recall when using juliac, but having a smaller compiler backend could then help. Some code used LLVM intrinsics, directly or indirectly, and you would still miss out on that.

> [@Is it time to make LLVM optional and how?](https://discourse.julialang.org/t/is-it-time-to-make-llvm-optional-and-how/112677/4):
>
> I personally doubt it will be worth the effort to support a second compiler in the next few years; it’s more likely that one could replace it with an interpreter under more circumstances (this has already been discussed as a way to reduce startup latency). I generally don’t find these speculative discussions to be too productive. Proposing huge undertakings (e.g. replacing the compiler) never amounts to much, because you aren’t proposing to do the work yourself, nor to fund it. No one is goi…

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [September 3, 2025, 4:30pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-write-llvm-in-julia/103925/8 "2025-09-03T16:30:24Z")

</div>

I think what you really mean is could we write a compiler for Julia in Julia rather than trying to cover the full scope of LLVM.

One application for this would be for debugging. For example, we have a Julia interpreter written in Julia:

> **[GitHub - JuliaDebug/JuliaInterpreter.jl: Interpreter for Julia code](https://github.com/JuliaDebug/JuliaInterpreter.jl)**
>
> Interpreter for Julia code
