Return RegInfo by value from TargetIsa::register_info().
The struct is just a pair of static references, and we don't need the double indirection.
This commit is contained in:
@@ -49,8 +49,8 @@ impl TargetIsa for Isa {
|
||||
&self.shared_flags
|
||||
}
|
||||
|
||||
fn register_info(&self) -> &RegInfo {
|
||||
®isters::INFO
|
||||
fn register_info(&self) -> RegInfo {
|
||||
registers::INFO.clone()
|
||||
}
|
||||
|
||||
fn encode(&self, _: &DataFlowGraph, inst: &InstructionData) -> Result<Encoding, Legalize> {
|
||||
|
||||
@@ -42,8 +42,8 @@ impl TargetIsa for Isa {
|
||||
&self.shared_flags
|
||||
}
|
||||
|
||||
fn register_info(&self) -> &RegInfo {
|
||||
®isters::INFO
|
||||
fn register_info(&self) -> RegInfo {
|
||||
registers::INFO.clone()
|
||||
}
|
||||
|
||||
fn encode(&self, _: &DataFlowGraph, inst: &InstructionData) -> Result<Encoding, Legalize> {
|
||||
|
||||
@@ -49,8 +49,8 @@ impl TargetIsa for Isa {
|
||||
&self.shared_flags
|
||||
}
|
||||
|
||||
fn register_info(&self) -> &RegInfo {
|
||||
®isters::INFO
|
||||
fn register_info(&self) -> RegInfo {
|
||||
registers::INFO.clone()
|
||||
}
|
||||
|
||||
fn encode(&self, _: &DataFlowGraph, inst: &InstructionData) -> Result<Encoding, Legalize> {
|
||||
|
||||
@@ -132,7 +132,7 @@ pub trait TargetIsa {
|
||||
fn flags(&self) -> &settings::Flags;
|
||||
|
||||
/// Get a data structure describing the registers in this ISA.
|
||||
fn register_info(&self) -> &RegInfo;
|
||||
fn register_info(&self) -> RegInfo;
|
||||
|
||||
/// Encode an instruction after determining it is legal.
|
||||
///
|
||||
|
||||
@@ -168,6 +168,7 @@ impl From<RegClass> for RegClassIndex {
|
||||
///
|
||||
/// The `RegUnit` data structure collects all relevant static information about the registers in an
|
||||
/// ISA.
|
||||
#[derive(Clone)]
|
||||
pub struct RegInfo {
|
||||
/// All register banks, ordered by their `first_unit`. The register banks are disjoint, but
|
||||
/// there may be holes of unused register unit numbers between banks due to alignment.
|
||||
|
||||
@@ -49,8 +49,8 @@ impl TargetIsa for Isa {
|
||||
&self.shared_flags
|
||||
}
|
||||
|
||||
fn register_info(&self) -> &RegInfo {
|
||||
®isters::INFO
|
||||
fn register_info(&self) -> RegInfo {
|
||||
registers::INFO.clone()
|
||||
}
|
||||
|
||||
fn encode(&self, _: &DataFlowGraph, inst: &InstructionData) -> Result<Encoding, Legalize> {
|
||||
|
||||
Reference in New Issue
Block a user