MachInst backend: pass through SourceLoc information.
This change adds SourceLoc information per instruction in a `VCode<Inst>` container, and keeps this information up-to-date across register allocation and branch reordering. The information is initially collected during instruction lowering, eventually collected on the MachSection, and finally provided to the environment that wraps the codegen crate for wasmtime.
This commit is contained in:
@@ -345,6 +345,7 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
|
||||
"lower_branch_group: targets = {:?} branches = {:?}",
|
||||
targets, branches
|
||||
);
|
||||
self.vcode.set_srcloc(self.srcloc(branches[0]));
|
||||
backend.lower_branch_group(
|
||||
&mut self,
|
||||
&branches[..],
|
||||
@@ -361,6 +362,7 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
|
||||
let num_uses = self.num_uses[inst];
|
||||
let side_effect = has_side_effect(self.f, inst);
|
||||
if side_effect || num_uses > 0 {
|
||||
self.vcode.set_srcloc(self.srcloc(inst));
|
||||
backend.lower(&mut self, inst);
|
||||
self.vcode.end_ir_inst();
|
||||
} else {
|
||||
@@ -389,6 +391,7 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
|
||||
"lower_branch_group: targets = {:?} branches = {:?}",
|
||||
targets, branches
|
||||
);
|
||||
self.vcode.set_srcloc(self.srcloc(branches[0]));
|
||||
backend.lower_branch_group(&mut self, &branches[..], &targets[..], fallthrough);
|
||||
self.vcode.end_ir_inst();
|
||||
branches.clear();
|
||||
|
||||
Reference in New Issue
Block a user