iree/vm/bytecode_dispatch.c
// Remaps registers from a source set to a destination set within the same stack
// frame. This is a way to perform a conditional multi-mov sequence instead of
// requiring the additional bytecode representation of the conditional movs.
//
// This assumes that the remapping list is properly ordered such that there are
// no swapping hazards (such as 0->1,1->0). The register allocator in the
// compiler should ensure this is the case when it can occur.
Remaps registers from a source set to a destination set within the same stack
frame. This is a way to perform a conditional multi-mov sequence instead of
requiring the additional bytecode representation of the conditional movs.

This assumes that the remapping list is properly ordered such that there are
no swapping hazards (such as 0->1,1->0). The register allocator in the
compiler should ensure this is the case when it can occur.
Remaps registers from a source set to a destination set within the same stack frame . This is a way to perform a conditional multi - mov sequence instead of requiring the additional bytecode representation of the conditional movs . This assumes that the remapping list is properly ordered such that there are no swapping hazards ( such as 0 - > 1 1 - > 0 ) . The register allocator in the compiler should ensure this is the case when it can occur .
static void iree_vm_bytecode_dispatch_remap_branch_registers(
    const iree_vm_registers_t regs,
    const iree_vm_register_remap_list_t* remap_list) {
  for (int i = 0; i < remap_list->size; ++i) {
    uint16_t src_reg = remap_list->pairs[i].src_reg;
    uint16_t dst_reg = remap_list->pairs[i].dst_reg;
    if (src_reg & IREE_REF_REGISTER_TYPE_BIT) {
      iree_vm_ref_retain_or_move(src_reg & IREE_REF_REGISTER_MOVE_BIT,
                                 &regs.ref[src_reg & regs.ref_mask],
                                 &regs.ref[dst_reg & regs.ref_mask]);
    } else {
      regs.i32[dst_reg & regs.i32_mask] = regs.i32[src_reg & regs.i32_mask];
    }
  }
}
static void iree_vm_bytecode_dispatch_remap_branch_registers ( const iree_vm_registers_t regs , const iree_vm_register_remap_list_t * remap_list ) { for ( int i = 0 ; i < remap_list -> size ; ++ i ) { uint16_t src_reg = remap_list -> pairs [ i ] . src_reg ; uint16_t dst_reg = remap_list -> pairs [ i ] . dst_reg ; if ( src_reg & IREE_REF_REGISTER_TYPE_BIT ) { iree_vm_ref_retain_or_move ( src_reg & IREE_REF_REGISTER_MOVE_BIT , & regs . ref [ src_reg & regs . ref_mask ] , & regs . ref [ dst_reg & regs . ref_mask ] ) ; } else { regs . i32 [ dst_reg & regs . i32_mask ] = regs . i32 [ src_reg & regs . i32_mask ] ; } } }
Remaps registers from a source set to a destination set within the same stack
frame.
Remaps registers from a source set to a destination set within the same stack frame .
// TODO(benvanik): change encoding to avoid this branching. // Could write two arrays: one for prims and one for refs.