aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
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-11-04x86_64: implement split vector storesJacob Young
Closes #25809
2025-11-04Fixing SPIR-V header generator magic + Adding Zig compiler version to SPIR-V ↵kbz_8
OpSource (#25435) * fixing Zig generator magic in SPIR-V header; adding zig compiler version to SPIR-V OpSource * Update src/codegen/spirv/Module.zig Co-authored-by: rpkak <67059904+rpkak@users.noreply.github.com> --------- Co-authored-by: rpkak <67059904+rpkak@users.noreply.github.com>
2025-11-01cbe: fix more MIPS register names in inline assemblyBingwu Zhang
2025-10-30Merge pull request #25558 from jacobly0/elfv2-load-objJacob Young
Elf2: start implementing input object loading
2025-10-30aarch64: fix macho external referencesJacob Young
2025-10-30aarch64: implement optional comparisonsJacob Young
2025-10-30std.debug.lockStderrWriter: also return ttyconfMatthew Lugg
`std.Io.tty.Config.detect` may be an expensive check (e.g. involving syscalls), and doing it every time we need to print isn't really necessary; under normal usage, we can compute the value once and cache it for the whole program's execution. Since anyone outputting to stderr may reasonably want this information (in fact they are very likely to), it makes sense to cache it and return it from `lockStderrWriter`. Call sites who do not need it will experience no significant overhead, and can just ignore the TTY config with a `const w, _` destructure.
2025-10-29x86_64: add `lret` encodingJacob Young
Closes #25608
2025-10-29x86_64: continue hacking around unimplemented linker logicJacob Young
Closes #25666
2025-10-29x86_64: fix encoding for out with an immediate portJacob Young
Closes #25547
2025-10-29Elf2: start implementing dynamic linkingJacob Young
2025-10-29Elf2: load relocations from input objectsJacob Young
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-29wasm linking: handle unreachable call_indirectAndrew Kelley
The compiler crashed when we tried to call a function pointer for which the type signature does not match any function body or function import in the entire wasm executable, because there is no way to create a reference to a function without it being in the function table or import table. Solution is to make this instruction lower to unreachable.
2025-10-29compiler: update for introduction of std.IoAndrew Kelley
only thing remaining is using libc dns resolution when linking libc
2025-10-28spirv: fix airWorkGroupSize to use workgroup_size builtinCooksey99
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-19cbe: fix MIPS register names in inline assemblyBingwu Zhang
Zig uses "rN" for MIPS register clobbers which are more ergonomic and easier to write (.rN vs. .@"$N"). However, GCC and Clang uses "$N". Bug: #25613 Signed-off-by: Bingwu Zhang <xtex@xtexx.eu.org>
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-10Coff: implement threadlocal variablesJacob Young
2025-10-07llvm.Builder: allow `Metadata` to reference metadata stringsJacob Young
Closes #25486
2025-10-03Support generating import libraries from mingw .def files without LLVMRyan Liptak
For the supported COFF machine types of X64 (x86_64), I386 (x86), ARMNT (thumb), and ARM64 (aarch64), this new Zig implementation results in byte-for-byte identical .lib files when compared to the previous LLVM-backed implementation.
2025-10-03x86_64: fix bool vector init register clobberJacob Young
Closes #25439
2025-10-02Coff: deleteJacob Young
2025-10-02Coff2: create a new linker from scratchJacob Young
2025-10-02x86_64: fix windows calling convention abiJacob Young
2025-09-27x86_64: fix `@mulAdd` miscompJacob Young
2025-09-27x86_64: fix `~`/`!` miscompsJacob Young
2025-09-27x86_64: fix `@floatFromInt` miscompsJacob Young
2025-09-27x86_64: fix unencodable `rem` loweringsmlugg
The memory operand might use one of the extended GPRs R8 through R15 and hence require a REX prefix, but having a REX prefix makes the high-byte register AH unencodeable as the src operand. This latent bug was exposed by this branch, presumably because `select` now happens to be putting something in an extended GPR instead of a legacy GPR. In theory this could be fixed with minimal cost by introducing a way to communicate to `select` that neither the destination memory nor the other temporary can be in an extended GPR. However, I just went for the simple solution which comes at a cost of one trivial instruction: copy the remainder from AH to AL, and *then* copy AL to the destination.
2025-09-27x86_64: fix miscompilation of `mul` on vectors of large intsmlugg
2025-09-27x86_64: generate better constant memcpy codemlugg
`rep movsb` isn't usually a great idea here. This commit makes the logic which tentatively existed in `genInlineMemcpy` apply in more cases, and in particular applies it to the "new" backend logic. Put simply, all copies of 128 bytes or fewer will now attempt this path first, where---provided there is an SSE register and/or a general-purpose register available---we will lower the operation using a sequence of 32, 16, 8, 4, 2, and 1 byte copy operations. The feedback I got on this diff was "Push it to master and if it miscomps I'll revert it" so don't blame me when it explodes
2025-09-26compiler: move self-hosted backends from src/arch to src/codegenAlex Rønne Petersen
2025-09-21Elf2: create a new linker from scratchJacob Young
This iteration already has significantly better incremental support. Closes #24110
2025-09-21aarch64/zonCast: don't return a pointer to a stack elementFrank Denis
Elements are computed at comptime, so don't declare them as "var".
2025-09-20aarch64: fix behavior failuresJacob Young
2025-09-20aarch64: implement `ptr_slice_*_ptr`Jacob Young