Browse Source

cranelift: Pass source location through directly (#8471)

Stashing the source location in a side location is unnecessary: we
already have it where we need it.
pull/8493/head
Jamey Sharp 6 months ago
committed by GitHub
parent
commit
3e87883706
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      cranelift/codegen/src/machinst/lower.rs
  2. 13
      cranelift/codegen/src/machinst/vcode.rs

3
cranelift/codegen/src/machinst/lower.rs

@ -917,12 +917,11 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
}
fn finish_ir_inst(&mut self, loc: RelSourceLoc) {
self.vcode.set_srcloc(loc);
// The VCodeBuilder builds in reverse order (and reverses at
// the end), but `ir_insts` is in forward order, so reverse
// it.
for inst in self.ir_insts.drain(..).rev() {
self.vcode.push(inst);
self.vcode.push(inst, loc);
}
}

13
cranelift/codegen/src/machinst/vcode.rs

@ -248,9 +248,6 @@ pub struct VCodeBuilder<I: VCodeInst> {
/// the concatenated branch_block_arg_range list.
branch_block_arg_succ_start: usize,
/// Current source location.
cur_srcloc: RelSourceLoc,
/// Debug-value label in-progress map, keyed by label. For each
/// label, we keep disjoint ranges mapping to vregs. We'll flatten
/// this into (vreg, range, label) tuples when done.
@ -285,7 +282,6 @@ impl<I: VCodeInst> VCodeBuilder<I> {
succ_start: 0,
block_params_start: 0,
branch_block_arg_succ_start: 0,
cur_srcloc: Default::default(),
debug_info: FxHashMap::default(),
}
}
@ -370,9 +366,9 @@ impl<I: VCodeInst> VCodeBuilder<I> {
/// Push an instruction for the current BB and current IR inst
/// within the BB.
pub fn push(&mut self, insn: I) {
pub fn push(&mut self, insn: I, loc: RelSourceLoc) {
self.vcode.insts.push(insn);
self.vcode.srclocs.push(self.cur_srcloc);
self.vcode.srclocs.push(loc);
}
/// Add a successor block with branch args.
@ -381,11 +377,6 @@ impl<I: VCodeInst> VCodeBuilder<I> {
self.add_branch_args_for_succ(args);
}
/// Set the current source location.
pub fn set_srcloc(&mut self, srcloc: RelSourceLoc) {
self.cur_srcloc = srcloc;
}
/// Add a debug value label to a register.
pub fn add_value_label(&mut self, reg: Reg, label: ValueLabel) {
// We'll fix up labels in reverse(). Because we're generating

Loading…
Cancel
Save