TargetIsa implies a Display of shared and isa-specific flags
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
21f0fc39ad
commit
099b959d57
@@ -13,6 +13,7 @@ use isa::Builder as IsaBuilder;
|
|||||||
use isa::{TargetIsa, RegInfo, RegClass, EncInfo};
|
use isa::{TargetIsa, RegInfo, RegClass, EncInfo};
|
||||||
use ir;
|
use ir;
|
||||||
use regalloc;
|
use regalloc;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Isa {
|
struct Isa {
|
||||||
@@ -108,3 +109,9 @@ impl TargetIsa for Isa {
|
|||||||
emit_function(func, binemit::emit_inst, sink)
|
emit_function(func, binemit::emit_inst, sink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Isa {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}\n{}", self.shared_flags, self.isa_flags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use isa::Builder as IsaBuilder;
|
|||||||
use isa::{TargetIsa, RegInfo, RegClass, EncInfo};
|
use isa::{TargetIsa, RegInfo, RegClass, EncInfo};
|
||||||
use ir;
|
use ir;
|
||||||
use regalloc;
|
use regalloc;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Isa {
|
struct Isa {
|
||||||
@@ -101,3 +102,9 @@ impl TargetIsa for Isa {
|
|||||||
emit_function(func, binemit::emit_inst, sink)
|
emit_function(func, binemit::emit_inst, sink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Isa {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}\n{}", self.shared_flags, self.isa_flags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use ir;
|
|||||||
use regalloc;
|
use regalloc;
|
||||||
use result;
|
use result;
|
||||||
use timing;
|
use timing;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@@ -116,3 +117,9 @@ impl TargetIsa for Isa {
|
|||||||
abi::prologue_epilogue(func, self)
|
abi::prologue_epilogue(func, self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Isa {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}\n{}", self.shared_flags, self.isa_flags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ use regalloc;
|
|||||||
use result;
|
use result;
|
||||||
use timing;
|
use timing;
|
||||||
use isa::enc_tables::Encodings;
|
use isa::enc_tables::Encodings;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[cfg(build_riscv)]
|
#[cfg(build_riscv)]
|
||||||
pub mod riscv;
|
pub mod riscv;
|
||||||
@@ -146,8 +147,9 @@ pub type Legalize = fn(ir::Inst,
|
|||||||
&mut flowgraph::ControlFlowGraph)
|
&mut flowgraph::ControlFlowGraph)
|
||||||
-> bool;
|
-> bool;
|
||||||
|
|
||||||
/// Methods that are specialized to a target ISA.
|
/// Methods that are specialized to a target ISA. Implies a Display trait that shows the
|
||||||
pub trait TargetIsa {
|
/// shared flags, as well as any isa-specific flags.
|
||||||
|
pub trait TargetIsa: fmt::Display {
|
||||||
/// Get the name of this ISA.
|
/// Get the name of this ISA.
|
||||||
fn name(&self) -> &'static str;
|
fn name(&self) -> &'static str;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use isa::Builder as IsaBuilder;
|
|||||||
use isa::{TargetIsa, RegInfo, RegClass, EncInfo};
|
use isa::{TargetIsa, RegInfo, RegClass, EncInfo};
|
||||||
use ir;
|
use ir;
|
||||||
use regalloc;
|
use regalloc;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Isa {
|
struct Isa {
|
||||||
@@ -252,3 +253,9 @@ mod tests {
|
|||||||
assert_eq!(encstr(&*isa, isa.encode(&dfg, &mul32, types::I32)), "R#10c");
|
assert_eq!(encstr(&*isa, isa.encode(&dfg, &mul32, types::I32)), "R#10c");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Isa {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}\n{}", self.shared_flags, self.isa_flags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user