aboutsummaryrefslogtreecommitdiff
path: root/src/arch/arm/Emit.zig
AgeCommit message (Collapse)Author
2025-07-02compiler: delete arm backendAndrew Kelley
this backend was abandoned before it was completed, and it is not worth salvaging.
2025-06-05std.Target: Introduce Cpu convenience functions for feature tests.Alex Rønne Petersen
Before: * std.Target.arm.featureSetHas(target.cpu.features, .has_v7) * std.Target.x86.featureSetHasAny(target.cpu.features, .{ .sse, .avx, .cmov }) * std.Target.wasm.featureSetHasAll(target.cpu.features, .{ .atomics, .bulk_memory }) After: * target.cpu.has(.arm, .has_v7) * target.cpu.hasAny(.x86, &.{ .sse, .avx, .cmov }) * target.cpu.hasAll(.wasm, &.{ .atomics, .bulk_memory })
2025-01-15switch to ArrayListUnmanaged for machine codeAndrew Kelley
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-07-07Zcu: introduce `PerThread` and pass to all the functionsJacob Young
2024-07-04compiler: type.zig -> Type.zigmlugg
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-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-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-03-04add @trap builtinr00ster91
This introduces a new builtin function that compiles down to something that results in an illegal instruction exception/interrupt. It can be used to exit a program abnormally. This implements the builtin for all backends.
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2022-12-05dwarf: pull out debug line program internals into DeclState helpersJakub Konka
2022-09-20stage2 ARM: make sub_sp_scratch MIR instruction use r4joachimschmidt557
r0 is used for argument passing, so this register is not available as a scratch register upon function entry.
2022-09-09stage2 ARM: support larger function stacksjoachimschmidt557
This is done by introducing a new Mir pseudo-instruction
2022-09-09stage2 ARM: improve Mir representation of mov and cmpjoachimschmidt557
2022-08-13stage2 ARM: pass stack arguments in opposite orderjoachimschmidt557
Earlier arguments have a smaller address (i.e. towards the bottom of the stack)
2022-05-27math: make `cast` return optional instead of an errorAli Chraghi
2022-05-22stage2 ARM: fix recursive fibonaccijoachimschmidt557
Some handling of register_c_flag/register_v_flag was incorrect.
2022-04-16stage2 ARM: move genArgDbgInfo back to CodeGenjoachimschmidt557
This removes the questionable Air -> Mir dependency that existed before. The x86_64 backend also performed this change.
2022-04-14stage2: progress towards stage3Andrew Kelley
* The `@bitCast` workaround is removed in favor of `@ptrCast` properly doing element casting for slice element types. This required an enhancement both to stage1 and stage2. * stage1 incorrectly accepts `.{}` instead of `{}`. stage2 code that abused this is fixed. * Make some parameters comptime to support functions in switch expressions (as opposed to making them function pointers). * Avoid relying on local temporaries being mutable. * Workarounds for when stage1 and stage2 disagree on function pointer types. * Workaround recursive formatting bug with a `@panic("TODO")`. * Remove unreachable `else` prongs for some inferred error sets. All in effort towards #89.
2022-04-04dwarf: emit debug info for local variables on x86_64Jakub Konka
Add support for emitting debug info for local variables within a subprogram. This required moving bits responsible for populating the debug info back to `CodeGen` from `Emit` as we require the operand to be resolved at callsite plus we need to know its type. Without enforcing this, we could end up with a `dead` mcv.
2022-04-01stage2 ARM: implement mul_with_overflow for ints <= 32 bitsjoachimschmidt557
2022-04-01stage2 ARM: implement mul_with_overflow for ints <= 16 bitsjoachimschmidt557
2022-04-01stage2 ARM: implement add/sub_with_overflow for u32/i32joachimschmidt557
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`.
2022-03-27dwarf: track type relocation state in Dwarf moduleJakub Konka
2022-03-22stage2: lazy `@alignOf`Andrew Kelley
Add a `target` parameter to every function that deals with Type and Value.
2022-03-16stage2 ARM: genSetStack for stack_argument_offsetjoachimschmidt557
2022-03-08dwarf: move all dwarf into standalone moduleJakub Konka
Hook up Elf and MachO linkers to the new solution.
2022-02-26stage2 ARM: generate correct variants of ldr instructionjoachimschmidt557
When loading an i16 for example, generate ldrsh instead of ldrh
2022-02-26stage2 ARM: implement truncate to ints with bits <= 32joachimschmidt557
2022-02-18stage2: eliminate ZIR arg instruction references to ZIRAndrew Kelley
Prior to this commit, the AIR arg instruction kept a reference to a ZIR string index for the corresponding parameter name. This is used by DWARF emitting code. However, this is a design flaw because we want AIR objects to be independent from ZIR. This commit saves the parameter names into memory managed by `Module.Fn`. This is sub-optimal because we should be able to get the parameter names from the ZIR for a function without having them redundantly stored along with `Fn` memory. However the current way that ZIR param instructions are encoded does not support this case. They appear in the same ZIR body as the function instruction, just before it. Instead, they should be embedded within the function instruction, which will allow this TODO to be solved. That improvement is too big for this commit, however. After this there is one last dependency to untangle, which is for inline assembly. The issue for that is #10784.
2022-01-24stage2: rework a lot of stuffAndrew Kelley
AstGen: * rename the known_has_bits flag to known_non_opv to make it better reflect what it actually means. * add a known_comptime_only flag. * make the flags take advantage of identifiers of primitives and the fact that zig has no shadowing. * correct the known_non_opv flag for function bodies. Sema: * Rename `hasCodeGenBits` to `hasRuntimeBits` to better reflect what it does. - This function got a bit more complicated in this commit because of the duality of function bodies: on one hand they have runtime bits, but on the other hand they require being comptime known. * WipAnonDecl now takes a LazySrcDecl parameter and performs the type resolutions that it needs during finish(). * Implement comptime `@ptrToInt`. Codegen: * Improved handling of lowering decl_ref; make it work for comptime-known ptr-to-int values. - This same change had to be made many different times; perhaps we should look into merging the implementations of `genTypedValue` across x86, arm, aarch64, and riscv.
2022-01-24stage2 ARM: re-enable debug info for argumentsjoachimschmidt557
These were disabled during the MIR transition
2021-12-04stage2 ARM: Implement calling with stack parametersjoachimschmidt557
2021-11-16stage2 ARM: Introduce MIRjoachimschmidt557