aboutsummaryrefslogtreecommitdiff
path: root/src/arch/aarch64/Emit.zig
AgeCommit message (Collapse)Author
2025-07-02compiler: delete aarch64 backendAndrew Kelley
this backend was abandoned before it was completed, and it is not worth salvaging.
2025-01-15switch to ArrayListUnmanaged for machine codeAndrew Kelley
2024-10-24link/Coff: simplify file structure by collapsing all files into Coff.zig ↵Jakub Konka
(#21761) * coff: collapse Coff/lld.zig logic into Coff.zig * coff: rename std.coff uses to coff_util * coff: rename self to coff for *Coff references * coff: collapse Coff/Atom.zig logic into Coff.zig * coff: collapse Coff/Relocation.zig logic into Coff.zig * coff: collapse Coff/ImportTable.zig logic into Coff.zig * coff: remove unused Coff/Object.zig * link/Coff: fix rebase gone wrong
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh
2024-09-10codegen: implement output to the `.debug_info` sectionJacob Young
2024-08-27compiler,lib,test,langref: migrate `@setCold` to `@branchHint`mlugg
2024-08-11compiler: split Decl into Nav and Caumlugg
The type `Zcu.Decl` in the compiler is problematic: over time it has gained many responsibilities. Every source declaration, container type, generic instantiation, and `@extern` has a `Decl`. The functions of these `Decl`s are in some cases entirely disjoint. After careful analysis, I determined that the two main responsibilities of `Decl` are as follows: * A `Decl` acts as the "subject" of semantic analysis at comptime. A single unit of analysis is either a runtime function body, or a `Decl`. It registers incremental dependencies, tracks analysis errors, etc. * A `Decl` acts as a "global variable": a pointer to it is consistent, and it may be lowered to a specific symbol by the codegen backend. This commit eliminates `Decl` and introduces new types to model these responsibilities: `Cau` (Comptime Analysis Unit) and `Nav` (Named Addressable Value). Every source declaration, and every container type requiring resolution (so *not* including `opaque`), has a `Cau`. For a source declaration, this `Cau` performs the resolution of its value. (When #131 is implemented, it is unsolved whether type and value resolution will share a `Cau` or have two distinct `Cau`s.) For a type, this `Cau` is the context in which type resolution occurs. Every non-`comptime` source declaration, every generic instantiation, and every distinct `extern` has a `Nav`. These are sent to codegen/link: the backends by definition do not care about `Cau`s. This commit has some minor technically-breaking changes surrounding `usingnamespace`. I don't think they'll impact anyone, since the changes are fixes around semantics which were previously inconsistent (the behavior changed depending on hashmap iteration order!). Aside from that, this changeset has no significant user-facing changes. Instead, it is an internal refactor which makes it easier to correctly model the responsibilities of different objects, particularly regarding incremental compilation. The performance impact should be negligible, but I will take measurements before merging this work into `master`. Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com> Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2024-07-07Zcu: introduce `PerThread` and pass to all the functionsJacob Young
2024-07-04Zcu: store `LazySrcLoc` in error messagesmlugg
This change modifies `Zcu.ErrorMsg` to store a `Zcu.LazySrcLoc` rather than a `Zcu.SrcLoc`. Everything else is dominoes. The reason for this change is incremental compilation. If a failed `AnalUnit` is up-to-date on an update, we want to re-use the old error messages. However, the file containing the error location may have been modified, and `SrcLoc` cannot survive such a modification. `LazySrcLoc` is designed to be correct across incremental updates. Therefore, we defer source location resolution until `Compilation` gathers the compile errors into the `ErrorBundle`.
2024-06-22rename src/Module.zig to src/Zcu.zigAndrew Kelley
This patch is a pure rename plus only changing the file path in `@import` sites, so it is expected to not create version control conflicts, even when rebasing.
2024-01-24macho: get the ball rolling!Jakub Konka
2024-01-08stage2 AArch64: get empty file compiling againjoachimschmidt557
2024-01-01fix a round of compile errors caused by this branchAndrew Kelley
2023-10-05plan9: refactor debug infoJacob Young
The main goal is to stop depending on `emit.lower.target`.
2023-08-29macho: unify concept of SymbolWithLoc across driversJakub Konka
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-04-13macho: refactor relocation type in incremental linkerJakub Konka
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-01-31link: make Coff atoms fully owned by the linkerJakub Konka
2023-01-31link: make MachO atoms fully owned by the linkerJakub Konka
2022-12-05dwarf: pull out debug line program internals into DeclState helpersJakub Konka
2022-11-18run zig fmt on everything checked by CIStevie Hryciw
2022-11-05coff: compile and link simple exit program on arm64Jakub Konka
* make image base target dependent * fix relocs to imports
2022-11-05coff: generate relocations for branch, GOT, direct refsJakub Konka
2022-11-01stage2 AArch64: misc fixes, enable printing in test runnerjoachimschmidt557
- Fixed missing airRetPtr implementation - Fixed wrong pop_regs order - Fixed wrong source and destination register in store
2022-11-01stage2 AArch64: implement min/maxjoachimschmidt557
2022-10-20stage2 AArch64: introduce ldr_ptr_stack Mir instructionjoachimschmidt557
2022-10-20stage2 AArch64: merge floating-point registers into Register enumjoachimschmidt557
2022-09-18fix code formattingJakub Konka
2022-09-18macho: allow for add and ldr when resolving GOT_LOAD_* relocsJakub Konka
2022-09-18macho: move to incremental writes and global relocs for incrementalJakub Konka
2022-09-10aarch64: update codegen to using a global index rather than local indexJakub Konka
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-08-05stage2 AArch64: implement basic integer rem/modjoachimschmidt557
2022-08-05stage2 AArch64: implement basic integer divisionjoachimschmidt557
2022-08-05stage2 AArch64: all arguments passed via stack from now onjoachimschmidt557
Only in the Undefined calling convention, not in other calling conventions
2022-08-05stage2 AArch64: introduce MCValue.stack_argument_offsetjoachimschmidt557
This new MCValue union member shares the same semantics as the MCValue type of the same name in the ARM backend.
2022-07-22macho: improve logs for dyld infoJakub Konka
2022-07-22macho: rework symbol handling to match zld/ELFJakub Konka
Now, each object file will store a mutable table of symbols that it defines. Upon symbol resolution between object files, the symbol will be updated with a globally allocated section ordinal and address in virtual memory. If the object defines a globally available symbol, its location only (comprising of the symbol index and object index) will be stored in the globals map for easy access when relocating, etc. This approach cleans up the symbol management significantly, and matches the status quo used in zld/ELF. Additionally, this makes scoping symbol stabs easier too as they are now naturally contained within each object file.
2022-05-27math: make `cast` return optional instead of an errorAli Chraghi
2022-05-05aarch64: ensure we set correct operand size at codegen stageJakub Konka
2022-05-05aarch64: fix mul_with_overflow for ints <= 32bitsJakub Konka
2022-05-05aarch64: implement mul_with_overflow for ints in range 33-64 bits inclJakub Konka
2022-05-05aarch64: implement mul_with_overflow for <= 32bit intsJakub Konka
Add emitters for `smull`, `umull` and `tst (immediate)` instructions.
2022-05-05stage2 AArch64: implement {add,sub}_with_overflow for all ints < 64joachimschmidt557
2022-04-19stage2 AArch64: Add ldrsb, ldrsh instructionsjoachimschmidt557
2022-04-19stage2 AArch64: Implement basic truncate functionalityjoachimschmidt557
2022-04-19stage2 AArch64: add basic assertions to bits.zig for correct codegenjoachimschmidt557
Includes many fixes of errors discovered by adding these assertions
2022-03-30dwarf: pass DeclState around instead of storing a temp global in DwarfJakub Konka
Avoids many pitfalls connected with premature/early return in case there are errors with Decl, etc. This is effectively bringing back the old design however in a much nicer packaging, where every mechanism related to tracking Decl's debug info is now nicely wrapped in a single struct (aka the `DeclState`). This includes relocation table, type arena, etc. It is now the caller's responsibility to deinit the state (so that no memory is leaked) after `Decl` has been analysed (or errored out). The caller here is typically a linker such as `Elf` or `MachO`.