TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Lighter alternatives to LLVM

13 pointsby stealthcatover 2 years ago
Is it the only way to produce fast cross-platform binaries? LLVM is huge and compile times can be slow.<p>I found several compilers related:<p>0. GCC<p>1. Zig started as LLVM frontend, finally with self-hosting, can do cross-platform codegen without LLVM.

8 comments

cstrahanover 2 years ago
See QBE: <a href="https:&#x2F;&#x2F;c9x.me&#x2F;compile&#x2F;" rel="nofollow">https:&#x2F;&#x2F;c9x.me&#x2F;compile&#x2F;</a><p>&gt; QBE is a compiler backend that aims to provide 70% of the performance of industrial optimizing compilers in 10% of the code. QBE fosters language innovation by offering a compact user-friendly and performant backend. The size limit constrains QBE to focus on the essential and prevents embarking on a never-ending path of diminishing returns.<p>&gt; The current version of QBE can target amd64 (linux and osx), arm64, and riscv64.<p>&quot;QBE vs. LLVM&quot;: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=25273907" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=25273907</a>
albinahlbackover 2 years ago
I presume you compile C&#x2F;C++ code. How does your file structure look like? Do you have a lot of files with little to no content? You can speed things up by merging files. I have managed to reduce the building speed by around 95% by doing such simple things.<p>Reducing the amount of unnecessary headers is also beneficial, but in comparison to merging files it barely makes a difference.
TUSFover 2 years ago
The Go compiler doesn&#x27;t use LLVM. They pretty much built all their codegen for every platform from the ground up. But that&#x27;s only possible because they have the resources to do that. As far as I know, the only viable alternative to LLVM, is GCC, which I don&#x27;t think is &quot;lighter&quot;.<p>Also, Zig still uses LLVM. It&#x27;s just that because LLVM is C++, the Stage 1 compiler had to be in C++ as well, and they&#x27;ve since slimmed it down by having LLVM expose a C API that the (now &quot;self-hosted&quot;) Zig compiler can directly talk to instead.
评论 #33808466 未加载
JonChesterfieldover 2 years ago
Libfirm and cranelift are vaguely similar ideas, not yet mentioned here
marssaxmanover 2 years ago
LLVM really is the tail that wags the dog for smaller compiler projects.<p>In addition to QBE as many have suggested, you might take a look at AsmJit, if you are using C++.
gavinrayover 2 years ago
I&#x27;d say QBE probably
tester756over 2 years ago
That&#x27;s interesting question<p>We definitely need to see some modern alternatives
hulituover 2 years ago
GCC.