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

Method use_label_at_offset

cranelift/codegen/src/machinst/buffer.rs:789–811  ·  view source on GitHub ↗

Emit a reference to the given label with the given reference type (i.e., branch-instruction format) at the current offset. This is like a relocation, but handled internally. This can be called before the branch is actually emitted; fixups will not happen until an island is emitted or the buffer is finished.

(&mut self, offset: CodeOffset, label: MachLabel, kind: I::LabelUse)

Source from the content-addressed store, hash-verified

787 /// This can be called before the branch is actually emitted; fixups will
788 /// not happen until an island is emitted or the buffer is finished.
789 pub fn use_label_at_offset(&mut self, offset: CodeOffset, label: MachLabel, kind: I::LabelUse) {
790 trace!(
791 "MachBuffer: use_label_at_offset: offset {} label {:?} kind {:?}",
792 offset, label, kind
793 );
794
795 // Add the fixup, and update the worst-case island size based on a
796 // veneer for this label use.
797 let fixup = MachLabelFixup {
798 label,
799 offset,
800 kind,
801 };
802 self.pending_fixup_deadline = self
803 .pending_fixup_deadline
804 // Subtract one alignment here to the deadline to account for
805 // extra space taken by aligning an island.
806 .min(fixup.deadline() - I::LabelUse::ALIGN);
807 trace!("pending_fixup_deadline = {}", self.pending_fixup_deadline);
808 self.pending_fixup_records.push(fixup);
809
810 // Post-invariant: no mutations to branches/labels data structures.
811 }
812
813 /// Inform the buffer of an unconditional branch at the given offset,
814 /// targeting the given label. May be used to optimize branches.

Callers 15

emit_veneerMethod · 0.80
resolve_relocMethod · 0.80
mem_emitFunction · 0.80
one_way_jmpFunction · 0.80
cond_jmpFunction · 0.80
uncond_jmpFunction · 0.80
emitFunction · 0.80
use_targetMethod · 0.80

Calls 3

deadlineMethod · 0.80
minMethod · 0.45
pushMethod · 0.45