[]Enum cranelift::prelude::GlobalValueData

pub enum GlobalValueData {
    VMContext,
    Load {
        base: GlobalValue,
        offset: Offset32,
        global_type: Type,
        readonly: bool,
    },
    IAddImm {
        base: GlobalValue,
        offset: Imm64,
        global_type: Type,
    },
    Symbol {
        name: ExternalName,
        offset: Imm64,
        colocated: bool,
    },
}

Information about a global value declaration.

Variants

VMContext

Value is the address of the VM context struct.

Load

Value is pointed to by another global value.

The base global value is assumed to contain a pointer. This global value is computed by loading from memory at that pointer value. The memory must be accessible, and naturally aligned to hold a value of the type. The data at this address is assumed to never change while the current function is executing.

Fields of Load

base: GlobalValue

The base pointer global value.

offset: Offset32

Offset added to the base pointer before doing the load.

global_type: Type

Type of the loaded value.

readonly: bool

Specifies whether the memory that this refers to is readonly, allowing for the elimination of redundant loads.

IAddImm

Value is an offset from another global value.

Fields of IAddImm

base: GlobalValue

The base pointer global value.

offset: Imm64

Byte offset to be added to the value.

global_type: Type

Type of the iadd.

Symbol

Value is symbolic, meaning it's a name which will be resolved to an actual value later (eg. by linking). Cranelift itself does not interpret this name; it's used by embedders to link with other data structures.

For now, symbolic values always have pointer type, and represent addresses, however in the future they could be used to represent other things as well.

Fields of Symbol

name: ExternalName

The symbolic name.

offset: Imm64

Offset from the symbol. This can be used instead of IAddImm to represent folding an offset into a symbol.

colocated: bool

Will this symbol be defined nearby, such that it will always be a certain distance away, after linking? If so, references to it can avoid going through a GOT. Note that symbols meant to be preemptible cannot be colocated.

Methods

impl GlobalValueData

pub fn symbol_name(&self) -> &ExternalName

Assume that self is an GlobalValueData::Symbol and return its name.

pub fn global_type(&self, isa: &dyn TargetIsa) -> Type

Return the type of this global.

Trait Implementations

impl Clone for GlobalValueData

impl Display for GlobalValueData

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.