MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / declare_data_in_func

Method declare_data_in_func

cranelift/module/src/module.rs:923–936  ·  view source on GitHub ↗

Use this when you're building the IR of a function to reference a data object. TODO: Same as above.

(&self, data: DataId, func: &mut ir::Function)

Source from the content-addressed store, hash-verified

921 ///
922 /// TODO: Same as above.
923 fn declare_data_in_func(&self, data: DataId, func: &mut ir::Function) -> ir::GlobalValue {
924 let decl = &self.declarations().data_objects[data];
925 let colocated = decl.linkage.is_final();
926 let user_name_ref = func.declare_imported_user_function(ir::UserExternalName {
927 namespace: 1,
928 index: data.as_u32(),
929 });
930 func.create_global_value(ir::GlobalValueData::Symbol {
931 name: ir::ExternalName::user(user_name_ref),
932 offset: ir::immediates::Imm64::new(0),
933 colocated,
934 tls: decl.tls,
935 })
936 }
937
938 /// TODO: Same as above.
939 fn declare_func_in_data(&self, func_id: FuncId, data: &mut DataDescription) -> ir::FuncRef {

Callers

nothing calls this directly

Implementers 3

module.rscranelift/module/src/module.rs
backend.rscranelift/jit/src/backend.rs
backend.rscranelift/object/src/backend.rs

Calls 6

newFunction · 0.50
declarationsMethod · 0.45
is_finalMethod · 0.45
as_u32Method · 0.45
create_global_valueMethod · 0.45

Tested by

no test coverage detected