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

Method super_preamble

cranelift/codegen/src/write.rs:42–105  ·  view source on GitHub ↗

Default impl of `write_preamble`

(&mut self, w: &mut dyn Write, func: &Function)

Source from the content-addressed store, hash-verified

40
41 /// Default impl of `write_preamble`
42 fn super_preamble(&mut self, w: &mut dyn Write, func: &Function) -> Result<bool, fmt::Error> {
43 let mut any = false;
44
45 for (ss, slot) in func.dynamic_stack_slots.iter() {
46 any = true;
47 self.write_entity_definition(w, func, ss.into(), slot)?;
48 }
49
50 for (ss, slot) in func.sized_stack_slots.iter() {
51 any = true;
52 self.write_entity_definition(w, func, ss.into(), slot)?;
53 }
54
55 for (ar, ar_data) in func.dfg.alias_regions.iter() {
56 any = true;
57 self.write_entity_definition(
58 w,
59 func,
60 ar.into(),
61 &format_args!("{} \"{}\"", ar_data.user_id, ar_data.description),
62 )?;
63 }
64
65 for (gv, gv_data) in &func.global_values {
66 any = true;
67 self.write_entity_definition(
68 w,
69 func,
70 gv.into(),
71 &gv_data.display(&func.dfg.mem_flags),
72 )?;
73 }
74
75 // Write out all signatures before functions since function declarations can refer to
76 // signatures.
77 for (sig, sig_data) in &func.dfg.signatures {
78 any = true;
79 self.write_entity_definition(w, func, sig.into(), &sig_data)?;
80 }
81
82 for (fnref, ext_func) in &func.dfg.ext_funcs {
83 if ext_func.signature != SigRef::reserved_value() {
84 any = true;
85 self.write_entity_definition(
86 w,
87 func,
88 fnref.into(),
89 &ext_func.display(Some(&func.params)),
90 )?;
91 }
92 }
93
94 for (&cref, cval) in func.dfg.constants.iter() {
95 any = true;
96 self.write_entity_definition(w, func, cref.into(), cval)?;
97 }
98
99 if let Some(limit) = func.stack_limit {

Callers 1

write_preambleMethod · 0.80

Implementers 2

write.rscranelift/codegen/src/write.rs
print_errors.rscranelift/codegen/src/print_errors.rs

Calls 4

OkFunction · 0.85
iterMethod · 0.45
displayMethod · 0.45

Tested by

no test coverage detected