aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2023-02-02Merge pull request #14502 from ziglang/link-owned-atomsJakub Konka
link: move ownership of linker atom from frontend to the linkers
2023-02-01link: make SpirV atoms fully owned by the linkerJakub Konka
2023-01-31move compiler's CType logic to std.TargetAndrew Kelley
This API only depends on std.Target and is extremely useful in build scripts when populating configure files.
2023-01-29cbe: fixes for tls, support for not linking libc, and enabling testskcbanner
- cbe: Implement linksection support, to support TLS when not linking libc - cbe: Support under-aligned variables / struct fields - cbe: Support packed structs (in the C definition of packed) - windows: Fix regression with x86 _tls_array - compiler_rt: Add 128-bit atomics to compiler_rt - tests: Re-enable threadlocal tests on cbe+windows, and llvm+x86 - tests: Re-enable f80 tests that now pass - ci: change windows ci to run the CBE behaviour tests with -lc, to match how the compiler is bootstrapped - update zig1.wasm
2023-01-29cbe: don't emit unused undefined array literalskcbanner
2023-01-26update CPU features to LLVM 16Andrew Kelley
2023-01-25update zig_llvm.cpp and zig_llvm.h to LLVM 16Andrew Kelley
2023-01-23zig fmt fixupkcbanner
2023-01-23cbe: fixes for x86kcbanner
- Emit calling convention - Fix .Naked handling for msvc - Add teb helper for x86 - Fix 128-bit shl implementation when rhs is >= 64 - Add 128-bit shl tests
2023-01-22llvm: implement explicit Win64 and SysV calling conventionsVeikka Tuominen
2023-01-20Merge pull request #14357 from kcbanner/llvm_byval_structVeikka Tuominen
llvm: implement Stdcall calling convention
2023-01-19llvm: implement Stdcall return typesVeikka Tuominen
2023-01-19llvm: pass non-scalars as byref in .Stdcallkcbanner
- add c_abi tests for .Stdcall - enable (x86|x86_64)-windows-gnu in the c_abi tests
2023-01-17windows x86_64 C ABI: pass byref structs as byref_mutVeikka Tuominen
2023-01-17llvm: do not offset packed struct field pointers if they have a host sizeVeikka Tuominen
Closes #14261
2023-01-16Sema: automatically optimize order of struct fieldsVeikka Tuominen
This is a simple starting version of the optimization described in #168 where the fields are just sorted by order of descending alignment.
2023-01-14llvm: correctly handle C ABI structs with f32/f64 alignment differencesVeikka Tuominen
Closes #13830
2023-01-14add C ABI tests for exotic float typesVeikka Tuominen
2023-01-10Fixes bug in AVR codegen for llvm backendFelix "xq" Queißner
2023-01-05llvm codegen: fix f16,f32,f64 nan bitcastsMichael Dusan
@bitCast from integer NaN representation to float NaN resulted in changed bits in float. This only happened with signaled NaN. - added test for signaled NaN - added tests for quiet NaN (for completeness) closes #14198
2023-01-04Sema: implement AVR address spacesMaciej 'vesim' Kuliński
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2023-01-03add -fopt-bisect-limitGuillaume Wenzek
2023-01-02fmt fixupskcbanner
2023-01-01cbe: changes to get zig2.c compiling under msvckcbanner
- Add cpuid / getXCR0 functions for the cbe to use instead of asm blocks - Don't cast between 128 bit types during truncation - Fixup truncation to use functions for shifts / adds - Fixup float casts for undefined values - Add test for 128 bit integer truncation
2023-01-01cbe: fixes for compiling zig2.c under msvckcbanner
- add zig_mul_i128 - render slice structs in static initializers without casts / c99 style init - add negative numbers and u128 to 128-bit multiply test
2023-01-01cbe: all behaviour tests now pass on msvckcbanner
- Fix zig_clz_u128 not respecting the bits argument. This was crashing the compile-rt addxf3 tests with the cbe - Instead of redering a negation for negative 128 bit int literals, render the literal as twos complement. This allows rendering int representations of floats correctly (specifically f80).
2023-01-01cbe: msvc atomicskcbanner
- Implement most atomic operations for msvc - Disable "atomicrmw with floats" test for cbe
2023-01-01cbe: airNot emits zig_not_ calls for integerskcbanner
2023-01-01cbe: 32 bit fixup for update-zig1kcbanner
2023-01-01cbe: more msvc compatibility workkcbanner
- Add .StaticInitializer to ValueRenderLocation to indicate that the emitted values must be constant expressions (no function calls, struct casting). - Add new path for special float types (nan, inf) that works in constant expressions - Implement windows.teb() using a syscall for .stage2_c because x64 MSVC doesn't support any kind of inline asm
2023-01-01cbe: nan builtins on msvc, fixup C2099 errors in static initializerskcbanner
- Map the __builtin_nan(f|l)? functions to nan(f|l)? on msvc - MSVC throws C2099 when initializing a struct with cast syntax in a global initializer. Added zig_as_init_ to handle this case, and generate it only in static initializers for > 64 bit ints. - Change float initialization to emit the integer representation in global initializers to avoid C2099 caused by calling nan.
2023-01-01cbe: msvc compatible int casting inside renderValue .Packed branchkcbanner
- Handle non-abiInt source types (like packed union) as sources in renderIntCast
2023-01-01cbe: more msvc fixeskcbanner
- Add Function.renderIntcast to handle common casting cases - Fixup casting inside aggregate initialization - Remove redundant cast in aggregate initialization - Fix renderValue .Packed branch for > 64 bit types
2023-01-01cbe: msvc compatibility for > 64 bit intcasts and truncating from > 64 to < ↵kcbanner
64 bit - Uses zig_as/zig_lo as necessary when int casting to support !zig_has_int128 - Remove redundant cast if the type is the same - Use zig_lo when truncating > 64 bits
2023-01-01cbe: handle msvc struct casting quirkkcbanner
MSVC can't explicitly cast a struct to a typedef of itself (ie. f128 to i128). Added a set of macros to handle float casting, and to not produce a cast for this specific case on MSVC. A better approach would probably be to know if the cast is redundant and not do it.
2023-01-01cbe: fixup casting to/from 128 bit int types, as they may not have compiler ↵kcbanner
support
2023-01-01cbe: first set of changes for msvc compatibilitykcbanner
- Forward declare int builtins, so the definitions aren't assumed incorrectly - Add define to handle MSVC not support static const in function parameter array lengths - Fixup several spots where int128 support was assumed. - Support zig_align - Support zig_export - Stub out some missing non-builtin functions - Added StringLiteral to automatically split string literals when they get to 16380 in size, which is the maxmimum pre-concatenation string literal size on MSVC.
2022-12-30llvm: do not pad vector element debug typesVeikka Tuominen
2022-12-30llvm: work around lldb bugsVeikka Tuominen
Closes #14122
2022-12-30fix generic function arg debug info referencing wrong parameterVeikka Tuominen
Closes #14123
2022-12-27llvm: add asserts and behavior tests for #14063Jacob Young
Closes #14063
2022-12-27llvm: cleanup code no longer needed with opaque pointersJacob Young
When using llvm opaque pointers, typed pointers and pointer bitcasts are no longer needed. This also avoids needing packed struct layouts that are nested inside pointers, letting us avoid computing struct layouts in Sema that could cause unnecessary dependency loops.
2022-12-26Sema: add error for recursive inline callVeikka Tuominen
Closes #12973
2022-12-24CBE: fix emitting a partially undefined string literalJacob Young
2022-12-21CBE: fix bitwise notJacob Young
Closes #13911
2022-12-20Merge pull request #14004 from Vexu/packed-struct-vectorVeikka Tuominen
llvm: handle vectors in packed structs
2022-12-19llvm: handle vectors in packed structsVeikka Tuominen
Closes #13201
2022-12-18cbe: fix type passed to renderParentPtrJacob Young
2022-12-18codegen: fix taking the address of a zero-bit field in a zero-bit structJacob Young
Normally when we want a pointer to the end of a struct we just add 1 to the struct pointer. However, when it is a zero-bit struct, the pointer type being used during lowering is often a dummy pointer type that actually points to a non-zero-bit type, so we actually want to add 0 instead, since a zero-bit struct begins and ends at the same address.
2022-12-18llvm: fix use of invalid alignmentJacob Young
* Initialize `big_align` with 1 as 0 is not a valid alignment. * Add an assert to `alignForwardGeneric` to catch this issue earlier. * Refactor valid alignment checks to call a more descriptive function.