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

Method add_uncond_branch

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

Inform the buffer of an unconditional branch at the given offset, targeting the given label. May be used to optimize branches. The last added label-use must correspond to this branch. This must be called when the current offset is equal to `start`; i.e., before actually emitting the branch. This implies that for a branch that uses a label and is eligible for optimizations by the MachBuffer, the pr

(&mut self, start: CodeOffset, end: CodeOffset, target: MachLabel)

Source from the content-addressed store, hash-verified

825 /// Additional requirement: no labels may be bound between `start` and `end`
826 /// (exclusive on both ends).
827 pub fn add_uncond_branch(&mut self, start: CodeOffset, end: CodeOffset, target: MachLabel) {
828 debug_assert!(
829 !self.open_patchable,
830 "Branch instruction inserted within a patchable region"
831 );
832 assert!(self.cur_offset() == start);
833 debug_assert!(end > start);
834 assert!(!self.pending_fixup_records.is_empty());
835 let fixup = self.pending_fixup_records.len() - 1;
836 self.lazily_clear_labels_at_tail();
837 self.latest_branches.push(MachBranch {
838 start,
839 end,
840 target,
841 fixup,
842 inverted: None,
843 labels_at_this_branch: self.labels_at_tail.clone(),
844 });
845
846 // Post-invariant: we asserted branch start is current tail; the list of
847 // labels at branch is cloned from list of labels at current tail.
848 }
849
850 /// Inform the buffer of a conditional branch at the given offset,
851 /// targeting the given label. May be used to optimize branches.

Callers 6

uncond_jmpFunction · 0.80
try_emit_compressedMethod · 0.80
emit_uncompressedMethod · 0.80
emitMethod · 0.80
pulley_emitFunction · 0.80

Calls 4

lenMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected