Skip to main content

Usage

Struct Usage 

Source
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: String

What the source calls it, which is the symbol unless an assembler name renamed it.

§named: Span

Where its name is written, which is rucc_ir::Func::named.

§declared: Span

Where 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: u32

The bytes, as crate::frame::Frame::usage defines them.

§dynamic: bool

Whether 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

Source

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.

Source

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.

Source

pub fn span(&self) -> Span

The span the report points at, which is the name where there is one and the brace where there is not.

Trait Implementations§

Source§

impl Clone for Usage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Usage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Usage

Source§

impl PartialEq for Usage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Usage

Auto Trait Implementations§

§

impl Freeze for Usage

§

impl RefUnwindSafe for Usage

§

impl Send for Usage

§

impl Sync for Usage

§

impl Unpin for Usage

§

impl UnsafeUnpin for Usage

§

impl UnwindSafe for Usage

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.