From 6fd95c1158d2babe326694201766fa84d6dbffcd Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 11 May 2017 17:58:11 -0700 Subject: [PATCH] Implement reloc_names() for all targets. This gets rid of the last TargetIsa method with a default implementation. --- lib/cretonne/src/isa/arm32/binemit.rs | 2 ++ lib/cretonne/src/isa/arm32/mod.rs | 4 ++++ lib/cretonne/src/isa/arm64/binemit.rs | 2 ++ lib/cretonne/src/isa/arm64/mod.rs | 4 ++++ lib/cretonne/src/isa/mod.rs | 4 +--- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/cretonne/src/isa/arm32/binemit.rs b/lib/cretonne/src/isa/arm32/binemit.rs index dcc76331a2..cf12bdbde2 100644 --- a/lib/cretonne/src/isa/arm32/binemit.rs +++ b/lib/cretonne/src/isa/arm32/binemit.rs @@ -4,3 +4,5 @@ use binemit::{CodeSink, bad_encoding}; use ir::{Function, Inst}; include!(concat!(env!("OUT_DIR"), "/binemit-arm32.rs")); + +pub static RELOC_NAMES: [&'static str; 1] = ["Call"]; diff --git a/lib/cretonne/src/isa/arm32/mod.rs b/lib/cretonne/src/isa/arm32/mod.rs index e3128fdc0e..5657c7523b 100644 --- a/lib/cretonne/src/isa/arm32/mod.rs +++ b/lib/cretonne/src/isa/arm32/mod.rs @@ -94,4 +94,8 @@ impl TargetIsa for Isa { fn emit_inst(&self, func: &ir::Function, inst: ir::Inst, sink: &mut CodeSink) { binemit::emit_inst(func, inst, sink) } + + fn reloc_names(&self) -> &'static [&'static str] { + &binemit::RELOC_NAMES + } } diff --git a/lib/cretonne/src/isa/arm64/binemit.rs b/lib/cretonne/src/isa/arm64/binemit.rs index 13885307d4..120115c0d8 100644 --- a/lib/cretonne/src/isa/arm64/binemit.rs +++ b/lib/cretonne/src/isa/arm64/binemit.rs @@ -4,3 +4,5 @@ use binemit::{CodeSink, bad_encoding}; use ir::{Function, Inst}; include!(concat!(env!("OUT_DIR"), "/binemit-arm64.rs")); + +pub static RELOC_NAMES: [&'static str; 1] = ["Call"]; diff --git a/lib/cretonne/src/isa/arm64/mod.rs b/lib/cretonne/src/isa/arm64/mod.rs index f6fd70fb7a..fe81ea8c09 100644 --- a/lib/cretonne/src/isa/arm64/mod.rs +++ b/lib/cretonne/src/isa/arm64/mod.rs @@ -87,4 +87,8 @@ impl TargetIsa for Isa { fn emit_inst(&self, func: &ir::Function, inst: ir::Inst, sink: &mut CodeSink) { binemit::emit_inst(func, inst, sink) } + + fn reloc_names(&self) -> &'static [&'static str] { + &binemit::RELOC_NAMES + } } diff --git a/lib/cretonne/src/isa/mod.rs b/lib/cretonne/src/isa/mod.rs index 34d3e21ef6..edc0034217 100644 --- a/lib/cretonne/src/isa/mod.rs +++ b/lib/cretonne/src/isa/mod.rs @@ -210,7 +210,5 @@ pub trait TargetIsa { /// /// This array can be indexed by the contents of `binemit::Reloc` objects passed to a /// `CodeSink`. - fn reloc_names(&self) -> &'static [&'static str] { - unimplemented!() - } + fn reloc_names(&self) -> &'static [&'static str]; }