Enum GlobalValueData
pub enum GlobalValueData {
VMContext,
Load {
base: GlobalValue,
offset: Offset32,
global_type: Type,
flags: MemFlags,
},
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
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
base: GlobalValue
The base pointer global value.
offset: Offset32
Offset added to the base pointer before doing the load.
IAddImm
Value is an offset from another global value.
Fields
base: GlobalValue
The base pointer global value.
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
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.
DynScaleTargetConst
Value is a multiple of how many instances of vector_type
will fit in
a target vector register.
Implementations§
§impl GlobalValueData
impl GlobalValueData
pub fn symbol_name(&self) -> &ExternalName
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
pub fn global_type(&self, isa: &dyn TargetIsa) -> Type
Return the type of this global.
Trait Implementations§
§impl Clone for GlobalValueData
impl Clone for GlobalValueData
§fn clone(&self) -> GlobalValueData
fn clone(&self) -> GlobalValueData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for GlobalValueData
impl Debug for GlobalValueData
§impl<'de> Deserialize<'de> for GlobalValueData
impl<'de> Deserialize<'de> for GlobalValueData
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GlobalValueData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GlobalValueData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for GlobalValueData
impl Display for GlobalValueData
§impl Hash for GlobalValueData
impl Hash for GlobalValueData
§impl PartialEq for GlobalValueData
impl PartialEq for GlobalValueData
§impl Serialize for GlobalValueData
impl Serialize for GlobalValueData
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for GlobalValueData
Auto Trait Implementations§
impl Freeze for GlobalValueData
impl RefUnwindSafe for GlobalValueData
impl Send for GlobalValueData
impl Sync for GlobalValueData
impl Unpin for GlobalValueData
impl UnwindSafe for GlobalValueData
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
)