Add an isa::lookup() function which serves as a target registry for creating Box<TargetIsa> trait objects. An isa::Builder makes it possible to confugure the trait object before it is created.
38 lines
871 B
Rust
38 lines
871 B
Rust
//! RISC-V Instruction Set Architecture.
|
|
|
|
pub mod settings;
|
|
|
|
use super::super::settings as shared_settings;
|
|
use super::Builder as IsaBuilder;
|
|
use super::{TargetIsa, Encoding};
|
|
use ir::dfg::DataFlowGraph;
|
|
use ir::entities::Inst;
|
|
|
|
#[allow(dead_code)]
|
|
struct Isa {
|
|
shared_flags: shared_settings::Flags,
|
|
isa_flags: settings::Flags,
|
|
}
|
|
|
|
pub fn isa_builder() -> IsaBuilder {
|
|
IsaBuilder {
|
|
setup: settings::builder(),
|
|
constructor: isa_constructor,
|
|
}
|
|
}
|
|
|
|
fn isa_constructor(shared_flags: shared_settings::Flags,
|
|
builder: shared_settings::Builder)
|
|
-> Box<TargetIsa> {
|
|
Box::new(Isa {
|
|
shared_flags: shared_flags,
|
|
isa_flags: settings::Flags::new(builder),
|
|
})
|
|
}
|
|
|
|
impl TargetIsa for Isa {
|
|
fn encode(&self, _: &DataFlowGraph, _: &Inst) -> Option<Encoding> {
|
|
unimplemented!()
|
|
}
|
|
}
|