MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / dump_gap_interference

Method dump_gap_interference

src/internal/allocator/split.rs:541–578  ·  view source on GitHub ↗

Prints the maximum spill weight of interference that needs to be evicted from a virtual register in order to allocate each gap.

(
        reg: PhysReg,
        splitter: &Splitter,
        reg_matrix: &RegMatrix,
        virt_regs: &VirtRegs,
        reginfo: &impl RegInfo,
    )

Source from the content-addressed store, hash-verified

539 /// Prints the maximum spill weight of interference that needs to be
540 /// evicted from a virtual register in order to allocate each gap.
541 fn dump_gap_interference(
542 reg: PhysReg,
543 splitter: &Splitter,
544 reg_matrix: &RegMatrix,
545 virt_regs: &VirtRegs,
546 reginfo: &impl RegInfo,
547 ) {
548 if !trace_enabled!() {
549 return;
550 }
551
552 let mut gap_interference_weights = vec![0.0; splitter.gaps.len()];
553
554 _ = reg_matrix.check_interference(
555 &splitter.gap_segments,
556 reg,
557 reginfo,
558 &mut Default::default(),
559 true,
560 |interference| {
561 // Fixed interference has a infinite spill weight since it cannot be
562 // evicted.
563 let weight = match interference.kind {
564 InterferenceKind::Fixed => f32::INFINITY,
565 InterferenceKind::VirtReg(virt_reg) => virt_regs[virt_reg].spill_weight,
566 };
567 let gap_interference_weight =
568 &mut gap_interference_weights[interference.segment.gap_idx as usize];
569 *gap_interference_weight = weight.max(*gap_interference_weight);
570 ControlFlow::<()>::Continue(())
571 },
572 );
573
574 trace!("Gap interference for {reg}:");
575 for (idx, weight) in gap_interference_weights.iter().enumerate() {
576 trace!(" {idx}: {weight}");
577 }
578 }
579
580 /// Builds a proposed split region starting from the best use that is small
581 /// enough to evict any interference in the given physical register.

Callers

nothing calls this directly

Calls 2

check_interferenceMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected