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 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§

AbiDescription
One psABI, completely.
BitInsts
What a pass has to know about a machine to work out which bits of a register anything reads.
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.
Chkstk
What a platform calls the routine that reaches the pages of a frame before the frame is taken.
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.
Compare
One comparison, and what is left of it when the machine has already made it.
Copied
One address computation, and the move that says the same thing when the address is a register.
FlagInsts
What a pass has to know about a machine to find a comparison the machine has already made.
FrameInsts
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.
MachineInsts
What a pass has to know about a machine to tell an instruction it has from one it does not.
Narrowed
One instruction that writes a constant, and the narrower one that writes the same register.
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 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.
Reader
One instruction that reads the condition state, and which part of it it reads.
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.
ShortInsts
The shorter spellings this target has.
Stepped
One addition of a constant, and the shorter instruction that adds that constant and no other.
TargetInfo
The facts about a target that the compiler reads instead of hard-coding.
Tested
One comparison against a constant, and the shorter instruction that asks it against zero.
Timing
What one instruction costs.
TimingInsts
What a scheduler has to know about a machine to put a block in an order.
Trace
What a profiler’s hook at the top of every function is called on this platform.
Triple
A target triple.
Zeroed
One instruction that writes a constant, and the instruction that writes zero in fewer bytes.
Zeroing
One instruction that leaves behind the comparison of what it wrote against zero.

Enums§

Arch
A target architecture.
Arg
One argument, or one return value, as much of it as an ABI cares about.
BitFieldStyle
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.
ObjectFormat
The object file format to emit.
Os
The operating system a target runs on.
Pass
How one value travels.
Reads
Which part of what a comparison against zero left a condition is about.
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.
Unit
The parts of a machine a scheduler counts.
VaList
The type a target’s __builtin_va_list is.
Where
Where one of the values a call passes is.