Add the dyn keyword before trait objects;
This commit is contained in:
@@ -426,7 +426,7 @@ impl DataFlowGraph {
|
||||
}
|
||||
|
||||
/// Returns an object that displays `inst`.
|
||||
pub fn display_inst<'a, I: Into<Option<&'a TargetIsa>>>(
|
||||
pub fn display_inst<'a, I: Into<Option<&'a dyn TargetIsa>>>(
|
||||
&'a self,
|
||||
inst: Inst,
|
||||
isa: I,
|
||||
@@ -909,7 +909,7 @@ impl EbbData {
|
||||
}
|
||||
|
||||
/// Object that can display an instruction.
|
||||
pub struct DisplayInst<'a>(&'a DataFlowGraph, Option<&'a TargetIsa>, Inst);
|
||||
pub struct DisplayInst<'a>(&'a DataFlowGraph, Option<&'a dyn TargetIsa>, Inst);
|
||||
|
||||
impl<'a> fmt::Display for DisplayInst<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
||||
@@ -238,7 +238,7 @@ impl fmt::Display for AnyEntity {
|
||||
|
||||
impl fmt::Debug for AnyEntity {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(self as &fmt::Display).fmt(f)
|
||||
(self as &dyn fmt::Display).fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,10 @@ impl Function {
|
||||
}
|
||||
|
||||
/// Return an object that can display this function with correct ISA-specific annotations.
|
||||
pub fn display<'a, I: Into<Option<&'a TargetIsa>>>(&'a self, isa: I) -> DisplayFunction<'a> {
|
||||
pub fn display<'a, I: Into<Option<&'a dyn TargetIsa>>>(
|
||||
&'a self,
|
||||
isa: I,
|
||||
) -> DisplayFunction<'a> {
|
||||
DisplayFunction(self, isa.into().into())
|
||||
}
|
||||
|
||||
@@ -202,13 +205,13 @@ impl Function {
|
||||
}
|
||||
|
||||
/// Wrapper around `encode` which assigns `inst` the resulting encoding.
|
||||
pub fn update_encoding(&mut self, inst: ir::Inst, isa: &TargetIsa) -> Result<(), Legalize> {
|
||||
pub fn update_encoding(&mut self, inst: ir::Inst, isa: &dyn TargetIsa) -> Result<(), Legalize> {
|
||||
self.encode(inst, isa).map(|e| self.encodings[inst] = e)
|
||||
}
|
||||
|
||||
/// Wrapper around `TargetIsa::encode` for encoding an existing instruction
|
||||
/// in the `Function`.
|
||||
pub fn encode(&self, inst: ir::Inst, isa: &TargetIsa) -> Result<Encoding, Legalize> {
|
||||
pub fn encode(&self, inst: ir::Inst, isa: &dyn TargetIsa) -> Result<Encoding, Legalize> {
|
||||
isa.encode(&self, &self.dfg[inst], self.dfg.ctrl_typevar(inst))
|
||||
}
|
||||
|
||||
@@ -221,7 +224,7 @@ impl Function {
|
||||
/// Additional annotations for function display.
|
||||
pub struct DisplayFunctionAnnotations<'a> {
|
||||
/// Enable ISA annotations.
|
||||
pub isa: Option<&'a TargetIsa>,
|
||||
pub isa: Option<&'a dyn TargetIsa>,
|
||||
|
||||
/// Enable value labels annotations.
|
||||
pub value_ranges: Option<&'a ValueLabelsRanges>,
|
||||
@@ -237,8 +240,8 @@ impl<'a> DisplayFunctionAnnotations<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<Option<&'a TargetIsa>> for DisplayFunctionAnnotations<'a> {
|
||||
fn from(isa: Option<&'a TargetIsa>) -> DisplayFunctionAnnotations {
|
||||
impl<'a> From<Option<&'a dyn TargetIsa>> for DisplayFunctionAnnotations<'a> {
|
||||
fn from(isa: Option<&'a dyn TargetIsa>) -> DisplayFunctionAnnotations {
|
||||
DisplayFunctionAnnotations {
|
||||
isa,
|
||||
value_ranges: None,
|
||||
|
||||
@@ -76,7 +76,7 @@ impl GlobalValueData {
|
||||
}
|
||||
|
||||
/// Return the type of this global.
|
||||
pub fn global_type(&self, isa: &TargetIsa) -> Type {
|
||||
pub fn global_type(&self, isa: &dyn TargetIsa) -> Type {
|
||||
match *self {
|
||||
GlobalValueData::VMContext { .. } | GlobalValueData::Symbol { .. } => {
|
||||
isa.pointer_type()
|
||||
|
||||
@@ -107,7 +107,7 @@ pub fn get_libcall_funcref(
|
||||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
inst: Inst,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
find_funcref(libcall, func).unwrap_or_else(|| make_funcref_for_inst(libcall, func, inst, isa))
|
||||
}
|
||||
@@ -119,7 +119,7 @@ pub fn get_probestack_funcref(
|
||||
func: &mut Function,
|
||||
reg_type: Type,
|
||||
arg_reg: RegUnit,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
find_funcref(LibCall::Probestack, func)
|
||||
.unwrap_or_else(|| make_funcref_for_probestack(func, reg_type, arg_reg, isa))
|
||||
@@ -147,7 +147,7 @@ fn make_funcref_for_probestack(
|
||||
func: &mut Function,
|
||||
reg_type: Type,
|
||||
arg_reg: RegUnit,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let mut sig = Signature::new(CallConv::Probestack);
|
||||
let rax = AbiParam::special_reg(reg_type, ArgumentPurpose::Normal, arg_reg);
|
||||
@@ -163,7 +163,7 @@ fn make_funcref_for_inst(
|
||||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
inst: Inst,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let mut sig = Signature::new(isa.default_call_conv());
|
||||
for &v in func.dfg.inst_args(inst) {
|
||||
@@ -177,7 +177,12 @@ fn make_funcref_for_inst(
|
||||
}
|
||||
|
||||
/// Create a funcref for `libcall`.
|
||||
fn make_funcref(libcall: LibCall, func: &mut Function, sig: Signature, isa: &TargetIsa) -> FuncRef {
|
||||
fn make_funcref(
|
||||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
sig: Signature,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let sigref = func.import_signature(sig);
|
||||
|
||||
func.import_function(ExtFuncData {
|
||||
|
||||
Reference in New Issue
Block a user