pub(crate) struct ArgAbi<'a, Ty> {
pub layout: TyAndLayout<'a, Ty>,
pub mode: PassMode,
}
Expand description
Information about how to pass an argument to, or return a value from, a function, under some ABI.
Fields§
§layout: TyAndLayout<'a, Ty>
§mode: PassMode
Implementations§
source§impl<'a, Ty> ArgAbi<'a, Ty>
impl<'a, Ty> ArgAbi<'a, Ty>
sourcepub fn new(
cx: &impl HasDataLayout,
layout: TyAndLayout<'a, Ty>,
scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, Scalar, Size) -> ArgAttributes,
) -> ArgAbi<'a, Ty>
pub fn new( cx: &impl HasDataLayout, layout: TyAndLayout<'a, Ty>, scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, Scalar, Size) -> ArgAttributes, ) -> ArgAbi<'a, Ty>
This defines the “default ABI” for that type, that is then later adjusted in fn_abi_adjust_for_abi
.
sourcepub fn make_direct_deprecated(&mut self)
pub fn make_direct_deprecated(&mut self)
Pass this argument directly instead. Should NOT be used! Only exists because of past ABI mistakes that will take time to fix (see https://github.com/rust-lang/rust/issues/115666).
sourcepub fn make_indirect(&mut self)
pub fn make_indirect(&mut self)
Pass this argument indirectly, by passing a (thin or wide) pointer to the argument instead. This is valid for both sized and unsized arguments.
sourcepub fn make_indirect_from_ignore(&mut self)
pub fn make_indirect_from_ignore(&mut self)
Same as make_indirect
, but for arguments that are ignored. Only needed for ABIs that pass
ZSTs indirectly.
sourcepub fn pass_by_stack_offset(&mut self, byval_align: Option<Align>)
pub fn pass_by_stack_offset(&mut self, byval_align: Option<Align>)
Pass this argument indirectly, by placing it at a fixed stack offset.
This corresponds to the byval
LLVM argument attribute.
This is only valid for sized arguments.
byval_align
specifies the alignment of the byval
stack slot, which does not need to
correspond to the type’s alignment. This will be Some
if the target’s ABI specifies that
stack slots used for arguments passed by-value have specific alignment requirements which
differ from the alignment used in other situations.
If None
, the type’s alignment is used.
If the resulting alignment differs from the type’s alignment, the argument will be copied to an alloca with sufficient alignment, either in the caller (if the type’s alignment is lower than the byval alignment) or in the callee (if the type’s alignment is higher than the byval alignment), to ensure that Rust code never sees an underaligned pointer.
pub fn extend_integer_width_to(&mut self, bits: u64)
pub fn cast_to<T>(&mut self, target: T)where
T: Into<CastTarget>,
pub fn cast_to_and_pad_i32<T>(&mut self, target: T, pad_i32: bool)where
T: Into<CastTarget>,
pub fn is_indirect(&self) -> bool
pub fn is_sized_indirect(&self) -> bool
pub fn is_unsized_indirect(&self) -> bool
pub fn is_ignore(&self) -> bool
Trait Implementations§
source§impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>>
impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>>
source§fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type
fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type
Gets the LLVM type for a place of the original Rust type of
this argument/return, i.e., the result of type_of::type_of
.
source§fn store(
&self,
bx: &mut Builder<'_, 'll, 'tcx>,
val: &'ll Value,
dst: PlaceRef<'tcx, &'ll Value>,
)
fn store( &self, bx: &mut Builder<'_, 'll, 'tcx>, val: &'ll Value, dst: PlaceRef<'tcx, &'ll Value>, )
Stores a direct/indirect value described by this ArgAbi into a place for the original Rust type of this argument/return. Can be used for both storing formal arguments into Rust variables or results of call/invoke instructions into their destinations.
fn store_fn_arg( &self, bx: &mut Builder<'_, 'll, 'tcx>, idx: &mut usize, dst: PlaceRef<'tcx, &'ll Value>, )
source§impl<'a, Ty, __CTX> HashStable<__CTX> for ArgAbi<'a, Ty>where
__CTX: HashStableContext,
Ty: HashStable<__CTX>,
impl<'a, Ty, __CTX> HashStable<__CTX> for ArgAbi<'a, Ty>where
__CTX: HashStableContext,
Ty: HashStable<__CTX>,
fn hash_stable( &self, __hcx: &mut __CTX, __hasher: &mut StableHasher<SipHasher128>, )
impl<'a, Ty> Eq for ArgAbi<'a, Ty>where
Ty: Eq,
impl<'a, Ty> StructuralPartialEq for ArgAbi<'a, Ty>
Auto Trait Implementations§
impl<'a, Ty> Freeze for ArgAbi<'a, Ty>where
Ty: Freeze,
impl<'a, Ty> RefUnwindSafe for ArgAbi<'a, Ty>where
Ty: RefUnwindSafe,
impl<'a, Ty> Send for ArgAbi<'a, Ty>where
Ty: Send,
impl<'a, Ty> Sync for ArgAbi<'a, Ty>where
Ty: Sync,
impl<'a, Ty> Unpin for ArgAbi<'a, Ty>where
Ty: Unpin,
impl<'a, Ty> UnwindSafe for ArgAbi<'a, Ty>where
Ty: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<Tcx, T> DepNodeParams<Tcx> for T
impl<Tcx, T> DepNodeParams<Tcx> for T
default fn fingerprint_style() -> FingerprintStyle
source§default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_debug_str(&self, _: Tcx) -> String
source§default fn recover(_: Tcx, _: &DepNode) -> Option<T>
default fn recover(_: Tcx, _: &DepNode) -> Option<T>
DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.