| 67 | // Lay out the save area above the locals: callee-saved regs ascending, |
| 68 | // then ra at the top. This keeps it one contiguous block. |
| 69 | let mut regs = std::mem::take(&mut self.pending_regs); |
| 70 | regs.sort_unstable(); |
| 71 | for reg in regs { |
| 72 | let offset = self.alloc_slot(8, 8); |
| 73 | self.saved_regs.push((reg, offset)); |
| 74 | } |
| 75 | if self.needs_ra { |
| 76 | self.ra_offset = Some(self.alloc_slot(8, 8)); |
| 77 | } |
| 78 | // Align frame size to 16 bytes. |
| 79 | self.frame_size = (self.next_offset + self.alignment - 1) & !(self.alignment - 1); |
| 80 | } |
| 81 | |
| 82 | pub fn frame_size(&self) -> usize { |
| 83 | self.frame_size |
| 84 | } |
| 85 | |
| 86 | /// Compute the size of a type after resolving aliases. |