aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
AgeCommit message (Collapse)Author
2025-11-06llvm: add extra clobbers to valgrind requestsDavid Rubin
This seems to work around a very puzzling miscompilation first present in LLVM 21.x. We already unconditionally add these clobbers to inline assembly that came from the source, the valgrind requests should also contain them.
2025-11-06llvm: clobber `rdx` instead of `edx` for x86-64 valgrind requestDavid Rubin
2025-10-29Merge pull request #25592 from ziglang/init-std.IoAndrew Kelley
std: Introduce `Io` Interface
2025-10-29remove all IBM AIX and z/OS supportAlex Rønne Petersen
As with Solaris (dba1bf935390ddb0184a4dc72245454de6c06fd2), we have no way to actually audit contributions for these OSs. IBM also makes it even harder than Oracle to actually obtain these OSs. closes #23695 closes #23694 closes #3655 closes #23693
2025-10-29compiler: update for introduction of std.IoAndrew Kelley
only thing remaining is using libc dns resolution when linking libc
2025-10-28Merge pull request #25691 from GasInfinity-Forks/x86_16-gccAlex Rønne Petersen
feat: init x86_16 arch via CBE
2025-10-27remove all Oracle Solaris supportAlex Rønne Petersen
There is no straightforward way for the Zig team to access the Solaris system headers; to do this, one has to create an Oracle account, accept their EULA to download the installer ISO, and finally install it on a machine or VM. We do not have to jump through hoops like this for any other OS that we support, and no one on the team has expressed willingness to do it. As a result, we cannot audit any Solaris contributions to std.c or other similarly sensitive parts of the standard library. The best we would be able to do is assume that Solaris and illumos are 100% compatible with no way to verify that assumption. But at that point, the solaris and illumos OS tags would be functionally identical anyway. For Solaris especially, any contributions that involve APIs introduced after the OS was made closed-source would also be inherently more risky than equivalent contributions for other proprietary OSs due to the case of Google LLC v. Oracle America, Inc., wherein Oracle clearly demonstrated its willingness to pursue legal action against entities that merely copy API declarations. Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in maintenance mode since, presumably to be retired completely sometime in the 2030s. For these reasons, this commit removes all Oracle Solaris support. Anyone who still wishes to use Zig on Solaris can try their luck by simply using illumos instead of solaris in target triples - chances are it'll work. But there will be no effort from the Zig team to support this use case; we recommend that people move to illumos instead.
2025-10-27feat: init x86_16 arch via CBEGasInfinity
2025-10-25llvm: remove some workarounds in loadTruncate()Alex Rønne Petersen
No longer needed with LLVM 21.
2025-10-23std.builtin: add CallingConvention.sh_interruptAlex Rønne Petersen
Only supported in CBE.
2025-10-23std.builtin: add CallingConvention.microblaze_interruptAlex Rønne Petersen
Only supported in CBE.
2025-10-23std.builtin: add CallingConvention.msp430_interruptAlex Rønne Petersen
Supported by LLVM and CBE.
2025-10-23std.builtin: add CallingConvention.x86_64_x32Alex Rønne Petersen
This was forgotten during the refactoring of std.builtin.CallingConvention. It mirrors mips64_n32 for MIPS.
2025-10-23std.Target: add tags and info for alpha, hppa, microblaze, shAlex Rønne Petersen
2025-10-23std.Target: add arceb and xtensaeb Cpu.Arch tagsAlex Rønne Petersen
2025-10-19compiler: add support for arc_interrupt calling conventionAlex Rønne Petersen
Only for use with the C backend at the moment.
2025-10-16llvm-backend: fix uefi data layoutbnuuydev
the old logic caused the uefi case to fall through which caused an assertion assertion in llvm to fail, as the data layout was wrong.
2025-10-07llvm.Builder: allow `Metadata` to reference metadata stringsJacob Young
Closes #25486
2025-10-02x86_64: fix windows calling convention abiJacob Young
2025-09-26compiler: move self-hosted backends from src/arch to src/codegenAlex Rønne Petersen
2025-09-20llvm backend: remove canElideLoad mechanismAndrew Kelley
2025-09-16llvm: fix tagged union payload size in debug infomlugg
Resolves: #24415
2025-08-30Merge pull request #25077 from ziglang/GenericReaderAndrew Kelley
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30Revert "llvm: workaround crashes in llvm loop optimizations"Alex Rønne Petersen
This reverts commit b4fd57a9c114748afb9ba0a04bede61089a02ddf. https://github.com/llvm/llvm-project/pull/149743
2025-08-30llvm: switch to native f16 IR type for all hexagon targetsAlex Rønne Petersen
This was fixed in LLVM 21, in particular for targets older than v68.
2025-08-30llvm: remove f16 special case for soft float aarch64Alex Rønne Petersen
2025-08-30llvm: switch to native f128 IR type for nvptxAlex Rønne Petersen
LLVM 21 added support for this.
2025-08-30llvm: switch to native f16 IR type for s390xAlex Rønne Petersen
LLVM 21 added support for this.
2025-08-30llvm: update data layout strings for LLVM 21Alex Rønne Petersen
2025-08-30std.Target: add managarm OS tagAlex Rønne Petersen
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-29LLVM backend:fix align 1 sret parameter load returnedAndrew Kelley
closes #25067
2025-08-26std.Target: add vita osMaciej 'vesim' Kuliński
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-25start adding big endian RISC-V supportAlex Rønne Petersen
The big endian RISC-V effort is mostly driven by MIPS (the company) which is pivoting to RISC-V, and presumably needs a big endian variant to fill the niche that big endian MIPS (the ISA) did. GCC already supports these targets, but LLVM support will only appear in 22; this commit just adds the necessary target knowledge and checks on our end.
2025-08-22feat(std.Target): add 3ds osGasInfinity
2025-08-13Merge pull request #24816 from mlugg/small-fixesMatthew Lugg
two small fixes
2025-08-13Merge pull request #24674 from Justus2308/undef-shift-bitwiseMatthew Lugg
Sema: Improve comptime arithmetic undef handling
2025-08-13llvm: unions which are equivalent to enums are not by-refmlugg
The LLVM backend lowers unions where all fields are zero-bit as equivalent to their backing enum, and expects them to have the same by-ref-ness in at least one place in the backend, probably more. Resolves: #23577
2025-08-13llvm: support small error limitsmlugg
Resolves: #23533
2025-08-13optimize `@intCast` in llvm backend (#24739)Rue
2025-08-12Sema: Improve comptime arithmetic undef handlingJustus Klausecker
This commit expands on the foundations laid by https://github.com/ziglang/zig/pull/23177 and moves even more `Sema`-only functionality from `Value` to `Sema.arith`. Specifically all shift and bitwise operations, `@truncate`, `@bitReverse` and `@byteSwap` have been moved and adapted to the new rules around `undefined`. Especially the comptime shift operations have been basically rewritten, fixing many open issues in the process. New rules applied to operators: * `<<`, `@shlExact`, `@shlWithOverflow`, `>>`, `@shrExact`: compile error if any operand is undef * `<<|`, `~`, `^`, `@truncate`, `@bitReverse`, `@byteSwap`: return undef if any operand is undef * `&`, `|`: Return undef if both operands are undef, turn undef into actual `0xAA` bytes otherwise Additionally this commit canonicalizes the representation of aggregates with all-undefined members in the `InternPool` by disallowing them and enforcing the usage of a single typed `undef` value instead. This reduces the amount of edge cases and fixes a bunch of bugs related to partially undefined vecs. List of operations directly affected by this patch: * `<<`, `<<|`, `@shlExact`, `@shlWithOverflow` * `>>`, `@shrExact` * `&`, `|`, `~`, `^` and their atomic rmw + reduce pendants * `@truncate`, `@bitReverse`, `@byteSwap`
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-03llvm: correctly lower `double_integer` for rv32David Rubin
2025-08-01build system: replace fuzzing UI with build UI, add time reportmlugg
This commit replaces the "fuzzer" UI, previously accessed with the `--fuzz` and `--port` flags, with a more interesting web UI which allows more interactions with the Zig build system. Most notably, it allows accessing the data emitted by a new "time report" system, which allows users to see which parts of Zig programs take the longest to compile. The option to expose the web UI is `--webui`. By default, it will listen on `[::1]` on a random port, but any IPv6 or IPv4 address can be specified with e.g. `--webui=[::1]:8000` or `--webui=127.0.0.1:8000`. The options `--fuzz` and `--time-report` both imply `--webui` if not given. Currently, `--webui` is incompatible with `--watch`; specifying both will cause `zig build` to exit with a fatal error. When the web UI is enabled, the build runner spawns the web server as soon as the configure phase completes. The frontend code consists of one HTML file, one JavaScript file, two CSS files, and a few Zig source files which are built into a WASM blob on-demand -- this is all very similar to the old fuzzer UI. Also inherited from the fuzzer UI is that the build system communicates with web clients over a WebSocket connection. When the build finishes, if `--webui` was passed (i.e. if the web server is running), the build runner does not terminate; it continues running to serve web requests, allowing interactive control of the build system. In the web interface is an overall "status" indicating whether a build is currently running, and also a list of all steps in this build. There are visual indicators (colors and spinners) for in-progress, succeeded, and failed steps. There is a "Rebuild" button which will cause the build system to reset the state of every step (note that this does not affect caching) and evaluate the step graph again. If `--time-report` is passed to `zig build`, a new section of the interface becomes visible, which associates every build step with a "time report". For most steps, this is just a simple "time taken" value. However, for `Compile` steps, the compiler communicates with the build system to provide it with much more interesting information: time taken for various pipeline phases, with a per-declaration and per-file breakdown, sorted by slowest declarations/files first. This feature is still in its early stages: the data can be a little tricky to understand, and there is no way to, for instance, sort by different properties, or filter to certain files. However, it has already given us some interesting statistics, and can be useful for spotting, for instance, particularly complex and slow compile-time logic. Additionally, if a compilation uses LLVM, its time report includes the "LLVM pass timing" information, which was previously accessible with the (now removed) `-ftime-report` compiler flag. To make time reports more useful, ZIR and compilation caches are ignored by the Zig compiler when they are enabled -- in other words, `Compile` steps *always* run, even if their result should be cached. This means that the flag can be used to analyze a project's compile time without having to repeatedly clear cache directory, for instance. However, when using `-fincremental`, updates other than the first will only show you the statistics for what changed on that particular update. Notably, this gives us a fairly nice way to see exactly which declarations were re-analyzed by an incremental update. If `--fuzz` is passed to `zig build`, another section of the web interface becomes visible, this time exposing the fuzzer. This is quite similar to the fuzzer UI this commit replaces, with only a few cosmetic tweaks. The interface is closer than before to supporting multiple fuzz steps at a time (in line with the overall strategy for this build UI, the goal will be for all of the fuzz steps to be accessible in the same interface), but still doesn't actually support it. The fuzzer UI looks quite different under the hood: as a result, various bugs are fixed, although other bugs remain. For instance, viewing the source code of any file other than the root of the main module is completely broken (as on master) due to some bogus file-to-module assignment logic in the fuzzer UI. Implementation notes: * The `lib/build-web/` directory holds the client side of the web UI. * The general server logic is in `std.Build.WebServer`. * Fuzzing-specific logic is in `std.Build.Fuzz`. * `std.Build.abi` is the new home of `std.Build.Fuzz.abi`, since it now relates to the build system web UI in general. * The build runner now has an **actual** general-purpose allocator, because thanks to `--watch` and `--webui`, the process can be arbitrarily long-lived. The gpa is `std.heap.DebugAllocator`, but the arena remains backed by `std.heap.page_allocator` for efficiency. I fixed several crashes caused by conflation of `gpa` and `arena` in the build runner and `std.Build`, but there may still be some I have missed. * The I/O logic in `std.Build.WebServer` is pretty gnarly; there are a *lot* of threads involved. I anticipate this situation improving significantly once the `std.Io` interface (with concurrency support) is introduced.
2025-07-30llvm: fix atomic widening of packed structsKendall Condon
Additionally, disable failing big-endian atomic test also improve test paramaters to catch this when condition is removed also some other cleanups
2025-07-22aarch64: add new from scratch self-hosted backendJacob Young
2025-07-22llvm: fix switch loop on larger than pointer integerMatthew Lugg
2025-07-20llvm: workaround crashes in llvm loop optimizationsJacob Young
Workaround for #24383
2025-07-16fix mips clobbersAndrew Kelley
2025-07-16inline assembly: use typesAndrew Kelley
until now these were stringly typed. it's kinda obvious when you think about it.