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:
@@ -17,7 +17,7 @@ mod inst;
|
||||
mod lower;
|
||||
mod lower_inst;
|
||||
|
||||
use inst::create_reg_universe;
|
||||
use inst::{create_reg_universe, EmitInfo};
|
||||
|
||||
/// An ARM32 backend.
|
||||
pub struct Arm32Backend {
|
||||
@@ -44,8 +44,9 @@ impl Arm32Backend {
|
||||
) -> CodegenResult<VCode<inst::Inst>> {
|
||||
// This performs lowering to VCode, register-allocates the code, computes
|
||||
// block layout and finalizes branches. The result is ready for binary emission.
|
||||
let emit_info = EmitInfo::new(flags.clone());
|
||||
let abi = Box::new(abi::Arm32ABICallee::new(func, flags)?);
|
||||
compile::compile::<Arm32Backend>(func, self, abi)
|
||||
compile::compile::<Arm32Backend>(func, self, abi, emit_info)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user