def adjust_register_layout(aInstruction):
    adjust_dest = False
    dest_layout_multiple = 2
    if aInstruction.name.startswith('VW') or aInstruction.name.startswith(
            'VFW'):
        adjust_dest = True
    elif aInstruction.name.startswith('VQMACC'):
        adjust_dest = True
        dest_layout_multiple = 4

    adjust_source = False
    source_layout_multiple = 2
    if '.W' in aInstruction.name:
        adjust_source = True
    elif aInstruction.name.startswith(
            'VSEXT.VF') or aInstruction.name.startswith('VZEXT.VF'):
        adjust_source = True
        layout_divisor = int(aInstruction.name[-1])
        source_layout_multiple = 1 / layout_divisor

    operand_adjustor = VectorOperandAdjustor(aInstruction)
    if adjust_dest:
        operand_adjustor.adjust_dest_layout(dest_layout_multiple)
        operand_adjustor.set_vs1_differ_vd()

    if adjust_source:
        operand_adjustor.adjust_source_layout(source_layout_multiple)

    if adjust_dest != adjust_source:
        operand_adjustor.set_vs2_differ_vd()
def adjust_vd_vs2_vs1(aInstruction):
    operand_adjustor = VectorOperandAdjustor(aInstruction)
    operand_adjustor.set_vd()
    operand_adjustor.set_vs2()
    operand_adjustor.set_vs1()

    if aInstruction.name == 'VCOMPRESS.VM':
        operand_adjustor.set_vs2_differ_vd()
        operand_adjustor.set_vs1_differ_vd()

    return True
def adjust_vd_vs2_vs1_vm(aInstruction):
    operand_adjustor = VectorOperandAdjustor(aInstruction)
    operand_adjustor.set_vd()
    operand_adjustor.set_vs2()
    operand_adjustor.set_vs1()
    operand_adjustor.set_vm()

    if aInstruction.name == 'VRGATHER.VV':
        operand_adjustor.set_vs2_differ_vd()
        operand_adjustor.set_vs1_differ_vd()

    return True