|
1 | 1 | //! A frontend for building Cranelift IR from other languages. |
2 | 2 | use crate::ssa::{SSABuilder, SideEffects}; |
3 | 3 | use crate::variable::Variable; |
4 | | -use alloc::collections::BTreeSet; |
5 | 4 | use alloc::vec::Vec; |
6 | 5 | use core::fmt::{self, Debug}; |
7 | 6 | use cranelift_codegen::cursor::{Cursor, CursorPosition, FuncCursor}; |
@@ -34,7 +33,7 @@ pub struct FunctionBuilderContext { |
34 | 33 | types: SecondaryMap<Variable, Type>, |
35 | 34 | stack_map_vars: EntitySet<Variable>, |
36 | 35 | stack_map_values: EntitySet<Value>, |
37 | | - dfs: Dfs, |
| 36 | + safepoints: safepoints::SafepointSpiller, |
38 | 37 | } |
39 | 38 |
|
40 | 39 | /// Temporary object used to build a single Cranelift IR [`Function`]. |
@@ -75,14 +74,14 @@ impl FunctionBuilderContext { |
75 | 74 | types, |
76 | 75 | stack_map_vars, |
77 | 76 | stack_map_values, |
78 | | - dfs, |
| 77 | + safepoints, |
79 | 78 | } = self; |
80 | 79 | ssa.clear(); |
81 | 80 | status.clear(); |
82 | 81 | types.clear(); |
83 | 82 | stack_map_values.clear(); |
84 | 83 | stack_map_vars.clear(); |
85 | | - dfs.clear(); |
| 84 | + safepoints.clear(); |
86 | 85 | } |
87 | 86 |
|
88 | 87 | fn is_empty(&self) -> bool { |
@@ -732,7 +731,9 @@ impl<'a> FunctionBuilder<'a> { |
732 | 731 | } |
733 | 732 |
|
734 | 733 | if !self.func_ctx.stack_map_values.is_empty() { |
735 | | - self.insert_safepoint_spills(); |
| 734 | + self.func_ctx |
| 735 | + .safepoints |
| 736 | + .run(&mut self.func, &self.func_ctx.stack_map_values); |
736 | 737 | } |
737 | 738 |
|
738 | 739 | // Clear the state (but preserve the allocated buffers) in preparation |
|
0 commit comments