Move encoding-related information into an EncInfo struct.

The tables returned by recipe_names() and recipe_constraints() are now
collected into an EncInfo struct that is available from
TargetIsa::encoding_info(). This is equivalent to the register bank
tables available fro TargetIsa::register_info().

This cleans of the TargetIsa interface and makes it easier to add
encoding-related information.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-05 10:07:19 -07:00
parent 72cb6459a9
commit f47c62ba8c
15 changed files with 88 additions and 83 deletions

View File

@@ -9,7 +9,7 @@ use binemit::CodeSink;
use super::super::settings as shared_settings;
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, general_encoding};
use isa::Builder as IsaBuilder;
use isa::{TargetIsa, RegInfo, Encoding, Legalize, RecipeConstraints};
use isa::{TargetIsa, RegInfo, EncInfo, Encoding, Legalize};
use ir;
#[allow(dead_code)]
@@ -55,6 +55,10 @@ impl TargetIsa for Isa {
registers::INFO.clone()
}
fn encoding_info(&self) -> EncInfo {
enc_tables::INFO.clone()
}
fn encode(&self,
dfg: &ir::DataFlowGraph,
inst: &ir::InstructionData)
@@ -72,14 +76,6 @@ impl TargetIsa for Isa {
})
}
fn recipe_names(&self) -> &'static [&'static str] {
&enc_tables::RECIPE_NAMES[..]
}
fn recipe_constraints(&self) -> &'static [RecipeConstraints] {
&enc_tables::RECIPE_CONSTRAINTS
}
fn emit_inst(&self, func: &ir::Function, inst: ir::Inst, sink: &mut CodeSink) {
binemit::emit_inst(func, inst, sink)
}