ISLE: Allow emitting safepoint insns

Change the implementation of emitted_insts in IsleContext from
a plain vector of instructions into a vector of tuples, where
the second element is a boolean that indicates whether this
instruction should be emitted as a safepoint.

This allows targets to emit safepoint insns via ISLE.
This commit is contained in:
Ulrich Weigand
2022-01-25 14:21:41 +01:00
parent 5fc01bafc7
commit 906f6a35cf
4 changed files with 19 additions and 12 deletions

View File

@@ -152,14 +152,17 @@ where
let imm =
MoveWideConst::maybe_with_shift(((!imm16) & 0xffff) as u16, i * 16)
.unwrap();
self.emitted_insts.push(MInst::MovN { rd, imm, size });
self.emitted_insts
.push((MInst::MovN { rd, imm, size }, false));
} else {
let imm = MoveWideConst::maybe_with_shift(imm16 as u16, i * 16).unwrap();
self.emitted_insts.push(MInst::MovZ { rd, imm, size });
self.emitted_insts
.push((MInst::MovZ { rd, imm, size }, false));
}
} else {
let imm = MoveWideConst::maybe_with_shift(imm16 as u16, i * 16).unwrap();
self.emitted_insts.push(MInst::MovK { rd, imm, size });
self.emitted_insts
.push((MInst::MovK { rd, imm, size }, false));
}
}
}
@@ -200,7 +203,7 @@ where
}
fn emit(&mut self, inst: &MInst) -> Unit {
self.emitted_insts.push(inst.clone());
self.emitted_insts.push((inst.clone(), false));
}
fn cond_br_zero(&mut self, reg: Reg) -> CondBrKind {

View File

@@ -470,6 +470,6 @@ where
#[inline]
fn emit(&mut self, inst: &MInst) -> Unit {
self.emitted_insts.push(inst.clone());
self.emitted_insts.push((inst.clone(), false));
}
}

View File

@@ -227,7 +227,7 @@ where
fn emit(&mut self, inst: &MInst) -> Unit {
for inst in inst.clone().mov_mitosis() {
self.emitted_insts.push(inst);
self.emitted_insts.push((inst, false));
}
}