pub struct Machine {
pub conv: &'static CallRegs,
pub file: RegFile,
pub insts: &'static FrameInsts,
pub branch: &'static BranchInsts,
pub env: Env,
}Expand description
Everything about a machine that compiling a function for it needs.
The fields are different kinds of fact and they come from different places: where the
convention puts things, what registers the machine has, which instructions build a frame,
which instructions a branch becomes, and which registers the allocator may hand out. The last
one is not a target fact on its own, because holding a register back as scratch is a decision
about the allocator rather than about the machine, which is why it is built here rather than
in rucc_target.
Fields§
§conv: &'static CallRegsWhere the convention this function is compiled for puts things.
file: RegFileThe registers the machine has, which is what says how wide a spill slot of a class is.
insts: &'static FrameInstsThe instructions that take a frame and give it back.
branch: &'static BranchInstsThe instructions a branch becomes once the blocks are in an order.
env: EnvWhat the allocator may hand out, and what it holds back.
Implementations§
Source§impl Machine
impl Machine
Sourcepub fn x86_64(conv: &'static CallRegs) -> Self
pub fn x86_64(conv: &'static CallRegs) -> Self
The x86-64 machine under that convention.
Only the general purpose registers are offered, because every rule in the set is about an integer and no value the selector produces is in any other class. A call still destroys the vector registers and still says so, and that costs nothing while nothing is in one.
Sourcepub fn for_target(target: &TargetInfo) -> Option<Self>
pub fn for_target(target: &TargetInfo) -> Option<Self>
The machine a target describes, or None when no backend in this crate covers it.
TargetInfo already carries the convention, because the front end needs it to lay a
va_list out, so the only thing this decides is which architecture’s frame instructions
and register file go with it. AArch64 and RISC-V are None until M6 fills them in, and a
caller that gets one reports a target it cannot compile for rather than compiling wrongly.