Add fixed-non-allocatable operand support.

This commit is contained in:
Chris Fallin
2021-06-19 12:17:18 -07:00
parent 50eb6fc42f
commit 736f636c36
3 changed files with 43 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
//! Debugging output.
use super::Env;
use crate::{Function, ProgPoint, Block};
use crate::{Block, Function, ProgPoint};
impl<'a, F: Function> Env<'a, F> {
pub fn dump_state(&self) {

View File

@@ -272,6 +272,9 @@ impl<'a, F: Function> Env<'a, F> {
for pos in &[OperandPos::After, OperandPos::Before] {
for op in self.func.inst_operands(inst) {
if op.as_fixed().is_some() {
continue;
}
if op.pos() == *pos {
let was_live = live.get(op.vreg().vreg());
log::debug!("op {:?} was_live = {}", op, was_live);
@@ -868,6 +871,15 @@ impl<'a, F: Function> Env<'a, F> {
operand
);
// If this is a "fixed non-allocatable
// register" operand, set the alloc
// immediately and then ignore the operand
// hereafter.
if let Some(preg) = operand.as_fixed() {
self.set_alloc(inst, i, Allocation::reg(preg));
continue;
}
match operand.kind() {
OperandKind::Def | OperandKind::Mod => {
log::debug!("Def of {} at {:?}", operand.vreg(), pos);