machinst: allow passing constant information to the instruction emitter;
A new associated type Info is added to MachInstEmit, which is the immutable counterpart to State. It can't easily be constructed from an ABICallee, since it would require adding an associated type to the latter, and making so leaks the associated type in a lot of places in the code base and makes the code harder to read. Instead, the EmitInfo state can simply be passed to the `Vcode::emit` function directly.
This commit is contained in:
@@ -315,9 +315,10 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
|
||||
pub fn new(
|
||||
f: &'func Function,
|
||||
abi: Box<dyn ABICallee<I = I>>,
|
||||
emit_info: I::Info,
|
||||
block_order: BlockLoweringOrder,
|
||||
) -> CodegenResult<Lower<'func, I>> {
|
||||
let mut vcode = VCodeBuilder::new(abi, block_order);
|
||||
let mut vcode = VCodeBuilder::new(abi, emit_info, block_order);
|
||||
|
||||
let mut next_vreg: u32 = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user