Skip to main content

Crate rucc_target

Crate rucc_target 

Source
Expand description

Target descriptions: triples, and the facts about a target that the rest of the compiler reads rather than hard-codes.

Design: spec/12-abi-and-runtime.md. Layer rank 1, see spec/18-package-layout.md.

The rule from spec/18-package-layout.md section 18.2 is that there is no target-specific code outside this crate and the per-target rule sets. Everything a pass needs to know about a target is a field it can read here. That rule is what makes the claim in spec/10-backend.md testable, namely that a new target is a rule set and a few data files, and M10 brings up a fourth target specifically to put a number on it.

TargetInfo::call is the other half of that rule and the one with teeth. How a structure travels between a caller and a callee is the target’s answer rather than C’s, so the walk to the IR flattens a C type into a Shape and asks here what form it takes. Every psABI rule is behind Call and nothing outside this crate matches on an architecture to find one.

§Status

Triple parsing and the basic data model are real, which is what rucc --print-config reports, and so is the argument classification of every psABI in spec/12-abi-and-runtime.md sections 12.2 to 12.5. x86-64’s register file is written down, in x86_64, along with what each of the two conventions over it does with each register, what each of its machine instructions does with its operands, and which instructions a frame is made of, which is FrameInsts. AArch64’s and RISC-V’s arrive with their backends. Machine models land in M6.

This crate is tier 3 in spec/18-package-layout.md section 18.5: its Rust API is explicitly unstable and will change without a major version bump.

Modules§

x86_64
The x86-64 register file, and where each of the two conventions over it puts things.

Structs§

BranchInsts
Every instruction a laid out branch is made of.
Call
The registers one call has left.
CallRegs
Which registers a calling convention gives which job.
ClassInfo
One class of registers, and the registers in it.
ClassMoves
How a register of one class is moved between two registers and between a register and the frame.
FrameInsts
Every instruction a prologue, an epilogue, a spill or a reload is made of.
OperandDesc
One operand of one instruction, as a target’s description of that instruction writes it.
ParseTripleError
Why a triple failed to parse.
PhysReg
One physical register, as its number inside its class.
Piece
One scalar inside an aggregate, at the offset the layout put it.
Places
Where the values a call passes are, worked out one after another.
RegClass
Which class a register or an operand belongs to.
RegFile
Every register a target has.
Scalar
One scalar, with the two facts about it a psABI reads.
Shape
An aggregate, as much of it as an ABI cares about.
TargetInfo
The facts about a target that the compiler reads instead of hard-coding.
Triple
A target triple.

Enums§

Arch
A target architecture.
Arg
One argument, or one return value, as much of it as an ABI cares about.
Constraint
Where an operand is allowed to live.
Env
The C runtime and ABI variant.
Kind
What a scalar is, once the ABI is the one asking.
ObjectFormat
The object file format to emit.
Os
The operating system a target runs on.
Pass
How one value travels.
Role
What an instruction does with an operand.
Slot
One register’s worth of an aggregate that travels in registers, and which of the object’s bytes go in it.
VaList
The type a target’s __builtin_va_list is.
Where
Where one of the values a call passes is.