aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv64/abi.zig
AgeCommit message (Collapse)Author
2025-09-26compiler: move self-hosted backends from src/arch to src/codegenAlex Rønne Petersen
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-16all: update to `std.builtin.Type.Pointer.Size` field renamesmlugg
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-08-25sema: clean-up `{union,struct}FieldAlignment` and friendsDavid Rubin
My main gripes with this design were that it was incorrectly namespaced, the naming was inconsistent and a bit wrong (`fooAlign` vs `fooAlignment`). This commit moves all the logic from `PerThread.zig` to use the zcu + tid system that the previous couple commits introduce. I've organized and merged the functions to be a bit more specific to their own purpose. - `fieldAlignment` takes a struct or union type, an index, and a Zcu (or the Sema version which takes a Pt), and gives you the alignment of the field at the index. - `structFieldAlignment` takes the field type itself, and provides the logic to handle special cases, such as externs. A design goal I had in mind was to avoid using the word 'struct' in the function name, when it worked for things that aren't structs, such as unions.
2024-08-25sema: rework type resolution to use Zcu when possibleDavid Rubin
2024-07-26riscv implement `@popCount`David Rubin
2024-07-26riscv: implement `lr/sr` loop logic for non-native atomicsDavid Rubin
2024-07-26riscv: un-cache the `avl` and `vtype` when returning from a function callDavid Rubin
the csrs `avl` and `vtype` are considered caller-saved so it could have changed while inside of the function. the easiest way to handle this is to just set the cached `vtype` and `avl` to null, so that the next time something needs to set it, it'll emit an instruction instead of relying on a potentially invalid setting.
2024-07-14riscv: vectors part 1David Rubin
2024-07-07Zcu: introduce `PerThread` and pass to all the functionsJacob Young
2024-07-04compiler: type.zig -> Type.zigmlugg
2024-06-23riscv: remove deprecated `Module` usagesDavid Rubin
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-06-13riscv: implement optional logicDavid Rubin
2024-06-13riscv: float argsDavid Rubin
2024-06-13riscv: first sign of floats!David Rubin
2024-06-13riscv: PRO member function callsDavid Rubin
this is enough progress for us to be able to call `stdout.write`!
2024-06-13riscv: arbitrary sized arraysDavid Rubin
2024-05-11riscv: finally fix bug + `airAggregateInit`David Rubin
i just hadn't realized that I placed the `riscv_start` branch in the non-simplified starts
2024-05-11riscv: by-value structs + `@min`David Rubin
2024-05-11riscv: mutable globalsDavid Rubin
2024-05-11riscv: add stage2_riscv to test matrix and bypass failing testsDavid Rubin
2024-05-11riscv: actually working test runnerDavid Rubin
2024-05-11riscv: big rewrite to use latest livenessDavid Rubin
this one is even harder to document then the last large overhaul. TLDR; - split apart Emit.zig into an Emit.zig and a Lower.zig - created seperate files for the encoding, and now adding a new instruction is as simple as just adding it to a couple of switch statements and providing the encoding. - relocs are handled in a more sane maner, and we have a clear defining boundary between lea_symbol and load_symbol now. - a lot of different abstractions for things like the stack, memory, registers, and others. - we're using x86_64's FrameIndex now, which simplifies a lot of the tougher design process. - a lot more that I don't have the energy to document. at this point, just read the commit itself :p
2024-05-11riscv: pass optionals by register_pair for resolveCallingConventionValuesDavid Rubin
2024-05-11riscv: implement slicesDavid Rubin
2024-05-11riscv: totally rewrite how we do loads and storesDavid Rubin
this commit is a little too large to document fully, however the main gist of it this - finish the `genInlineMemcpy` implement - rename `setValue` to `genCopy` as I agree with jacob that it's a better name - add in `genVarDbgInfo` for a better gdb experience - follow the x86_64's method for genCall, as the procedure is very similar for us - add `airSliceLen` as it's trivial - change up the `airAddWithOverflow implementation a bit - make sure to not spill of the elem_ty is 0 size - correctly follow the RISC-V calling convention and spill the used calle saved registers in the prologue and restore them in the epilogue - add `address`, `deref`, and `offset` helper functions for MCValue. I must say I love these, they make the code very readable and super verbose :) - fix a `register_manager.zig` issue where when using the last register in the set, the value would overflow at comptime. was happening because we were adding to `max_id` before subtracting from it.
2024-05-11riscv: basic function argumentsDavid Rubin
- rename setRegOrMem -> setValue - a naive method of passing arguments by register - gather the prologue and epilogue and generate them in Emit.zig. this is cleaner because we have the final stack size in the emit step. - define the "fa" register set, which contains the RISC-V calling convention defined function argument registers
2024-03-11std.builtin: make container layout fields lowercaseTristan Ross
2023-09-19llvm: update riscv floating-point c abi for LLVM 17Jacob Young
2023-06-10stage2: move struct types and aggregate values to InternPoolAndrew Kelley
2023-06-10stage2: implement intTagType logicAndrew Kelley
This commit changes a lot of `*const Module` to `*Module` to make it work, since accessing the integer tag type of an enum might need to mutate the InternPool by adding a new integer type into it. An alternate strategy would be to pre-heat the InternPool with the integer tag type when creating an enum type, which would make it so that intTagType could accept a const Module instead of a mutable one, asserting that the InternPool already had the integer tag type.
2023-06-10Type.isSlice: make it InternPool awareAndrew Kelley
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-26std.Target adjustmentsVeikka Tuominen
* move `ptrBitWidth` from Arch to Target since it needs to know about the abi * double isn't always 8 bits * AVR uses 1-byte alignment for everything in GCC
2022-12-09Eliminate `BoundFn` type from the languageVeikka Tuominen
Closes #9484
2022-10-22stage2: implement RISCV C ABIVeikka Tuominen
2022-05-26regalloc: use StaticBitSet internallyJakub Konka
2022-05-20regalloc: temporarily nerf back to raw ints until stage2 catches upJakub Konka
2022-05-19regalloc: make register class bitmask non-optionalJakub Konka
2022-03-11stage2 regalloc: replace Register.allocIndex with generic indexOfRegjoachimschmidt557
* callee_preserved_regs and other ABI-specific information have been moved to the respective abi.zig files