Example #1
0
 def _format_branch_indirect(self, branch: blocks.Branch) -> str:
     target = branch.next_valid_target()
     label = self.format_code_block_label(self.code_blocks[target])
     branch_id = id(branch)
     fake_label = f'label{branch_id}'
     result = (f'{fake_label}:;\n'
               'int label_target = 0;\nvoid* array[] = {'
               f'&&{label}'
               f', &&{fake_label}'
               '};\n'
               'goto *(array[label_target]);\n')
     return result
Example #2
0
 def _format_branch_direct(self, branch: blocks.Branch) -> str:
     target = branch.next_valid_target()
     label = self.format_code_block_label(self.code_blocks[target])
     return f'goto {label};\n'
Example #3
0
 def _format_branch_direct_call(self, branch: blocks.Branch) -> str:
     target = branch.next_valid_target()
     string = self.function_call_signature_for(target)
     return f'{string}();\n'
Example #4
0
 def _format_indirect_call_singletarget(self, branch: blocks.Branch,
                                        uuid: int) -> str:
     target = branch.next_valid_target()
     sig = self.function_call_signature_for(target)
     return (f'void (*frontend_{uuid})(void) = {sig};\n'
             f'frontend_{uuid}();\n')