Fixed trivially_copy_pass_by_ref warnings
This commit is contained in:
@@ -123,11 +123,11 @@ impl ControlFlowGraph {
|
|||||||
for inst in func.layout.ebb_insts(ebb) {
|
for inst in func.layout.ebb_insts(ebb) {
|
||||||
match func.dfg.analyze_branch(inst) {
|
match func.dfg.analyze_branch(inst) {
|
||||||
BranchInfo::SingleDest(dest, _) => {
|
BranchInfo::SingleDest(dest, _) => {
|
||||||
self.add_edge(BasicBlock::new(ebb, inst), dest);
|
self.add_edge(ebb, inst, dest);
|
||||||
}
|
}
|
||||||
BranchInfo::Table(jt) => {
|
BranchInfo::Table(jt) => {
|
||||||
for (_, dest) in func.jump_tables[jt].entries() {
|
for (_, dest) in func.jump_tables[jt].entries() {
|
||||||
self.add_edge(BasicBlock::new(ebb, inst), dest);
|
self.add_edge(ebb, inst, dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BranchInfo::NotABranch => {}
|
BranchInfo::NotABranch => {}
|
||||||
@@ -160,13 +160,13 @@ impl ControlFlowGraph {
|
|||||||
self.compute_ebb(func, ebb);
|
self.compute_ebb(func, ebb);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_edge(&mut self, from: BasicBlock, to: Ebb) {
|
fn add_edge(&mut self, from: Ebb, from_inst: Inst, to: Ebb) {
|
||||||
self.data[from.ebb]
|
self.data[from]
|
||||||
.successors
|
.successors
|
||||||
.insert(to, &mut self.succ_forest, &());
|
.insert(to, &mut self.succ_forest, &());
|
||||||
self.data[to]
|
self.data[to]
|
||||||
.predecessors
|
.predecessors
|
||||||
.insert(from.inst, from.ebb, &mut self.pred_forest, &());
|
.insert(from_inst, from, &mut self.pred_forest, &());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get an iterator over the CFG predecessors to `ebb`.
|
/// Get an iterator over the CFG predecessors to `ebb`.
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ impl ValueTypeSet {
|
|||||||
/// Is `scalar` part of the base type set?
|
/// Is `scalar` part of the base type set?
|
||||||
///
|
///
|
||||||
/// Note that the base type set does not have to be included in the type set proper.
|
/// Note that the base type set does not have to be included in the type set proper.
|
||||||
fn is_base_type(&self, scalar: Type) -> bool {
|
fn is_base_type(self, scalar: Type) -> bool {
|
||||||
let l2b = scalar.log2_lane_bits();
|
let l2b = scalar.log2_lane_bits();
|
||||||
if scalar.is_int() {
|
if scalar.is_int() {
|
||||||
self.ints.contains(l2b)
|
self.ints.contains(l2b)
|
||||||
@@ -461,7 +461,7 @@ impl ValueTypeSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Does `typ` belong to this set?
|
/// Does `typ` belong to this set?
|
||||||
pub fn contains(&self, typ: Type) -> bool {
|
pub fn contains(self, typ: Type) -> bool {
|
||||||
let l2l = typ.log2_lane_count();
|
let l2l = typ.log2_lane_count();
|
||||||
self.lanes.contains(l2l) && self.is_base_type(typ.lane_type())
|
self.lanes.contains(l2l) && self.is_base_type(typ.lane_type())
|
||||||
}
|
}
|
||||||
@@ -469,7 +469,7 @@ impl ValueTypeSet {
|
|||||||
/// Get an example member of this type set.
|
/// Get an example member of this type set.
|
||||||
///
|
///
|
||||||
/// This is used for error messages to avoid suggesting invalid types.
|
/// This is used for error messages to avoid suggesting invalid types.
|
||||||
pub fn example(&self) -> Type {
|
pub fn example(self) -> Type {
|
||||||
let t = if self.ints.max().unwrap_or(0) > 5 {
|
let t = if self.ints.max().unwrap_or(0) > 5 {
|
||||||
types::I32
|
types::I32
|
||||||
} else if self.floats.max().unwrap_or(0) > 5 {
|
} else if self.floats.max().unwrap_or(0) > 5 {
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ impl Default for ValueLoc {
|
|||||||
|
|
||||||
impl ValueLoc {
|
impl ValueLoc {
|
||||||
/// Is this an assigned location? (That is, not `Unassigned`).
|
/// Is this an assigned location? (That is, not `Unassigned`).
|
||||||
pub fn is_assigned(&self) -> bool {
|
pub fn is_assigned(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
ValueLoc::Unassigned => false,
|
ValueLoc::Unassigned => false,
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
@@ -111,24 +111,24 @@ impl Default for ArgumentLoc {
|
|||||||
|
|
||||||
impl ArgumentLoc {
|
impl ArgumentLoc {
|
||||||
/// Is this an assigned location? (That is, not `Unassigned`).
|
/// Is this an assigned location? (That is, not `Unassigned`).
|
||||||
pub fn is_assigned(&self) -> bool {
|
pub fn is_assigned(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
ArgumentLoc::Unassigned => false,
|
ArgumentLoc::Unassigned => false,
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this a register location?
|
/// Is this a register location?
|
||||||
pub fn is_reg(&self) -> bool {
|
pub fn is_reg(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
ArgumentLoc::Reg(_) => true,
|
ArgumentLoc::Reg(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this a stack location?
|
/// Is this a stack location?
|
||||||
pub fn is_stack(&self) -> bool {
|
pub fn is_stack(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
ArgumentLoc::Stack(_) => true,
|
ArgumentLoc::Stack(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ impl Builder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extract contents of builder once everything is configured.
|
/// Extract contents of builder once everything is configured.
|
||||||
pub fn state_for(&self, name: &str) -> &[u8] {
|
pub fn state_for(self, name: &str) -> Box<[u8]> {
|
||||||
assert_eq!(name, self.template.name);
|
assert_eq!(name, self.template.name);
|
||||||
&self.bytes[..]
|
self.bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the value of a single bit.
|
/// Set the value of a single bit.
|
||||||
@@ -301,8 +301,8 @@ pub mod detail {
|
|||||||
impl Detail {
|
impl Detail {
|
||||||
/// Check if a detail is a Detail::Preset. Useful because the Descriptor
|
/// Check if a detail is a Detail::Preset. Useful because the Descriptor
|
||||||
/// offset field has a different meaning when the detail is a preset.
|
/// offset field has a different meaning when the detail is a preset.
|
||||||
pub fn is_preset(&self) -> bool {
|
pub fn is_preset(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
Detail::Preset => true,
|
Detail::Preset => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user