TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Lighter alternatives to LLVM

13 点作者 stealthcat超过 2 年前
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 条评论

cstrahan超过 2 年前
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>
albinahlback超过 2 年前
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.
TUSF超过 2 年前
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 未加载
JonChesterfield超过 2 年前
Libfirm and cranelift are vaguely similar ideas, not yet mentioned here
marssaxman超过 2 年前
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++.
gavinray超过 2 年前
I&#x27;d say QBE probably
tester756超过 2 年前
That&#x27;s interesting question<p>We definitely need to see some modern alternatives
hulitu超过 2 年前
GCC.