Factor out common ways to call encode from a dfg or func.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Data flow graph tracking Instructions, Values, and EBBs.
|
||||
|
||||
use entity::{PrimaryMap, EntityMap};
|
||||
use isa::TargetIsa;
|
||||
use isa::{TargetIsa, Encoding, Legalize};
|
||||
use ir;
|
||||
use ir::builder::ReplaceBuilder;
|
||||
use ir::extfunc::ExtFuncData;
|
||||
@@ -645,6 +645,12 @@ impl DataFlowGraph {
|
||||
self.value_type(self.first_result(inst))
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper around `TargetIsa::encode` for encoding an existing instruction
|
||||
/// in the `DataFlowGraph`.
|
||||
pub fn encode(&self, inst: Inst, isa: &TargetIsa) -> Result<Encoding, Legalize> {
|
||||
isa.encode(&self, &self[inst], self.ctrl_typevar(inst))
|
||||
}
|
||||
}
|
||||
|
||||
/// Allow immutable access to instructions via indexing.
|
||||
|
||||
Reference in New Issue
Block a user