aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2022-12-10CBE: fix compiling for aarch64-windowsJacob Young
These bugs were triggered in the C backend by aarch64-specific code in os/windows.zig. Intentionally not updating zig1.wasm yet because of upcoming changes and since aarch64-windows is not tested on master yet.
2022-12-09Eliminate `BoundFn` type from the languageVeikka Tuominen
Closes #9484
2022-12-09llvm: resolve all relative paths when creating DIFilesJakub Konka
This will make stack traces and debugging experience more consistent in the sense that the presence of source lines in stack traces will not be dependent on the current working directory of the running process.
2022-12-06remove most conditional compilation based on stage1Andrew Kelley
There are still a few occurrences of "stage1" in the standard library and self-hosted compiler source, however, these instances need a bit more careful inspection to ensure no breakage.
2022-12-06CBE: avoid trailing spaceJacob Young
2022-12-06CBE: add windows-specific reserved identifiersJacob Young
2022-12-06CBE: fix bad local reuse for volatile memsetJacob Young
2022-12-04CBE: revert broken change that got missedJacob Young
2022-12-04CBE: defer invariant local reuse in loopsJacob Young
When a local defined outside a loop dies inside the loop, it can still be needed on subsequent loop iterations, so reuse of the local must be deferred until after the loop ends. This causes behavior tests to pass.
2022-12-04CBE: fix liveness issue with wrapping optionalsAndrew Kelley
2022-12-04CBE: remove stray commentAndrew Kelley
2022-12-04CBE: fix union init wrong field nameAndrew Kelley
2022-12-04CBE: aggregate_init: resolve all operands before processing LivenessAndrew Kelley
2022-12-04CBE and LLVM: handle unused try instructionsAndrew Kelley
In both backends they did not observe the Liveness information for try instructions. Now they do. For the C backend this is necessary for correctness; for the LLVM backend, it improves code generation.
2022-12-04CBE: fix various regressions caught by behavior testsAndrew Kelley
2022-12-04CBE: fix static allocs being double allocatedAndrew Kelley
2022-12-04CBE: avoid curly inits because they don't work in assignmentsAndrew Kelley
2022-12-04CBE: fix use-after-free of Type keys in free_locals mapAndrew Kelley
2022-12-04CBE: fix assignment expr and switch free trackingAndrew Kelley
2022-12-04CBE: fix clone of freed locals not being deep cloneAndrew Kelley
2022-12-04CBE: take advantage of switch_br and cond_br livenessAndrew Kelley
2022-12-04CBE: exploit Liveness analysis to reuse localsAndrew Kelley
2022-12-04Revert "cbe: reduce amount of temporary locals"Andrew Kelley
This reverts commit 15cc83e27ae8a1740d9b7e2ec14044903979a832.
2022-12-04Revert "cbe: write more instructions inline"Andrew Kelley
This reverts commit f8b779c114a5fcb82f08168912f2300d7027a2fd.
2022-12-03cbe: add forward declarations for optionals and error unionsJacob Young
Arrays will have to wait for type rewrite.
2022-12-03cbe: implement function alignmentJacob Young
2022-12-03cbe: fix zero-bit struct field pointerJacob Young
2022-12-03cbe: implement multiple exports of a symbolsJacob Young
2022-12-03cbe: don't emit extern decls that are already exportedJacob Young
2022-12-03cbe: fix named constraints without modifiersJacob Young
2022-12-03CBE: no braces when lowering block instructionAndrew Kelley
This change alone solves the bracket-depth issue when compiling zig1.c with Clang.
2022-12-03Merge pull request #13748 from jacobly0/c-unalignedAndrew Kelley
cbe: use memcpy for underaligned loads and stores
2022-12-03Merge pull request #13744 from Vexu/stage2-fixesAndrew Kelley
Improve error messages, fix dependency loops
2022-12-02cbe: add support for constraint modifiers specified after a colonJacob Young
This translates `%[name:mod]` to `%mod[name]` for C.
2022-12-02cbe: use memcpy for underaligned loads and storesJacob Young
2022-12-02CBE: use bool, true, false, instead of `zig_` prefixesAndrew Kelley
In general the C backend should lower to human-maintainable C code whenever possible. Directly using C types that one would use when writing C code is one part of the strategy. The concern with including stdint.h is C89 compatibility. Well, we can just check the C std lib version before deciding to include that header.
2022-12-02CBE: use a 0 literal instead of `error.@"(no error)"`Andrew Kelley
This saves bytes and is easier to read too.
2022-12-03Sema: fix comparisons between lazy and runtime valuesVeikka Tuominen
Closes #12498
2022-12-02CBE: eliminate zig_voidAndrew Kelley
C void is perfectly fine.
2022-12-01Merge pull request #13715 from Vexu/cbeAndrew Kelley
cbe bug fixes and improvements
2022-11-30llvm: make debuggers actually usableVeikka Tuominen
`@llvm.dbg.value` is absolutely useless, adding a temporary alloca to store the constant in will make it actually show up in debuggers. The effect on performance should be minimal since there is only one store and it the change is not applied to ReleaseSafe builds. ```zig fn foo(a: u32, b: []const u8, c: bool, d: enum { yes, no }) void { _ = a; _ = b; _ = c; _ = d; } ``` before: ``` Breakpoint 1, a.foo (a=<optimized out>, b=..., c=<optimized out>, d=<optimized out>) at a.zig:18 18 _ = d; ``` after: ``` Breakpoint 1, a.foo (a=1, b=..., c=false, d=yes) at a.zig:15 15 _ = a; _ = b; _ = c; _ = d; (gdb) p b $1 = {ptr = 0x20854f <a.main.anon_3888> "bar", len = 3} ```
2022-11-30cbe: write more instructions inlineVeikka Tuominen
2022-11-30cbe: do not memcpy identical integer types when bitcastingVeikka Tuominen
2022-11-30cbe: reduce amount of temporary localsVeikka Tuominen
2022-11-30cbe: fix asm return valuesVeikka Tuominen
2022-11-30cbe: prevent access of inactive union field in unimplemented instructionsVeikka Tuominen
2022-11-30cbe: include hash in tuple type nameVeikka Tuominen
Different (simple) tuple types do not necessarily print out as different strings. This is issue would be caused by passing std.fmt.Formatter to std.fmt.format.
2022-11-30cbe: implement packed unionsVeikka Tuominen
2022-11-30cbe: correctly handle pointers to zero bit error union payloadsVeikka Tuominen
2022-11-30cbe: operand of address of operator must be an lvalueVeikka Tuominen