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. A register file is describable, which is
RegFile, and the description of x86-64’s own comes with the target that uses it. 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.
Structs§
- Call
- The registers one call has left.
- Class
Info - One class of registers, and the registers in it.
- Parse
Triple Error - 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.
- 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.
- Target
Info - 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.
- Env
- The C runtime and ABI variant.
- Kind
- What a scalar is, once the ABI is the one asking.
- Object
Format - The object file format to emit.
- Os
- The operating system a target runs on.
- Pass
- How one value travels.
- 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_listis.