Generate binemit::emit_inst() functions.

Use the meta language encoding recipes to generate an emit_inst()
function for each ISA. The generated calls into recipe_*() functions
that must be implemented by hand.

Implement recipe_*() functions for the RISC-V recipes.

Add the TargetIsa::emit_inst() entry point which emits an instruction to
a CodeSink trait object.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-27 16:11:54 -07:00
parent bbbae4dc47
commit ca2b1c79d7
13 changed files with 183 additions and 9 deletions

View File

@@ -2,14 +2,16 @@
pub mod settings;
mod abi;
mod binemit;
mod enc_tables;
mod registers;
use super::super::settings as shared_settings;
use binemit::CodeSink;
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 ir::{InstructionData, DataFlowGraph, Signature};
use ir::{Function, Inst, InstructionData, DataFlowGraph, Signature};
#[allow(dead_code)]
struct Isa {
@@ -80,6 +82,10 @@ impl TargetIsa for Isa {
// We can pass in `self.isa_flags` too, if we need it.
abi::legalize_signature(sig, &self.shared_flags)
}
fn emit_inst(&self, func: &Function, inst: Inst, sink: &mut CodeSink) {
binemit::emit_inst(func, inst, sink)
}
}
#[cfg(test)]