assembleToInstructions<C> method

Map<int, List<Instruction>> assembleToInstructions<C>(
  1. AssemblerConfig<C> config
)

Assembles the post-register-allocation IR into concrete Instruction lists, one per basic block, keyed by block ID.

Must be called after performRegisterAllocation. All operands in the IR must already be AllocatedSSA or ImmediateSSA at this point.

config provides the user-defined callbacks for synthesised operations (spill/reload/move/swap) and carries the context data forwarded to every InstructionCreator.createInstruction call.

Returns a Map from block ID to the ordered list of Instructions emitted for that block. Blocks are visited in breadth-first order starting from the root, which is the same order used by toString.

Implementation

Map<int, List<Instruction>> assembleToInstructions<C>(
    AssemblerConfig<C> config) {
  if (!inSSAForm) {
    throw StateError(
        'Cannot assemble before converting to SSA form');
  }
  final blockOrder = graph.breadthFirst(root.id!).toList();
  return assembleBlocksToInstructions(_ids, blockOrder, opCreators, config,
      graph: graph);
}