@@ -118,53 +118,53 @@ pub(crate) enum RegionElement {
118
118
119
119
/// Records the CFG locations where each region is live. When we initially compute liveness, we use
120
120
/// an interval matrix storing liveness ranges for each region-vid.
121
- pub ( crate ) struct LivenessValues < N : Idx > {
121
+ pub ( crate ) struct LivenessValues {
122
122
elements : Rc < RegionValueElements > ,
123
- points : SparseIntervalMatrix < N , PointIndex > ,
123
+ points : SparseIntervalMatrix < RegionVid , PointIndex > ,
124
124
}
125
125
126
- impl < N : Idx > LivenessValues < N > {
126
+ impl LivenessValues {
127
127
/// Create an empty map of regions to locations where they're live.
128
128
pub ( crate ) fn new ( elements : Rc < RegionValueElements > ) -> Self {
129
129
Self { points : SparseIntervalMatrix :: new ( elements. num_points ) , elements }
130
130
}
131
131
132
132
/// Iterate through each region that has a value in this set.
133
- pub ( crate ) fn regions ( & self ) -> impl Iterator < Item = N > {
133
+ pub ( crate ) fn regions ( & self ) -> impl Iterator < Item = RegionVid > {
134
134
self . points . rows ( )
135
135
}
136
136
137
137
/// Records `region` as being live at the given `location`.
138
- pub ( crate ) fn add_location ( & mut self , region : N , location : Location ) {
138
+ pub ( crate ) fn add_location ( & mut self , region : RegionVid , location : Location ) {
139
139
debug ! ( "LivenessValues::add_location(region={:?}, location={:?})" , region, location) ;
140
140
let point = self . elements . point_from_location ( location) ;
141
141
self . points . insert ( region, point) ;
142
142
}
143
143
144
144
/// Records `region` as being live at all the given `points`.
145
- pub ( crate ) fn add_points ( & mut self , region : N , points : & IntervalSet < PointIndex > ) {
145
+ pub ( crate ) fn add_points ( & mut self , region : RegionVid , points : & IntervalSet < PointIndex > ) {
146
146
debug ! ( "LivenessValues::add_points(region={:?}, points={:?})" , region, points) ;
147
147
self . points . union_row ( region, points) ;
148
148
}
149
149
150
150
/// Records `region` as being live at all the control-flow points.
151
- pub ( crate ) fn add_all_points ( & mut self , region : N ) {
151
+ pub ( crate ) fn add_all_points ( & mut self , region : RegionVid ) {
152
152
self . points . insert_all_into_row ( region) ;
153
153
}
154
154
155
155
/// Returns whether `region` is marked live at the given `location`.
156
- pub ( crate ) fn is_live_at ( & self , region : N , location : Location ) -> bool {
156
+ pub ( crate ) fn is_live_at ( & self , region : RegionVid , location : Location ) -> bool {
157
157
let point = self . elements . point_from_location ( location) ;
158
158
self . points . row ( region) . is_some_and ( |r| r. contains ( point) )
159
159
}
160
160
161
161
/// Returns whether `region` is marked live at any location.
162
- pub ( crate ) fn is_live_anywhere ( & self , region : N ) -> bool {
162
+ pub ( crate ) fn is_live_anywhere ( & self , region : RegionVid ) -> bool {
163
163
self . live_points ( region) . next ( ) . is_some ( )
164
164
}
165
165
166
166
/// Returns an iterator of all the points where `region` is live.
167
- fn live_points ( & self , region : N ) -> impl Iterator < Item = PointIndex > + ' _ {
167
+ fn live_points ( & self , region : RegionVid ) -> impl Iterator < Item = PointIndex > + ' _ {
168
168
self . points
169
169
. row ( region)
170
170
. into_iter ( )
@@ -173,7 +173,7 @@ impl<N: Idx> LivenessValues<N> {
173
173
}
174
174
175
175
/// Returns a "pretty" string value of the region. Meant for debugging.
176
- pub ( crate ) fn region_value_str ( & self , region : N ) -> String {
176
+ pub ( crate ) fn region_value_str ( & self , region : RegionVid ) -> String {
177
177
region_value_str (
178
178
self . live_points ( region) . map ( |p| RegionElement :: Location ( self . elements . to_location ( p) ) ) ,
179
179
)
@@ -309,7 +309,7 @@ impl<N: Idx> RegionValues<N> {
309
309
/// `self[to] |= values[from]`, essentially: that is, take all the
310
310
/// elements for the region `from` from `values` and add them to
311
311
/// the region `to` in `self`.
312
- pub ( crate ) fn merge_liveness < M : Idx > ( & mut self , to : N , from : M , values : & LivenessValues < M > ) {
312
+ pub ( crate ) fn merge_liveness ( & mut self , to : N , from : RegionVid , values : & LivenessValues ) {
313
313
if let Some ( set) = values. points . row ( from) {
314
314
self . points . union_row ( to, set) ;
315
315
}
0 commit comments