machinst: Steal the used/defs Sets when emitting a call in ABICall;

This commit is contained in:
Benjamin Bouvier
2020-05-06 19:10:24 +02:00
parent 19d8a7f1fb
commit 528d3c1355
3 changed files with 8 additions and 4 deletions

View File

@@ -72,6 +72,7 @@ use alloc::vec::Vec;
use regalloc::{RealReg, Reg, RegClass, Set, SpillSlot, Writable};
use core::mem;
use log::{debug, trace};
/// A location for an argument or return value.
@@ -1267,8 +1268,11 @@ impl ABICall for AArch64ABICall {
}
}
fn emit_call<C: LowerCtx<I = Self::I>>(&self, ctx: &mut C) {
let (uses, defs) = (self.uses.clone(), self.defs.clone());
fn emit_call<C: LowerCtx<I = Self::I>>(&mut self, ctx: &mut C) {
let (uses, defs) = (
mem::replace(&mut self.uses, Set::empty()),
mem::replace(&mut self.defs, Set::empty()),
);
match &self.dest {
&CallDest::ExtName(ref name, RelocDistance::Near) => ctx.emit(Inst::Call {
dest: name.clone(),