aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2025-04-04llvm: Fix i128 alignment for various targets.Alex Rønne Petersen
This ABI bug was fixed in LLVM 20.
2025-04-04llvm: Set target-abi module flag.Alex Rønne Petersen
LLVM is increasingly making use of this module flag when present.
2025-04-04std.Target: Add Abi.muslf32 and Abi.muslsf.Alex Rønne Petersen
2025-04-04std.Target: Update CPU models/features for LLVM 20.Alex Rønne Petersen
Closes #21818.
2025-04-04compiler: Updates for LLVM/Clang 20 API changes.Alex Rønne Petersen
2025-03-24Use `-unknown` when converting WASI/Emscripten target triples into LLVM triplesCarl Åstholm
The "musl" part of the Zig target triples `wasm32-wasi-musl` and `wasm32-emscripten-musl` refers to the libc, not really the ABI. For WASM, most LLVM-based tooling uses `wasm32-wasi`, which is normalized into `wasm32-unknown-wasi`, with an implicit `-unknown` and without `-musl`. Similarly, Emscripten uses `wasm32-unknown-emscripten` without `-musl`. By using `-unknown` instead of `-musl` we get better compatibility with external tooling.
2025-03-23Merge pull request #23209 from jacobly0/x86_64-rewriteJacob Young
x86_64: rewrite wrapping multiplication
2025-03-23Lower `@returnAddress` to a constant 0 in Emscripten release buildsCarl Åstholm
Emscripten currently implements `emscripten_return_address()` by calling out into JavaScript and parsing a stack trace, which introduces significant overhead that we would prefer to avoid in release builds. This is especially problematic for allocators because the generic parts of `std.mem.Allocator` make frequent use of `@returnAddress`, even though very few allocator implementations even observe the return address, which makes allocators nigh unusable for performance-critical applications like games if the compiler is unable to devirtualize the allocator calls.
2025-03-21x86_64: rewrite wrapping multiplicationJacob Young
2025-03-21big.int: fix yet another truncate bugJacob Young
Too many bugs have been found with `truncate` at this point, so it was rewritten from scratch. Based on the doc comment, the utility of `convertToTwosComplement` over `r.truncate(a, .unsigned, bit_count)` is unclear and it has a subtle behavior difference that is almost certainly a bug, so it was deleted.
2025-03-19spirv: Assemble OpTypeRuntimeArray.dan
2025-03-19compiler: Support more GCC code models and fix the mapping to LLVM code models.Alex Rønne Petersen
Closes #22517.
2025-03-18spirv: require int8/int16 capabilitiesAli Cheraghi
2025-03-18spirv: aligned load for physical storage variablesAli Cheraghi
Resolves #23212
2025-03-18spirv: packed struct init + field val accessAli Cheraghi
2025-03-17spirv/target: arbitrary_precision_integers feature supportAli Cheraghi
2025-03-17spirv: lower more types in assemblerAli Cheraghi
2025-03-17target: split `addresses` and `physical_storage_buffer` featuresAli Cheraghi
2025-03-17Sema: error on illegal code when targeting spirvAli Cheraghi
2025-03-17spirv: don't hardcode test error type alignmentAli Cheraghi
2025-03-08Merge pull request #22998 from jacobly0/x86_64-rewriteAndrew Kelley
x86_64: rewrite aggregate init
2025-03-08llvm: Replace DataLayoutBuilder with a simple target -> string switch.Alex Rønne Petersen
This should be a lot easier to maintain. It's also a small step towards eventually making the builder API parse the data layout string in order to answer layout questions that we need to ask during code generation.
2025-03-07x86_64: implement write register splittingJacob Young
2025-03-05Remove uses of deprecated callconv aliasesLinus Groh
2025-02-27Move the compiler's LLVM bitcode builder to std.zig.llvm.Alex Rønne Petersen
2025-02-24spirv: get rid of function_types cacheRobin Voetter
This deep hash map doesn't work
2025-02-24spirv: do not generate unnecessary forward pointerAli Cheraghi
Co-authored-by: Robin Voetter <robin@voetter.nl>
2025-02-24spirv: replace some unreachables with compile errorsAli Cheraghi
2025-02-24Merge pull request #22154 from alexrp/disable-intrinsicsAlex Rønne Petersen
compiler: Implement `@disableIntrinsics()` builtin function.
2025-02-24llvm: Fix C ABI integer promotion for loongarch64.Alex Rønne Petersen
It appears to just be a 1:1 copy of riscv64, including the super weird sign extension quirk for u32. Contributes to #21671.
2025-02-23cbe: Implement support for -fno-builtin and @disableIntrinsics().Alex Rønne Petersen
2025-02-23compiler: Implement @disableIntrinsics() builtin function.Alex Rønne Petersen
Closes #21833. Closes #22110.
2025-02-22zig build fmtAndrew Kelley
2025-02-23Merge pull request #22903 from alexrp/llvm-nobuiltin-memcpy-inlineAlex Rønne Petersen
`llvm`: Use inline variants of `memcpy`/`memset` intrinsics when using `-fno-builtin`
2025-02-22llvm: Use inline variants of memcpy/memset intrinsics when using -fno-builtin.Alex Rønne Petersen
This is a correctness issue: When -fno-builtin is used, we must assume that we could be compiling the memcpy/memset implementations, so generating calls to them is problematic.
2025-02-22llvm.Builder: Update some intrinsic definitions for LLVM 19.Alex Rønne Petersen
2025-02-21fix `-fsanitize-coverage-trace-pc-guard` and fuzzer support for C compile unitsXavier Bouchoux
- allow `-fsanitize-coverage-trace-pc-guard` to be used on its own without enabling the fuzzer. (note that previouly, while the flag was only active when fuzzing, the fuzzer itself doesn't use it, and the code will not link as is.) - add stub functions in the fuzzer to link with instrumented C code (previously fuzzed tests failed to link if they were calling into C): while the zig compile unit uses a custom `EmitOptions.Coverage` with features disabled, the C code is built calling into the clang driver with "-fsanitize=fuzzer-no-link" that automatically enables the default features. (see https://github.com/llvm/llvm-project/blob/de06978ebcff5f75913067b019d2d522d0be0872/clang/lib/Driver/SanitizerArgs.cpp#L587) - emit `-fsanitize-coverage=trace-pc-guard` instead of `-Xclang -fsanitize-coverage-trace-pc-guard` so that edge coverrage is enabled by clang driver. (previously, it was enabled only because the fuzzer was)
2025-02-18spirv: extend supported `c` constraint valuesAli Cheraghi
2025-02-18spirv: ziggify and remove unknown spirv featuresAli Cheraghi
`OpCapability` and `OpExtension` now can also be emitted from inline assembly
2025-02-18spirv: respect cpu featuresAli Cheraghi
2025-02-18spirv: cache more types & merge constructX functionsAli Cheraghi
2025-02-17std.Target: Remove functions that just wrap component functions.Alex Rønne Petersen
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look at multiple components of the target. But functions like isWasm(), isDarwin(), isGnu(), etc only exist to save 4-8 characters. I don't think this is a good enough reason to keep them, especially given that: * It's not immediately obvious to a reader whether target.isDarwin() means the same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar functions *do* look at multiple components. * It's not clear where we would draw the line. The logical conclusion before this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(), Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand. * It's nice to just have a single correct way of doing something.
2025-02-17std.builtin: Rename CallingConvention.propeller1_sysv to propeller_sysv.Alex Rønne Petersen
2025-02-17std.builtin: Rename CallingConvention.wasm_watc to wasm_mvp.Alex Rønne Petersen
2025-02-17std.builtin: Remove CallingConvention.arm_(apcs,aapcs16_vfp).Alex Rønne Petersen
* arm_apcs is the long dead "OABI" which we never had working support for. * arm_aapcs16_vfp is for arm-watchos-none which is a dead target that we've dropped support for.
2025-02-17std.Target: Remove Cpu.Arch.propeller2 and use a CPU feature instead.Alex Rønne Petersen
2025-02-17std.Target: Remove Cpu.Arch.spu_2.Alex Rønne Petersen
This was for a hobby project that appears to be dormant for now. This can be added back if the project is resumed in the future.
2025-02-10cbe: fix incomplete array element typesJacob Young
Can't imagine this working, but might as well try until I remember why. Closes #21439
2025-02-10cbe: fix crash rendering argument names in lazy functionsJacob Young
Closes #19905
2025-02-10cbe: emit linksection for `@export`Jacob Young
Closes #21490