diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-11-09 11:04:10 +1100 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2023-02-28 19:22:27 -0500 |
| commit | bf4e1e49ea80d52ec6662938ce859de17fd831f4 (patch) | |
| tree | ce89bce4594c8cb6adfe9fd3ecb4c3c17f7c5d5c /src | |
| parent | 5b9b849a1918636f55433e858ee6ce4847dd6ced (diff) | |
| download | rust-bf4e1e49ea80d52ec6662938ce859de17fd831f4.tar.gz rust-bf4e1e49ea80d52ec6662938ce859de17fd831f4.zip | |
Use `&mut Bx` more.
For the next commit, `FunctionCx::codegen_*_terminator` need to take a `&mut Bx` instead of consuming a `Bx`. This triggers a cascade of similar changes across multiple functions. The resulting code is more concise and replaces many `&mut bx` expressions with `bx`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/builder.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/builder.rs b/src/builder.rs index c43895ee565..1603e9bf628 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -814,11 +814,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { OperandRef { val, layout: place.layout } } - fn write_operand_repeatedly(mut self, cg_elem: OperandRef<'tcx, RValue<'gcc>>, count: u64, dest: PlaceRef<'tcx, RValue<'gcc>>) -> Self { + fn write_operand_repeatedly(&mut self, cg_elem: OperandRef<'tcx, RValue<'gcc>>, count: u64, dest: PlaceRef<'tcx, RValue<'gcc>>) { let zero = self.const_usize(0); let count = self.const_usize(count); - let start = dest.project_index(&mut self, zero).llval; - let end = dest.project_index(&mut self, count).llval; + let start = dest.project_index(self, zero).llval; + let end = dest.project_index(self, count).llval; let header_bb = self.append_sibling_block("repeat_loop_header"); let body_bb = self.append_sibling_block("repeat_loop_body"); @@ -837,14 +837,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { self.switch_to_block(body_bb); let align = dest.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size); - cg_elem.val.store(&mut self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align)); + cg_elem.val.store(self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align)); let next = self.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]); self.llbb().add_assignment(None, current, next); self.br(header_bb); self.switch_to_block(next_bb); - self } fn range_metadata(&mut self, _load: RValue<'gcc>, _range: WrappingRange) { |
