def __call__(self, building_block, target): """ :param building_block: :param target: """ instructions_def = interpret_asm(self._asm, target, building_block.labels) instructions = [] for definition in instructions_def: instruction = microprobe.code.ins.Instruction() instruction_set_def_properties(instruction, definition, building_block=building_block, target=target, allowed_registers=self._aregs) instructions.append(instruction) if self._index < 0: building_block.add_instructions( instructions, after=building_block.cfg.bbls[-1].instrs[-1]) elif self._index == 0: building_block.add_instructions( instructions, before=building_block.cfg.bbls[0].instrs[0]) else: cindex = 0 ains = None instr = None for bbl in building_block.cfg.bbls: for instr in bbl.instrs: cindex = cindex + 1 if instr is None: raise MicroprobeCodeGenerationError( "Empty basic block found") if cindex == self._index: ains = instr building_block.add_instructions(instructions, after=ains) return building_block.add_instructions( instructions, after=building_block.cfg.bbls[-1].instrs[-1])
def __call__(self, building_block, target): """ :param building_block: :param target: """ instructions_def = interpret_asm(self._asm, target, building_block.labels) instructions = [] for definition in instructions_def: instruction = microprobe.code.ins.Instruction() instruction_set_def_properties(instruction, definition, building_block=building_block, target=target, allowed_registers=self._aregs) instructions.append(instruction) building_block.add_init(instructions)
def __call__(self, building_block, target): """ :param building_block: :param dummy_target: """ if len(self._sequence) > MICROPROBE_RC['parallel_threshold']: if MICROPROBE_RC['verbose']: print_info("Enabling parallel processing") return self._parallel(building_block, target) sequence = iter(self._sequence) for bbl in building_block.cfg.bbls: for instr in bbl.instrs: definition = next(sequence) instruction_set_def_properties(instr, definition, building_block=building_block, target=target) return []
def _set_props(largs, queue=None, show_progress=False): rlist = [] if show_progress: progress = Progress(len(largs), msg="Setting instruction properties: ") for args in largs: instr, definition, building_block, target, displ = args instruction_set_def_properties(instr, definition, building_block=building_block, target=target, label_displ=displ) if show_progress: progress() rlist.append(instr) if queue is not None: queue.put(rlist) return rlist