as new to zig programming languages I just want to know the whole reason why zig is moving away from llvm ?
there are answers in this thread
I saw the GitHub discussion, I honestly didn’t understand anything from it. That why i asked here
The link that @JPL posted leads to a thread in this forum discussing the issue, it’s not a link to the GitHub Issue per se.
My bad @dude_the_builder just saw it now tnx
- LLVM is slow.
- Using a third-party backend for the compiler limits what kind of end-to-end innovations are possible.
- Bugs in Zig are significantly easier for us to fix than bugs in LLVM.
- LLVM regularly ships with regressions even though we report them against release candidates.
- Building Zig from source is made obnoxiously difficult by LLVM. This affects Zig’s availability in system package managers, limits contributions from the open source community, and makes our bootstrap chain depend on C++.
- Many of our users are interested in avoiding an LLVM monoculture.
- LLVM development moves slowly. Zig gained a C backend faster than LLVM, for example.
- We want to add support for many more target CPU architectures than LLVM supports.
- We cannot control the quality of the LLVM libraries that appear in the wild, and misconfigured LLVM installations reflect poorly on Zig itself. This happens regularly.
The short answer is that LLVM (and clang) is welded to C++ specifically in many non-optimal ways.
A longer answer is in this post that discusses many of the ways in which clang is sub-optimal for general compiling rather than just C++: The future of Clang-based tooling | Trail of Bits Blog
Will this new backend be adaptable for other languages, or is it designed specifically to cater only to Zig, unlike the more general-purpose LLVM?
For now, the latter. I will consider the scope increase later once our more important goals have been achieved.
Just wondering, would a move away from LLVM mean reduced quality of generated code? A faster backend means increased developer QoL but does speed really matter for a release build?
Zig it’s not moving away from LLVM, but decoupling from it, on the other hand zig will still be able to output LLVM bit code without requiring LLVM dependencies directly output LLVM bitcode rather than using LLVM's IRBuilder API · Issue #13265 · ziglang/zig · GitHub