{"id":39945,"date":"2023-07-03T16:34:11","date_gmt":"2023-07-03T20:34:11","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=39945"},"modified":"2023-07-03T16:34:11","modified_gmt":"2023-07-03T20:34:11","slug":"zig-proposal-to-drop-llvm","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/07\/03\/zig-proposal-to-drop-llvm\/","title":{"rendered":"Zig Proposal to Drop LLVM"},"content":{"rendered":"<p><a href=\"https:\/\/kristoff.it\/blog\/zig-new-relationship-llvm\/\">Loris Cro and Andrew Kelley<\/a> (in 2020):<\/p>\n<blockquote cite=\"https:\/\/kristoff.it\/blog\/zig-new-relationship-llvm\/\">\n<p>In the early days, Zig was but a thin frontend in front of LLVM. This was instrumental for getting started quickly and filling in gaps of Andrew&rsquo;s knowledge as a compiler developer. Now, the training wheels of the bicycle are coming off, and LLVM is transitioning into an optional component.<\/p>\n<p>[&#8230;]<\/p>\n<p>The move to a self-hosted compiler for Zig has similar advantages for the core contributors, but it also makes LLVM an optional dependency, increases compilation speed (instead of losing it), and adds an amazing feature for debug builds of your code: incremental compilation with in-place binary patching, <a href=\"https:\/\/kristoff.it\/blog\/what-is-zig-comptime\/\">another<\/a> <a href=\"https:\/\/kristoff.it\/blog\/zig-colorblind-async-await\/\">unique<\/a> Zig feature.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/github.com\/ziglang\/zig\/issues\/16270\">Andrew Kelley<\/a> (via <a href=\"https:\/\/news.ycombinator.com\/item?id=36529456\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/ziglang\/zig\/issues\/16270\"><p>This issue is to fully eliminate LLVM, Clang, and LLD libraries from the Zig project.<\/p><p>[&#8230;]<\/p><p>In exchange, Zig gains these benefits:<\/p><ul><li>All our bugs are belong to us.<\/li><li>The compiler becomes trivial to build from source and to bootstrap with only a C compiler on the host system.<\/li><li>We stop dealing with annoying problems introduced by Linux distributions and package managers such as Homebrew related to LLVM, Clang, and LLD. There have been and continue to be <a href=\"https:\/\/github.com\/ziglang\/zig\/issues?q=is%3Aissue+homebrew+\">many<\/a>.<\/li><li>The Zig compiler binary goes from about 150 MiB to 5 MiB.<\/li><li>Compilation speed is increased by orders of magnitude.<\/li><li>We can implement our own optimization passes that push the state of the art of computing forward.<\/li><li>We can attract research projects such as <a href=\"https:\/\/github.com\/AliveToolkit\/alive2\">alive2<\/a><\/li><li>We can attract direct contributions from Intel, ARM, RISC-V chip manufacturers, etc., who have a vested interest in making our machine code better on their CPUs.<\/li><\/ul><\/blockquote>\n<p>At least initially, Zig would lose support for C++ and Objective-C, along with less popular architectures.<\/p>\n\n<p><a href=\"https:\/\/avestura.dev\/blog\/problems-of-c-and-how-zig-addresses-them\">Aryan Ebrahimpour<\/a> (via <a href=\"https:\/\/news.ycombinator.com\/item?id=36572645\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/avestura.dev\/blog\/problems-of-c-and-how-zig-addresses-them\">\n<p>The Zig programming language has garnered considerable attention as a new systems\nprogramming language, positioning itself as <em>the better C<\/em>. But how does Zig achieve this?\nIn this blog post, our aim is to examine some of the issues associated with C and explore\nhow Zig intends to address them.<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2018\/11\/16\/the-zig-programming-language\/\">The Zig Programming Language<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Loris Cro and Andrew Kelley (in 2020): In the early days, Zig was but a thin frontend in front of LLVM. This was instrumental for getting started quickly and filling in gaps of Andrew&rsquo;s knowledge as a compiler developer. Now, the training wheels of the bicycle are coming off, and LLVM is transitioning into an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-07-03T20:34:13Z","apple_news_api_id":"3ea677cf-708a-4ef6-8ddd-dda1f8212969","apple_news_api_modified_at":"2023-07-03T20:34:14Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/APqZ3z3CKTvaN3d2h-CEpaQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[230,255,46,229,71,1753],"class_list":["post-39945","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-clang","tag-compiler","tag-languagedesign","tag-llvm","tag-programming","tag-zig-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/39945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=39945"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/39945\/revisions"}],"predecessor-version":[{"id":39946,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/39945\/revisions\/39946"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=39945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=39945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=39945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}