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:
@@ -3,7 +3,7 @@
|
||||
//! The `binemit` module contains code for translating Cretonne's intermediate representation into
|
||||
//! binary machine code.
|
||||
|
||||
use ir::{FuncRef, JumpTable};
|
||||
use ir::{FuncRef, JumpTable, Function, Inst};
|
||||
|
||||
/// Relocation kinds depend on the current ISA.
|
||||
pub struct Reloc(u16);
|
||||
@@ -31,3 +31,11 @@ pub trait CodeSink {
|
||||
/// Add a relocation referencing a jump table.
|
||||
fn reloc_jt(&mut self, Reloc, JumpTable);
|
||||
}
|
||||
|
||||
/// Report a bad encoding error.
|
||||
#[inline(never)]
|
||||
pub fn bad_encoding(func: &Function, inst: Inst) -> ! {
|
||||
panic!("Bad encoding {} for {}",
|
||||
func.encodings[inst],
|
||||
func.dfg.display_inst(inst));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user