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

Function filecheck_text

cranelift/filetests/src/test_domtree.rs:119–146  ·  view source on GitHub ↗

Generate some output for filecheck testing

(func: &Function, domtree: &DominatorTree)

Source from the content-addressed store, hash-verified

117
118// Generate some output for filecheck testing
119fn filecheck_text(func: &Function, domtree: &DominatorTree) -> Result<String, fmt::Error> {
120 let mut s = String::new();
121
122 write!(s, "cfg_postorder:")?;
123 for &block in domtree.cfg_postorder() {
124 write!(s, " {block}")?;
125 }
126 writeln!(s)?;
127
128 // Compute and print out a pre-order of the dominator tree.
129 writeln!(s, "domtree_preorder {{")?;
130 let mut stack = Vec::new();
131 stack.extend(func.layout.entry_block());
132 while let Some(block) = stack.pop() {
133 write!(s, " {block}:")?;
134 let i = stack.len();
135 for ch in domtree.children(block) {
136 write!(s, " {ch}")?;
137 stack.push(ch);
138 }
139 writeln!(s)?;
140 // Reverse the children we just pushed so we'll pop them in order.
141 stack[i..].reverse();
142 }
143 writeln!(s, "}}")?;
144
145 Ok(s)
146}

Callers 1

runMethod · 0.85

Calls 10

OkFunction · 0.85
childrenMethod · 0.80
reverseMethod · 0.80
newFunction · 0.50
cfg_postorderMethod · 0.45
extendMethod · 0.45
entry_blockMethod · 0.45
popMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected