MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / start_block

Method start_block

cranelift/codegen/src/egraph/elaborate.rs:171–220  ·  view source on GitHub ↗
(&mut self, idom: Option<Block>, block: Block)

Source from the content-addressed store, hash-verified

169 }
170
171 fn start_block(&mut self, idom: Option<Block>, block: Block) {
172 trace!(
173 "start_block: block {:?} with idom {:?} at loop depth {:?} scope depth {}",
174 block,
175 idom,
176 self.loop_stack.len(),
177 self.value_to_elaborated_value.depth()
178 );
179
180 // Pop any loop levels we're no longer in.
181 while let Some(inner_loop) = self.loop_stack.last() {
182 if self.loop_analysis.is_in_loop(block, inner_loop.lp) {
183 break;
184 }
185 self.loop_stack.pop();
186 }
187
188 // Note that if the *entry* block is a loop header, we will
189 // not make note of the loop here because it will not have an
190 // immediate dominator. We must disallow this case because we
191 // will skip adding the `LoopStackEntry` here but our
192 // `LoopAnalysis` will otherwise still make note of this loop
193 // and loop depths will not match.
194 if let Some(idom) = idom {
195 if let Some(lp) = self.loop_analysis.is_loop_header(block) {
196 self.loop_stack.push(LoopStackEntry {
197 lp,
198 // Any code hoisted out of this loop will have code
199 // placed in `idom`, and will have def mappings
200 // inserted in to the scoped hashmap at that block's
201 // level.
202 hoist_block: idom,
203 scope_depth: (self.value_to_elaborated_value.depth() - 1) as u32,
204 });
205 trace!(
206 " -> loop header, pushing; depth now {}",
207 self.loop_stack.len()
208 );
209 }
210 } else {
211 debug_assert!(
212 self.loop_analysis.is_loop_header(block).is_none(),
213 "Entry block (domtree root) cannot be a loop header!"
214 );
215 }
216
217 trace!("block {}: loop stack is {:?}", block, self.loop_stack);
218
219 self.cur_block = block;
220 }
221
222 fn topo_sorted_values(&self) -> Vec<Value> {
223 #[derive(Debug)]

Callers 1

elaborate_blockMethod · 0.80

Calls 6

is_in_loopMethod · 0.80
is_loop_headerMethod · 0.80
depthMethod · 0.80
lastMethod · 0.45
popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected