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 2, 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, rucc-tuple, rucc-abi, rucc-sysroot and the
per-target rule sets. Those four are one group rather than four exceptions: the tuple names
a machine, rucc-abi says what its types look like and how its calls are made,
rucc-sysroot says where its headers and libraries are, and this crate is what the rest of
the compiler reads all of it through. 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.
The rules themselves are rucc-abi’s, as data rather than as code, and this crate hands the
question over to them. It answers None on a target whose ABI is not written down yet,
which today is AArch64 on Windows and nothing else.
§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, which rucc-abi describes as data and
this crate selects between. 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§
- Branch
Insts - Every instruction a laid out branch is made of.
- Call
- The registers one call has left.
- Call
Regs - Which registers a calling convention gives which job.
- Class
Info - One class of registers, and the registers in it.
- Class
Moves - How a register of one class is moved between two registers and between a register and the frame.
- Frame
Insts - Every instruction a prologue, an epilogue, a spill or a reload is made of.
- Fusion
- A comparison, and the two instructions a branch on its answer becomes.
- Guard
- Where a target keeps the word a stack protector’s canary is a copy of.
- Operand
Desc - One operand of one instruction, as a target’s description of that instruction writes 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 gave it.
- Places
- Where the values a call passes are, worked out one after another.
- Probe
- How a prologue touches the stack as it takes a frame, on a target that can.
- RegClass
- Which class a register or an operand belongs to.
- RegFile
- Every register a target has.
- Scalar
- One scalar, with the three facts a psABI reads about it.
- 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.
- Trace
- What a profiler’s hook at the top of every function is called on this platform.
- 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.
- BitField
Style - How a target allocates bit-fields into storage.
- 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.
- Object
Format - 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.
- Segment
- The storage an address is counted from, on a machine that has more than one.
- 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. - Where
- Where one of the values a call passes is.