luaur_code_gen/methods/
lowering_stats_operator_add_assign.rs1use crate::records::lowering_stats::{FunctionStats_Enable, LoweringStats};
2
3impl LoweringStats {
4 pub fn lowering_stats_operator_add_assign(
5 &mut self,
6 that: &LoweringStats,
7 ) -> &mut LoweringStats {
8 self.total_functions += that.total_functions;
9 self.skipped_functions += that.skipped_functions;
10 self.spills_to_slot += that.spills_to_slot;
11 self.spills_to_restore += that.spills_to_restore;
12 self.max_spill_slots_used =
13 core::cmp::max(self.max_spill_slots_used, that.max_spill_slots_used);
14 self.blocks_pre_opt += that.blocks_pre_opt;
15 self.blocks_post_opt += that.blocks_post_opt;
16 self.max_block_instructions =
17 core::cmp::max(self.max_block_instructions, that.max_block_instructions);
18
19 self.reg_alloc_errors += that.reg_alloc_errors;
20 self.lowering_errors += that.lowering_errors;
21
22 self.block_linearization_stats
23 .block_linearization_stats_operator_add_assign(&that.block_linearization_stats);
24
25 if (self.function_stats_flags & FunctionStats_Enable) != 0 {
26 self.functions.extend(that.functions.iter().cloned());
27 }
28
29 self
30 }
31}
32
33impl core::ops::AddAssign<&LoweringStats> for LoweringStats {
34 #[inline]
35 fn add_assign(&mut self, rhs: &LoweringStats) {
36 self.lowering_stats_operator_add_assign(rhs);
37 }
38}
39
40impl core::ops::AddAssign<LoweringStats> for LoweringStats {
41 #[inline]
42 fn add_assign(&mut self, rhs: LoweringStats) {
43 self.lowering_stats_operator_add_assign(&rhs);
44 }
45}