aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
AgeCommit message (Collapse)Author
2023-06-10InternPool: implement isSinglePointerAndrew Kelley
2023-06-10stage2: add `interned` AIR tagAndrew Kelley
This required additionally passing the `InternPool` into some AIR methods. Also, implement `Type.isNoReturn` for interned types.
2023-06-10stage2: start the InternPool transitionAndrew Kelley
Instead of doing everything at once which is a hopelessly large task, this introduces a piecemeal transition that can be done in small increments at a time. This is a minimal changeset that keeps the compiler compiling. It only uses the InternPool for a small set of types. Behavior tests are not passing. Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but compile-time verified to have the same fields in the same order. The large set of changes is mainly to deal with the fact that most Type and Value methods now require a Module to be passed in, so that the InternPool object can be accessed.
2023-05-10cbe: use `Assignment` in `airSplat`Jacob Young
2023-05-06cbe: fix typosJacob Young
2023-04-28C backend: take advantage of Assignment abstraction in airMemsetAndrew Kelley
2023-04-28C backend: fix ptr comparison of array ptrs when one is null-terminatedAndrew Kelley
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-04-28C backend: fix memset for structs and arraysAndrew Kelley
2023-04-26Merge pull request #15452 from mlugg/zig-cbe-optAndrew Kelley
CBE: minor optimizations to output source
2023-04-26Merge pull request #15278 from ziglang/memcpy-memsetAndrew Kelley
change semantics of `@memcpy` and `@memset`
2023-04-26CBE: minor optimizations to output sourcemlugg
2023-04-25C backend: fix lowering comparison when array ptr meets ptrAndrew Kelley
Pointer comparisons were triggering `-Wcompare-distinct-pointer-types` before this fix, which adds `(void*)` casts if the lhs type and rhs type do not match pointer sizeness.
2023-04-25stage2: introduce store_safe AIR instructionAndrew Kelley
store: The value to store may be undefined, in which case the destination memory region has undefined bytes after this instruction is evaluated. In such case ignoring this instruction is legal lowering. store_safe: Same as `store`, except if the value to store is undefined, the memory region should be filled with 0xaa bytes, and any other safety metadata such as Valgrind integrations should be notified of this memory region being undefined.
2023-04-25C backend: use ++ instead of += for airMemsetAndrew Kelley
It does the same thing but has fewer bytes in the output.
2023-04-25C backend: fix memset for loop loweringAndrew Kelley
Previously, this code casted the array pointer to u8 pointer, but I removed that in a different commit. This commit restores the cast, but instead of hard-coding u8, it uses the destination element pointer, since memset now supports arbitrary element types.
2023-04-25LLVM backend: support non-byte-sized memsetAndrew Kelley
Also introduce memset_safe AIR tag and support it in C backend and LLVM backend.
2023-04-25C backend: implement new memcpy and inttoptr semanticsAndrew Kelley
2023-04-25update `@memcpy` to require equal src and dest lensAndrew Kelley
* Sema: upgrade operands to array pointers if possible when emitting AIR. * Implement safety checks for length mismatch and aliasing. * AIR: make ptrtoint support slice operands. Implement in LLVM backend. * C backend: implement new `@memset` semantics. `@memcpy` is not done yet.
2023-04-25cbe: implement @externJacob Young
2023-04-25cbe: remove unused arenaJacob Young
2023-04-21cbe: fix local aliasing issues in atomic opsJacob Young
2023-04-21zig.h: fix float negationJacob Young
2023-04-21cbe: implement 128-bit atomics supportJacob Young
* Disable 128-bit atomics for x86_64 generic (currently also baseline) because they require heavy abi agreement to correctly lower. ** This is a breaking change ** * Enable 128-bit atomics for aarch64 in Sema since it just works.
2023-04-21cbe: fix atomic float min/maxJacob Young
These need `zig_atomic`, unlike int min/max.
2023-04-21cbe: fix float casts involving f16Jacob Young
Fixes bugs with a previous fix to the f16 abi on x86 darwin.
2023-04-21cbe: fix remaining aarch64 issuesJacob Young
2023-04-21cbe: fix issues with atomic floatsJacob Young
Since the Zig language documentation claims support for `.Min` and `.Max` in `@atomicRmw` with floats, allow in Sema and implement for both the llvm and C backends.
2023-04-21cbe: enable CI for std testsJacob Young
2023-04-20cbe: integrate new Liveness behaviourmlugg
2023-04-20Liveness: control flow analysismlugg
This is a partial rewrite of Liveness, so has some other notable changes: - A proper multi-pass system to prevent code duplication - Better logging - Minor bugfixes
2023-04-07cbe: assert there are no unfreed localsJacob Young
Also fix the many revealed bugs.
2023-04-07Liveness: defer deaths of externally-scoped instructions in loop bodiesmlugg
2023-04-05Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-04-05compiler_rt: attempt to fix f16 abi on mac with llvm 16Jacob Young
2023-04-02Sema: defer stores to inferred allocsJacob Young
This lets us generate the store with knowledge of the type to be stored. Therefore, we can avoid generating garbage Air with stores through pointers to comptime-only types which backends cannot lower. Closes #13410 Closes #15122
2023-03-30new builtins: @workItemId, @workGroupId, @workGroupSizeRobin Voetter
* @workItemId returns the index of the work item in a work group for a dimension. * @workGroupId returns the index of the work group in the kernel dispatch for a dimension. * @workGroupSize returns the size of the work group for a dimension. These builtins are mainly useful for GPU backends. They are currently only implemented for the AMDGCN LLVM backend.
2023-03-28Sema: fix empty slice pointer valueJacob Young
We just checked that inst_child_ty was effectively a zero-bit type, so it is certainly not the non-zero alignment we are looking for. Closes #15085
2023-03-21CBE: implement aggregateInit() for array of array case.Xavier Bouchoux
fixes `error(compilation): clang failed with stderr: error: array type 'uint32_t[10]' (aka 'unsigned int[10]') is not assignable`
2023-03-07CBE: implement unsigned big int div and modJacob Young
2023-03-05CBE: fix reduce of emulated integersJacob Young
2023-03-05CBE: ensure uniqueness of more internal identifiersJacob Young
2023-03-05CBE: implement select and shuffleJacob Young
2023-03-05CBE: implement splatJacob Young
2023-03-05CBE: implement vector truncateJacob Young
2023-03-05CBE: implement vector element pointersJacob Young
2023-03-05CBE: implement vector operationsJacob Young
Also, bigint add and sub which is all I was actually trying to do.
2023-03-05CBE: fix behavior test failures on msvcJacob Young
2023-03-05CBE: implement some big integer and vector unary operationsJacob Young
2023-03-05CBE: implement big integer and vector comparisonsJacob Young