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,
        tls: bool,
    },
    DynScaleTargetConst {
        vector_type: Type,
    },
}
Expand description

Information about a global value declaration.

Variants

VMContext

Value is the address of the VM context struct.

Load

Fields

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.

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.

IAddImm

Fields

base: GlobalValue

The base pointer global value.

offset: Imm64

Byte offset to be added to the value.

global_type: Type

Type of the iadd.

Value is an offset from another global value.

Symbol

Fields

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.

If true, some backends may use relocation forms that have limited range: for example, a +/- 2^27-byte range on AArch64. See the documentation for RelocDistance for more details.

tls: bool

Does this symbol refer to a thread local storage value?

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.

DynScaleTargetConst

Fields

vector_type: Type

Base vector type.

Value is a multiple of how many instances of vector_type will fit in a target vector register.

Implementations

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

Return the type of this global.

If this global references a symbol, return an estimate of the relocation distance, based on the colocated flag.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.