Remove reloc_external from CodeSink

And introduce MachBufferFinalized::relocs() in the place.
This commit is contained in:
bjorn3
2022-01-11 16:54:27 +01:00
parent 63e2360346
commit a48a60f958
6 changed files with 38 additions and 61 deletions

View File

@@ -18,7 +18,7 @@ use crate::isa::TargetIsa;
use crate::legalizer::simple_legalize;
use crate::licm::do_licm;
use crate::loop_analysis::LoopAnalysis;
use crate::machinst::{MachCompileResult, MachStackMap, MachTrap};
use crate::machinst::{MachCompileResult, MachReloc, MachStackMap, MachTrap};
use crate::nan_canonicalization::do_nan_canonicalization;
use crate::remove_constant_phis::do_remove_constant_phis;
use crate::result::CodegenResult;
@@ -194,13 +194,23 @@ impl Context {
stack_maps: &mut dyn StackMapSink,
) -> CodeInfo {
let _tt = timing::binemit();
let mut sink = MemoryCodeSink::new(mem, relocs);
let mut sink = MemoryCodeSink::new(mem);
let result = self
.mach_compile_result
.as_ref()
.expect("only using mach backend now");
result.buffer.emit(&mut sink);
let info = sink.info();
for &MachReloc {
offset,
srcloc,
kind,
ref name,
addend,
} in result.buffer.relocs()
{
relocs.reloc_external(offset, srcloc, kind, name, addend);
}
for &MachTrap {
offset,
srcloc,