From 680473c50c25020ff1cd2bc71578c86ff64b85d2 Mon Sep 17 00:00:00 2001 From: Jef Date: Mon, 13 May 2019 15:22:58 +0200 Subject: [PATCH] Fix param names --- src/backend.rs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/backend.rs b/src/backend.rs index 46cfcc9b14..f2cb1401b9 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -4120,6 +4120,7 @@ impl<'this, M: ModuleContext> Context<'this, M> { I64 ); + // TODO: Do this without emitting `mov` fn cleanup_gprs(&mut self, gprs: impl Iterator) { for (src, dst) in gprs { self.copy_value(ValueLocation::Reg(src), CCLoc::Reg(dst)); @@ -4160,8 +4161,8 @@ impl<'this, M: ModuleContext> Context<'this, M> { // to move `RAX` back afterwards). fn full_div( &mut self, + dividend: ValueLocation, divisor: ValueLocation, - quotient: ValueLocation, do_div: impl FnOnce(&mut Self, ValueLocation), ) -> ( ValueLocation, @@ -4183,12 +4184,12 @@ impl<'this, M: ModuleContext> Context<'this, M> { self.block_state.regs.release(RDX); self.block_state.regs.release(RAX); - if let ValueLocation::Reg(r) = quotient { + if let ValueLocation::Reg(r) = dividend { self.block_state.regs.mark_used(r); } let should_save_rax = - quotient != ValueLocation::Reg(RAX) && !self.block_state.regs.is_free(RAX); + dividend != ValueLocation::Reg(RAX) && !self.block_state.regs.is_free(RAX); let saved_rax = if should_save_rax { let new_reg = self.take_reg(I32).unwrap(); @@ -4201,8 +4202,8 @@ impl<'this, M: ModuleContext> Context<'this, M> { }; self.block_state.regs.mark_used(RAX); - self.copy_value(quotient, CCLoc::Reg(RAX)); - self.free_value(quotient); + self.copy_value(dividend, CCLoc::Reg(RAX)); + self.free_value(dividend); let should_save_rdx = !self.block_state.regs.is_free(RDX); @@ -4234,13 +4235,13 @@ impl<'this, M: ModuleContext> Context<'this, M> { fn i32_full_div_u( &mut self, divisor: ValueLocation, - quotient: ValueLocation, + dividend: ValueLocation, ) -> ( ValueLocation, ValueLocation, impl Iterator + Clone + 'this, ) { - self.full_div(divisor, quotient, |this, divisor| match divisor { + self.full_div(dividend, divisor, |this, divisor| match divisor { ValueLocation::Stack(offset) => { let offset = this.adjusted_offset(offset); dynasm!(this.asm @@ -4262,13 +4263,13 @@ impl<'this, M: ModuleContext> Context<'this, M> { fn i32_full_div_s( &mut self, divisor: ValueLocation, - quotient: ValueLocation, + dividend: ValueLocation, ) -> ( ValueLocation, ValueLocation, impl Iterator + Clone + 'this, ) { - self.full_div(divisor, quotient, |this, divisor| match divisor { + self.full_div(dividend, divisor, |this, divisor| match divisor { ValueLocation::Stack(offset) => { let offset = this.adjusted_offset(offset); dynasm!(this.asm @@ -4290,13 +4291,13 @@ impl<'this, M: ModuleContext> Context<'this, M> { fn i64_full_div_u( &mut self, divisor: ValueLocation, - quotient: ValueLocation, + dividend: ValueLocation, ) -> ( ValueLocation, ValueLocation, impl Iterator + Clone + 'this, ) { - self.full_div(divisor, quotient, |this, divisor| match divisor { + self.full_div(dividend, divisor, |this, divisor| match divisor { ValueLocation::Stack(offset) => { let offset = this.adjusted_offset(offset); dynasm!(this.asm @@ -4318,13 +4319,13 @@ impl<'this, M: ModuleContext> Context<'this, M> { fn i64_full_div_s( &mut self, divisor: ValueLocation, - quotient: ValueLocation, + dividend: ValueLocation, ) -> ( ValueLocation, ValueLocation, impl Iterator + Clone + 'this, ) { - self.full_div(divisor, quotient, |this, divisor| match divisor { + self.full_div(dividend, divisor, |this, divisor| match divisor { ValueLocation::Stack(offset) => { let offset = this.adjusted_offset(offset); dynasm!(this.asm