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

Function write_block_header

cranelift/codegen/src/write.rs:221–250  ·  view source on GitHub ↗

Write out the basic block header, outdented: block1: block1(v1: i32): block10(v4: f64, v5: i8):

(
    w: &mut dyn Write,
    func: &Function,
    block: Block,
    indent: usize,
)

Source from the content-addressed store, hash-verified

219/// block10(v4: f64, v5: i8):
220///
221pub fn write_block_header(
222 w: &mut dyn Write,
223 func: &Function,
224 block: Block,
225 indent: usize,
226) -> fmt::Result {
227 let cold = if func.layout.is_cold(block) {
228 " cold"
229 } else {
230 ""
231 };
232
233 // The `indent` is the instruction indentation. block headers are 4 spaces out from that.
234 write!(w, "{1:0$}{2}", indent - 4, "", block)?;
235
236 let mut args = func.dfg.block_params(block).iter().cloned();
237 match args.next() {
238 None => return writeln!(w, "{cold}:"),
239 Some(arg) => {
240 write!(w, "(")?;
241 write_arg(w, func, arg)?;
242 }
243 }
244 // Remaining arguments.
245 for arg in args {
246 write!(w, ", ")?;
247 write_arg(w, func, arg)?;
248 }
249 writeln!(w, "){cold}:")
250}
251
252fn decorate_block<FW: FuncWriter>(
253 func_w: &mut FW,

Callers 2

write_block_headerMethod · 0.85
block_nodesMethod · 0.85

Calls 5

write_argFunction · 0.85
is_coldMethod · 0.45
iterMethod · 0.45
block_paramsMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected