Change reloc_ebb to pass a CodeOffset rather than an Ebb index.
This commit is contained in:
@@ -71,8 +71,13 @@ impl binemit::CodeSink for TextSink {
|
||||
self.offset += 8;
|
||||
}
|
||||
|
||||
fn reloc_ebb(&mut self, reloc: binemit::Reloc, ebb: ir::Ebb) {
|
||||
write!(self.text, "{}({}) ", self.rnames[reloc.0 as usize], ebb).unwrap();
|
||||
fn reloc_ebb(&mut self, reloc: binemit::Reloc, ebb_offset: binemit::CodeOffset) {
|
||||
write!(
|
||||
self.text,
|
||||
"{}({}) ",
|
||||
self.rnames[reloc.0 as usize],
|
||||
ebb_offset
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
fn reloc_external(&mut self, reloc: binemit::Reloc, name: &ir::ExternalName) {
|
||||
|
||||
@@ -97,7 +97,7 @@ impl binemit::CodeSink for SizeSink {
|
||||
self.offset += 8;
|
||||
}
|
||||
|
||||
fn reloc_ebb(&mut self, _reloc: binemit::Reloc, _ebb: ir::Ebb) {}
|
||||
fn reloc_ebb(&mut self, _reloc: binemit::Reloc, _ebb_offset: binemit::CodeOffset) {}
|
||||
fn reloc_external(&mut self, _reloc: binemit::Reloc, _name: &ir::ExternalName) {}
|
||||
fn reloc_jt(&mut self, _reloc: binemit::Reloc, _jt: ir::JumpTable) {}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
//! relocations to a `RelocSink` trait object. Relocations are less frequent than the
|
||||
//! `CodeSink::put*` methods, so the performance impact of the virtual callbacks is less severe.
|
||||
|
||||
use ir::{ExternalName, Ebb, JumpTable};
|
||||
use ir::{ExternalName, JumpTable};
|
||||
use super::{CodeSink, CodeOffset, Reloc};
|
||||
use std::ptr::write_unaligned;
|
||||
|
||||
@@ -49,7 +49,7 @@ impl<'a> MemoryCodeSink<'a> {
|
||||
/// A trait for receiving relocations for code that is emitted directly into memory.
|
||||
pub trait RelocSink {
|
||||
/// Add a relocation referencing an EBB at the current offset.
|
||||
fn reloc_ebb(&mut self, CodeOffset, Reloc, Ebb);
|
||||
fn reloc_ebb(&mut self, CodeOffset, Reloc, CodeOffset);
|
||||
|
||||
/// Add a relocation referencing an external symbol at the current offset.
|
||||
fn reloc_external(&mut self, CodeOffset, Reloc, &ExternalName);
|
||||
@@ -91,9 +91,9 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
|
||||
self.offset += 8;
|
||||
}
|
||||
|
||||
fn reloc_ebb(&mut self, rel: Reloc, ebb: Ebb) {
|
||||
fn reloc_ebb(&mut self, rel: Reloc, ebb_offset: CodeOffset) {
|
||||
let ofs = self.offset();
|
||||
self.relocs.reloc_ebb(ofs, rel, ebb);
|
||||
self.relocs.reloc_ebb(ofs, rel, ebb_offset);
|
||||
}
|
||||
|
||||
fn reloc_external(&mut self, rel: Reloc, name: &ExternalName) {
|
||||
|
||||
@@ -9,7 +9,7 @@ mod memorysink;
|
||||
pub use self::relaxation::relax_branches;
|
||||
pub use self::memorysink::{MemoryCodeSink, RelocSink};
|
||||
|
||||
use ir::{ExternalName, Ebb, JumpTable, Function, Inst};
|
||||
use ir::{ExternalName, JumpTable, Function, Inst};
|
||||
use regalloc::RegDiversions;
|
||||
|
||||
/// Offset in bytes from the beginning of the function.
|
||||
@@ -42,7 +42,7 @@ pub trait CodeSink {
|
||||
fn put8(&mut self, u64);
|
||||
|
||||
/// Add a relocation referencing an EBB at the current offset.
|
||||
fn reloc_ebb(&mut self, Reloc, Ebb);
|
||||
fn reloc_ebb(&mut self, Reloc, CodeOffset);
|
||||
|
||||
/// Add a relocation referencing an external symbol at the current offset.
|
||||
fn reloc_external(&mut self, Reloc, &ExternalName);
|
||||
|
||||
Reference in New Issue
Block a user