pub struct GlobalOperation<'c> { /* private fields */ }
Expand description

A global operation. Declare or define a global memref variable.

The memref.global operation declares or defines a named global memref variable. The backing memory for the variable is allocated statically and is described by the type of the variable (which should be a statically shaped memref type). The operation is a declaration if no initial_value is specified, else it is a definition. The initial_value can either be a unit attribute to represent a definition of an uninitialized global variable, or an elements attribute to represent the definition of a global variable with an initial value. The global variable can also be marked constant using the constant unit attribute. Writing to such constant global variables is undefined.

The global variable can be accessed by using the memref.get_global to retrieve the memref for the global variable. Note that the memref for such global variable itself is immutable (i.e., memref.get_global for a given global variable will always return the same memref descriptor).

Example:

// Private variable with an initial value.
memref.global "private" @x : memref<2xf32> = dense<0.0,2.0>

// Private variable with an initial value and an alignment (power of 2).
memref.global "private" @x : memref<2xf32> = dense<0.0,2.0> {alignment = 64}

// Declaration of an external variable.
memref.global "private" @y : memref<4xi32>

// Uninitialized externally visible variable.
memref.global @z : memref<3xf16> = uninitialized

// Externally visible constant variable.
memref.global constant @c : memref<2xi32> = dense<1, 4>

Implementations§

source§

impl<'c> GlobalOperation<'c>

source

pub fn name() -> &'static str

Returns a name.

source

pub fn as_operation(&self) -> &Operation<'c>

Returns a generic operation.

source

pub fn builder( context: &'c Context, location: Location<'c> ) -> GlobalOperationBuilder<'c, Unset, Unset>

Creates a builder.

source

pub fn sym_name(&self) -> Result<StringAttribute<'c>, Error>

source

pub fn set_sym_name(&mut self, value: StringAttribute<'c>)

source

pub fn sym_visibility(&self) -> Result<StringAttribute<'c>, Error>

source

pub fn set_sym_visibility(&mut self, value: StringAttribute<'c>)

source

pub fn remove_sym_visibility(&mut self) -> Result<(), Error>

source

pub fn type(&self) -> Result<TypeAttribute<'c>, Error>

source

pub fn set_type(&mut self, value: TypeAttribute<'c>)

source

pub fn initial_value(&self) -> Result<Attribute<'c>, Error>

source

pub fn set_initial_value(&mut self, value: Attribute<'c>)

source

pub fn remove_initial_value(&mut self) -> Result<(), Error>

source

pub fn constant(&self) -> Result<Attribute<'c>, Error>

source

pub fn set_constant(&mut self, value: Attribute<'c>)

source

pub fn remove_constant(&mut self) -> Result<(), Error>

source

pub fn alignment(&self) -> Result<IntegerAttribute<'c>, Error>

source

pub fn set_alignment(&mut self, value: IntegerAttribute<'c>)

source

pub fn remove_alignment(&mut self) -> Result<(), Error>

Trait Implementations§

source§

impl<'c> From<GlobalOperation<'c>> for Operation<'c>

source§

fn from(operation: GlobalOperation<'c>) -> Self

Converts to this type from the input type.
source§

impl<'c> TryFrom<Operation<'c>> for GlobalOperation<'c>

§

type Error = Error

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

fn try_from(operation: Operation<'c>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'c> RefUnwindSafe for GlobalOperation<'c>

§

impl<'c> !Send for GlobalOperation<'c>

§

impl<'c> !Sync for GlobalOperation<'c>

§

impl<'c> Unpin for GlobalOperation<'c>

§

impl<'c> UnwindSafe for GlobalOperation<'c>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.