pub struct Usage {
pub name: String,
pub named: Span,
pub declared: Span,
pub bytes: u32,
pub dynamic: bool,
}Expand description
One function’s stack use.
Fields§
§name: StringWhat the source calls it, which is the symbol unless an assembler name renamed it.
named: SpanWhere its name is written, which is rucc_ir::Func::named.
declared: SpanWhere its body opens, which is rucc_ir::Func::declared and what is said instead when a
function has no name span, as one built by something other than the C lowering has not.
bytes: u32The bytes, as crate::frame::Frame::usage defines them.
dynamic: boolWhether the function moves the stack pointer while it runs, which a variable length array
and an alloca both do, and which makes bytes a floor rather than the whole answer.
Implementations§
Source§impl Usage
impl Usage
Sourcepub fn qualifier(&self) -> &'static str
pub fn qualifier(&self) -> &'static str
What gcc writes in the third column, which is static when the number is the whole answer
and dynamic when the function takes more while it runs.
gcc has a third answer, dynamic,bounded, for a function that moves the stack pointer by
an amount it can put a bound on, and on x86-64 the usual one is a function that pushes the
arguments of a call that passes some on the stack. Such a function here has the room for
them in its frame from the prologue on, which crate::frame::Frame::usage counts
already, so the same bytes come out as static. Nothing else here puts a bound on how far
a frame grows, so this answer is never given.
Sourcepub fn line(&self, file: &str, line: u32, column: u32) -> String
pub fn line(&self, file: &str, line: u32, column: u32) -> String
This function’s line of a .su file, with the newline that ends it.
file:line:column:function, a tab, the bytes, a tab and the qualifier, which is what gcc 16
writes and what a tool reading gcc’s files splits on. The line and the column are where
Usage::span is, counting from one, and the file is the name the source was opened
under, so a function in a header is reported against the header, the same as gcc.