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

Method fmt

cranelift/codegen/src/dominator_tree.rs:163–199  ·  view source on GitHub ↗
(&self, f: &mut core::fmt::Formatter<'_>)

Source from the content-addressed store, hash-verified

161
162impl core::fmt::Debug for DominatorTree {
163 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
164 if !self.is_valid() {
165 return f.write_str("DominatorTree { <invalid> }");
166 }
167
168 let mut s = f.debug_tuple("DominatorTree");
169
170 if let Some((mut root, _)) = self.nodes.iter().find(|n| n.1.pre_number != NOT_VISITED) {
171 loop {
172 if let Some(b) = self.idom(root)
173 && b != root
174 {
175 root = b;
176 } else {
177 break;
178 }
179 }
180
181 fn fmt_block(domtree: &DominatorTree, block: Block) -> impl core::fmt::Debug {
182 core::fmt::from_fn(move |f| {
183 let children = domtree
184 .children(block)
185 .map(|c| fmt_block(domtree, c))
186 .collect::<Vec<_>>();
187 let mut s = f.debug_tuple(&format!("{block}"));
188 if !children.is_empty() {
189 s.field(&children);
190 }
191 s.finish()
192 })
193 }
194
195 s.field(&fmt_block(self, root));
196 }
197
198 s.finish()
199 }
200}
201
202/// Methods for querying the dominator tree.

Callers

nothing calls this directly

Calls 7

is_validMethod · 0.45
write_strMethod · 0.45
findMethod · 0.45
iterMethod · 0.45
idomMethod · 0.45
fieldMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected