def add_layout_operand(aInstruction): # TODO(Noah): Add additional load/store whole register instructions when they are supported by # Handcar. load_store_whole_register = ['VL1R.V', 'VS1R.V'] operand_adjustor = VectorOperandAdjustor(aInstruction) if aInstruction.name in load_store_whole_register: reg_count = int(aInstruction.name[2]) operand_adjustor.add_whole_register_layout_operand(aRegCount=reg_count) elif aInstruction.name in ('VMV1R.V', 'VMV2R.V', 'VMV4R.V', 'VMV8R.V'): reg_count = int(aInstruction.name[3]) operand_adjustor.add_whole_register_layout_operand( aRegCount=reg_count, aRegIndexAlignment=reg_count) elif aInstruction.name in ('VSETVL', 'VSETVLI'): pass # No vector layout operand required elif aInstruction.iclass == 'VectorLoadStoreInstruction' or aInstruction.iclass == 'VectorAMOInstructionRISCV': reg_count = 1 elem_width = None ints = re.findall('\d+', aInstruction.name) if len(ints) > 1: reg_count = ints[0] elem_width = ints[1] else: elem_width = ints[0] operand_adjustor.add_custom_layout_operand(aRegCount=reg_count, aElemWidth=elem_width) else: operand_adjustor.add_vtype_layout_operand()
def add_layout_operand(aInstruction): load_store_whole_register = ["VL1R.V", "VS1R.V"] operand_adjustor = VectorOperandAdjustor(aInstruction) if aInstruction.name in load_store_whole_register: reg_count = int(aInstruction.name[2]) operand_adjustor.add_whole_register_layout_operand(aRegCount=reg_count) elif aInstruction.name in ("VMV1R.V", "VMV2R.V", "VMV4R.V", "VMV8R.V"): reg_count = int(aInstruction.name[3]) operand_adjustor.add_whole_register_layout_operand( aRegCount=reg_count, aRegIndexAlignment=reg_count ) elif aInstruction.name in ("VSETVL", "VSETVLI"): pass # No vector layout operand required elif ( aInstruction.iclass == "VectorLoadStoreInstruction" or aInstruction.iclass == "VectorAMOInstructionRISCV" ): reg_count = 1 elem_width = None ints = re.findall("\d+", aInstruction.name) if len(ints) > 1: reg_count = ints[0] elem_width = ints[1] else: elem_width = ints[0] operand_adjustor.add_custom_layout_operand( aRegCount=reg_count, aElemWidth=elem_width ) else: operand_adjustor.add_vtype_layout_operand()