pub struct Signature {Show 17 fields
pub name: String,
pub params: Vec<Parameter>,
pub ret_ty: Option<MirType>,
pub ret_signedness: Signedness,
pub ret_aggregate: Option<Aggregate>,
pub kernel: Option<KernelMetadata>,
pub no_inline: bool,
pub inline_hint: bool,
pub noreturn: bool,
pub pure: bool,
pub visibility: Option<SymbolVisibility>,
pub placement: Option<CodePlacement>,
pub weak: bool,
pub section: Option<String>,
pub align: Option<u32>,
pub naked: bool,
pub variadic: bool,
}Expand description
Function signature
Fields§
§name: StringFunction name
params: Vec<Parameter>Parameters (in order)
ret_ty: Option<MirType>Return type (None for void)
ret_signedness: SignednessSignedness of an integer return value
ret_aggregate: Option<Aggregate>Set when the function returns an aggregate by value. ret_ty is then the pointer
to it, and a call’s result register names the caller’s slot for the copy.
kernel: Option<KernelMetadata>§no_inline: boolSet by @noinline; the inliner must leave calls to this function alone.
inline_hint: boolSet by @inline; the inliner accepts a larger body than its default size limit.
noreturn: boolSet by @noreturn; no code after a call to this function is reachable.
pure: boolSet by @pure or @const; a call whose result is unused can be deleted.
visibility: Option<SymbolVisibility>Set by @internal, @private, @hidden or @protected.
placement: Option<CodePlacement>Set by @cold or @hot.
weak: boolSet by @weak; the symbol is emitted as a weak definition.
section: Option<String>Set by @section("name"); the function is emitted into that ELF section.
align: Option<u32>Set by @align(n); the function entry is aligned to n bytes.
naked: boolSet by @naked; the function is emitted with no prologue or epilogue.
variadic: boolSet by a trailing ... on an @extern declaration. A call to one follows the
variadic side of the platform convention.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a void, parameterless, non-kernel signature that the inliner may inline.
Sourcepub fn with_kernel(self, metadata: KernelMetadata) -> Self
pub fn with_kernel(self, metadata: KernelMetadata) -> Self
Marks the function as a GPU kernel, which GPU codegen requires to be void with a single block.