Skip to main content

AbiDescription

Struct AbiDescription 

Source
pub struct AbiDescription {
    pub name: &'static str,
    pub banks: Banks,
    pub scalars: Scalars,
    pub returns: &'static [Rule],
    pub arguments: &'static [Rule],
    pub return_pointer: ReturnPointer,
    pub variadic: Variadic,
    pub stack_args: StackArgs,
}
Expand description

One psABI, completely.

Everything an ABI decides about how a value travels is in here. What is deliberately not in here is in AbiDescription::stack_args’s note: prologue emission, register allocation constraints and unwind emission are per architecture code with per ABI parameters, and section 6.7 is explicit that turning those into tables costs more than the duplication.

Fields§

§name: &'static str

What the ABI is called, which is the name that goes in a diagnostic and in the report.

§banks: Banks

The registers a call starts with, and how a scalar spends them.

§scalars: Scalars

How a scalar spends registers, which differs between ABIs more than it looks like it should.

§returns: &'static [Rule]

The rules for a return value, tried in order.

§arguments: &'static [Rule]

The rules for an argument, tried in order.

§return_pointer: ReturnPointer

Where the address of a return value that comes back in memory travels.

§variadic: Variadic

What a variadic argument does differently.

§stack_args: StackArgs

How arguments that did not get a register sit in the argument area.

Nothing in this crate reads it. It is here because it is a fact about the ABI and section 6.7 wants the description to be the source of truth for the whole ABI rather than for the half of it that happens to be classification, and because the backend that does read it should be reading it from the same place the tests are generated from.

Implementations§

Source§

impl AbiDescription

Source

pub const fn call(&'static self) -> Call

The start of one call, with every argument register still to spend.

Source§

impl AbiDescription

Source

pub const fn scalar_is_by_reference(&self, size: u64) -> bool

Whether a scalar of this size travels as the address of a copy the caller made.

The size rule of the one ABI that does this is written over the size of the object and says nothing about what is in it, which is why this takes a number rather than a Scalar: a pass writing a call to a runtime routine has a width in hand and no C type behind it, and the answer is the same for both askers because there is only the one rule.

Source

pub const fn wide_integer_returns_in(&self, size: u64) -> Option<Format>

The format an integer of this size comes back in, where the ABI brings one back whole in a vector register rather than through the address the caller passed.

The companion to AbiDescription::scalar_is_by_reference and asked by the same kind of caller for the same reason, a pass writing a call to a runtime routine with a width in hand and no C type behind it. It is a separate question rather than the same one answered the other way because the two disagree on the one ABI that says yes to either: Windows x64 passes a sixteen byte integer as an address and brings one back in xmm0, so __fixtfti there takes an address and answers in a vector register.

None where the size is one a register holds, since then nothing about it is wide, and None on every ABI that does not do this.

Trait Implementations§

Source§

impl Clone for AbiDescription

Source§

fn clone(&self) -> AbiDescription

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 Copy for AbiDescription

Source§

impl Debug for AbiDescription

Source§

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

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

impl Eq for AbiDescription

Source§

impl PartialEq for AbiDescription

Source§

fn eq(&self, other: &AbiDescription) -> 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 AbiDescription

Auto Trait Implementations§

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.