Add the dyn keyword before trait objects;

This commit is contained in:
Benjamin Bouvier
2019-06-06 10:11:41 +02:00
parent eee824b6bd
commit d7d48d5cc6
77 changed files with 274 additions and 247 deletions

View File

@@ -48,7 +48,7 @@ impl Affinity {
}
/// Create an affinity that matches an ABI argument for `isa`.
pub fn abi(arg: &AbiParam, isa: &TargetIsa) -> Self {
pub fn abi(arg: &AbiParam, isa: &dyn TargetIsa) -> Self {
match arg.location {
ArgumentLoc::Unassigned => Affinity::Unassigned,
ArgumentLoc::Reg(_) => Affinity::Reg(isa.regclass_for_abi_type(arg.value_type).into()),

View File

@@ -66,7 +66,7 @@ pub struct Coalescing {
/// One-shot context created once per invocation.
struct Context<'a> {
isa: &'a TargetIsa,
isa: &'a dyn TargetIsa,
encinfo: EncInfo,
func: &'a mut Function,
@@ -108,7 +108,7 @@ impl Coalescing {
/// Convert `func` to Conventional SSA form and build virtual registers in the process.
pub fn conventional_ssa(
&mut self,
isa: &TargetIsa,
isa: &dyn TargetIsa,
func: &mut Function,
cfg: &ControlFlowGraph,
domtree: &DominatorTree,

View File

@@ -118,7 +118,7 @@ impl Coloring {
/// Run the coloring algorithm over `func`.
pub fn run(
&mut self,
isa: &TargetIsa,
isa: &dyn TargetIsa,
func: &mut Function,
domtree: &DominatorTree,
liveness: &mut Liveness,

View File

@@ -75,7 +75,7 @@ impl Context {
/// location that is consistent with instruction encoding constraints.
pub fn run(
&mut self,
isa: &TargetIsa,
isa: &dyn TargetIsa,
func: &mut Function,
cfg: &ControlFlowGraph,
domtree: &mut DominatorTree,

View File

@@ -195,7 +195,7 @@ type LiveRangeSet = SparseMap<Value, LiveRange>;
fn get_or_create<'a>(
lrset: &'a mut LiveRangeSet,
value: Value,
isa: &TargetIsa,
isa: &dyn TargetIsa,
func: &Function,
encinfo: &EncInfo,
) -> &'a mut LiveRange {
@@ -389,7 +389,7 @@ impl Liveness {
/// Compute the live ranges of all SSA values used in `func`.
/// This clears out any existing analysis stored in this data structure.
pub fn compute(&mut self, isa: &TargetIsa, func: &mut Function, cfg: &ControlFlowGraph) {
pub fn compute(&mut self, isa: &dyn TargetIsa, func: &mut Function, cfg: &ControlFlowGraph) {
let _tt = timing::ra_liveness();
self.ranges.clear();

View File

@@ -281,7 +281,7 @@ mod tests {
use target_lexicon::triple;
// Make an arm32 `TargetIsa`, if possible.
fn arm32() -> Option<Box<TargetIsa>> {
fn arm32() -> Option<Box<dyn TargetIsa>> {
use crate::isa;
use crate::settings;
@@ -294,7 +294,7 @@ mod tests {
}
// Get a register class by name.
fn rc_by_name(isa: &TargetIsa, name: &str) -> RegClass {
fn rc_by_name(isa: &dyn TargetIsa, name: &str) -> RegClass {
isa.register_info()
.classes
.iter()

View File

@@ -65,7 +65,7 @@ impl Reload {
/// Run the reload algorithm over `func`.
pub fn run(
&mut self,
isa: &TargetIsa,
isa: &dyn TargetIsa,
func: &mut Function,
domtree: &DominatorTree,
liveness: &mut Liveness,
@@ -466,7 +466,7 @@ fn handle_abi_args(
abi_types: &[AbiParam],
var_args: &[Value],
offset: usize,
isa: &TargetIsa,
isa: &dyn TargetIsa,
liveness: &Liveness,
) {
debug_assert_eq!(abi_types.len(), var_args.len());

View File

@@ -406,7 +406,7 @@ impl fmt::Display for Move {
impl fmt::Debug for Move {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let as_display: &fmt::Display = self;
let as_display: &dyn fmt::Display = self;
as_display.fmt(f)
}
}
@@ -1139,7 +1139,7 @@ mod tests {
use target_lexicon::triple;
// Make an arm32 `TargetIsa`, if possible.
fn arm32() -> Option<Box<TargetIsa>> {
fn arm32() -> Option<Box<dyn TargetIsa>> {
use crate::isa;
use crate::settings;

View File

@@ -91,7 +91,7 @@ impl Spilling {
/// Run the spilling algorithm over `func`.
pub fn run(
&mut self,
isa: &TargetIsa,
isa: &dyn TargetIsa,
func: &mut Function,
domtree: &DominatorTree,
liveness: &mut Liveness,