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

Function generate_gv

cranelift/codegen/src/machinst/abi.rs:1422–1455  ·  view source on GitHub ↗
(
    f: &ir::Function,
    sigs: &SigSet,
    sig: Sig,
    gv: ir::GlobalValue,
    insts: &mut SmallInstVec<M::I>,
)

Source from the content-addressed store, hash-verified

1420}
1421
1422fn generate_gv<M: ABIMachineSpec>(
1423 f: &ir::Function,
1424 sigs: &SigSet,
1425 sig: Sig,
1426 gv: ir::GlobalValue,
1427 insts: &mut SmallInstVec<M::I>,
1428) -> Reg {
1429 match f.global_values[gv] {
1430 // Return the direct register the vmcontext is in
1431 ir::GlobalValueData::VMContext => {
1432 get_special_purpose_param_register(f, sigs, sig, ir::ArgumentPurpose::VMContext)
1433 .expect("no vmcontext parameter found")
1434 }
1435 // Load our base value into a register, then load from that register
1436 // in to a temporary register.
1437 ir::GlobalValueData::Load {
1438 base,
1439 offset,
1440 global_type: _,
1441 flags: _,
1442 } => {
1443 let base = generate_gv::<M>(f, sigs, sig, base, insts);
1444 let into_reg = Writable::from_reg(M::get_stacklimit_reg(f.stencil.signature.call_conv));
1445 insts.push(M::gen_load_base_offset(
1446 into_reg,
1447 base,
1448 offset.into(),
1449 M::word_type(),
1450 ));
1451 return into_reg.to_reg();
1452 }
1453 ref other => panic!("global value for stack limit not supported: {other}"),
1454 }
1455}
1456
1457/// Returns true if the signature needs to be legalized.
1458fn missing_struct_return(sig: &ir::Signature) -> bool {

Callers

nothing calls this directly

Calls 4

to_regMethod · 0.80
expectMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected