Skip to main content

Places

Struct Places 

Source
pub struct Places<'a> { /* private fields */ }
Expand description

Where the values a call passes are, worked out one after another.

crate::abi::Call answers a different question: whether a value travels in registers at all and in how many, which is what decides the shape of a signature and is settled before the IR for a function exists. This answers the question after it. Given values in the order the signature holds them, it says which register each one is in and how far up the argument area the ones that got no register are. Both count registers, and they agree about how many fit because they read the same lists, but they run at opposite ends of the compiler and neither can be the other.

Ask about each value in the order the signature holds them. Asking out of order answers about a different signature, because where a value is depends on every value before it.

Implementations§

Source§

impl<'a> Places<'a>

Source

pub fn new(regs: &'a CallRegs) -> Self

Where the first value is, for a call under that convention.

Source

pub fn integer(&mut self) -> Where

Where the next value is, when it travels in a general purpose register.

Source

pub fn float(&mut self) -> Where

Where the next value is, when it travels in a vector register.

Source

pub fn on_stack(&mut self, size: u32, align: u32) -> Where

Where the next value is, when it travels in memory whatever is left.

Every argument area is a run of whole words, so a value narrower than one still takes one and a value that is not a whole number of them is rounded up. An alignment wider than a word is respected, which is what a sixteen byte aligned structure passed by value needs.

Source

pub fn size(&self) -> u32

How many bytes of argument area the values so far need, shadow space included.

Source

pub fn integers(&self) -> usize

How many general purpose argument registers the values so far took.

What a variadic callee needs and nothing else does. va_start has to record how far into each of the two register sequences the arguments the signature names got, because the first argument it does not name is the one after them, and asking here is the only way to know that is the same count the caller worked from.

Source

pub fn floats(&self) -> usize

How many vector argument registers the values so far took.

Trait Implementations§

Source§

impl<'a> Clone for Places<'a>

Source§

fn clone(&self) -> Places<'a>

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<'a> Debug for Places<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Places<'a>

§

impl<'a> RefUnwindSafe for Places<'a>

§

impl<'a> Send for Places<'a>

§

impl<'a> Sync for Places<'a>

§

impl<'a> Unpin for Places<'a>

§

impl<'a> UnsafeUnpin for Places<'a>

§

impl<'a> UnwindSafe for Places<'a>

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.