Skip to main content

Crate rucc_asm

Crate rucc_asm 

Source
Expand description

Instruction encoders, the integrated assembler, inline assembly and relaxation.

Design: spec/11-asm-objects-debug.md. Layer rank 10, see spec/18-package-layout.md.

§Status

What is written are the two things a compiler does with a machine function: the assembly text -S produces, which is print(), and the bytes of a text section, which is assemble. Section 11.1 asks for one instruction description behind both, and there is one: the walk over a function is the same walk in both files, reading the same list out of rucc-target, and the only difference is whether an instruction is written down by name or handed to the encoder. So the listing and the object file cannot come to disagree about what an instruction is.

What assemble hands back with the bytes is what the linker has to be told: where each function starts and how long it is, and every place in the bytes that names something this file does not contain. The jumps inside a function are not among them, because by the end of a function every block has a place and they are filled in here.

The assembler that reads .s and .S, inline assembly and relaxation are the rest of M3 and M4 and are not here yet.

Every crate in the workspace is published, and publishing implies a promise. This one is tier 3: its Rust API is explicitly unstable and will change without a major version bump. Depend on the rucc binary’s behaviour, not on this.

Enums§

Directives
The directives one object format wraps a function in.
Error
A function this compiler could not write out as assembly.

Constants§

MILESTONE
The milestone in spec/17-milestones.md that fills this crate in.

Functions§

assemble
Every function, as the bytes of a text section.
print
Every function, as assembly text.