Add fixed_nonallocatable constraints when appropriate (#5253)
Plumb the set of allocatable registers through the OperandCollector and use it validate uses of fixed-nonallocatable registers, like %rsp on x86_64.
This commit is contained in:
@@ -48,14 +48,13 @@ impl X64Backend {
|
||||
fn compile_vcode(
|
||||
&self,
|
||||
func: &Function,
|
||||
flags: Flags,
|
||||
) -> CodegenResult<(VCode<inst::Inst>, regalloc2::Output)> {
|
||||
// This performs lowering to VCode, register-allocates the code, computes
|
||||
// block layout and finalizes branches. The result is ready for binary emission.
|
||||
let emit_info = EmitInfo::new(flags.clone(), self.x64_flags.clone());
|
||||
let emit_info = EmitInfo::new(self.flags.clone(), self.x64_flags.clone());
|
||||
let sigs = SigSet::new::<abi::X64ABIMachineSpec>(func, &self.flags)?;
|
||||
let abi = abi::X64Callee::new(&func, self, &self.x64_flags, &sigs)?;
|
||||
compile::compile::<Self>(&func, flags, self, abi, &self.reg_env, emit_info, sigs)
|
||||
compile::compile::<Self>(&func, self, abi, emit_info, sigs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,10 +64,13 @@ impl TargetIsa for X64Backend {
|
||||
func: &Function,
|
||||
want_disasm: bool,
|
||||
) -> CodegenResult<CompiledCodeStencil> {
|
||||
let flags = self.flags();
|
||||
let (vcode, regalloc_result) = self.compile_vcode(func, flags.clone())?;
|
||||
let (vcode, regalloc_result) = self.compile_vcode(func)?;
|
||||
|
||||
let emit_result = vcode.emit(®alloc_result, want_disasm, flags.machine_code_cfg_info());
|
||||
let emit_result = vcode.emit(
|
||||
®alloc_result,
|
||||
want_disasm,
|
||||
self.flags.machine_code_cfg_info(),
|
||||
);
|
||||
let frame_size = emit_result.frame_size;
|
||||
let value_labels_ranges = emit_result.value_labels_ranges;
|
||||
let buffer = emit_result.buffer.finish();
|
||||
@@ -96,6 +98,10 @@ impl TargetIsa for X64Backend {
|
||||
&self.flags
|
||||
}
|
||||
|
||||
fn machine_env(&self) -> &MachineEnv {
|
||||
&self.reg_env
|
||||
}
|
||||
|
||||
fn isa_flags(&self) -> Vec<shared_settings::Value> {
|
||||
self.x64_flags.iter().collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user