MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / start_function

Method start_function

crates/ir-to-asm/src/compiler/assembly_emitter.rs:85–103  ·  view source on GitHub ↗
(&mut self, name: &str, exported: bool)

Source from the content-addressed store, hash-verified

83 }
84
85 pub fn start_function(&mut self, name: &str, exported: bool) {
86 self.switch_section(".text");
87 self.lines
88 .push("\t; ========================================".to_owned());
89 self.lines.push(format!("\t; Function: {name}"));
90 self.lines
91 .push("\t; ========================================".to_owned());
92 if exported {
93 self.lines.push(format!(".globl {name}"));
94 }
95 self.lines.push(format!("{name}:"));
96 self.tokens
97 .push(RvInstruction::Comment(format!("Function: {name}")));
98 if exported {
99 self.tokens
100 .push(RvInstruction::Directive(format!(".globl {name}")));
101 }
102 self.tokens.push(RvInstruction::Label(name.to_owned()));
103 }
104
105 pub fn end_function(&mut self) {
106 self.lines.push("\t; End of function".to_owned());

Callers 1

compile_functionMethod · 0.80

Calls 3

DirectiveEnum · 0.85
switch_sectionMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected