Improved formatting

This commit is contained in:
Syrus Akbary
2018-10-15 03:03:00 +02:00
parent 78cf7800e5
commit 8d790d78f9
4 changed files with 59 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
use cranelift_codegen::binemit;
use cranelift_codegen::ir::{self, TrapCode, SourceLoc, ExternalName};
use cranelift_codegen::ir::{self, ExternalName, SourceLoc, TrapCode};
#[derive(Debug)]
pub struct Relocation {
@@ -18,7 +18,6 @@ pub enum RelocationType {
Intrinsic(String),
}
/// Implementation of a relocation sink that just saves all the information for later
pub struct RelocSink {
// func: &'func ir::Function,
@@ -48,35 +47,28 @@ impl binemit::RelocSink for RelocSink {
namespace: 0,
index,
} => {
self.func_relocs.push(
(
Relocation {
reloc,
offset,
addend,
},
RelocationType::Normal(index as _),
)
);
},
ExternalName::TestCase {
length,
ascii,
} => {
self.func_relocs.push((
Relocation {
reloc,
offset,
addend,
},
RelocationType::Normal(index as _),
));
}
ExternalName::TestCase { length, ascii } => {
let (slice, _) = ascii.split_at(length as usize);
let name = String::from_utf8(slice.to_vec()).unwrap();
self.func_relocs.push(
(
Relocation {
reloc,
offset,
addend,
},
RelocationType::Intrinsic(name),
)
);
},
self.func_relocs.push((
Relocation {
reloc,
offset,
addend,
},
RelocationType::Intrinsic(name),
));
}
_ => {
unimplemented!();
}
@@ -100,8 +92,6 @@ impl RelocSink {
}
}
pub struct TrapData {
pub offset: usize,
pub code: TrapCode,