(
self,
stmt: SimpleStmt,
uop: CodeSection,
storage: Storage,
inst: Instruction | None,
)
| 542 | return method(stmt, uop, storage, inst) # type: ignore[no-any-return] |
| 543 | |
| 544 | def emit_SimpleStmt( |
| 545 | self, |
| 546 | stmt: SimpleStmt, |
| 547 | uop: CodeSection, |
| 548 | storage: Storage, |
| 549 | inst: Instruction | None, |
| 550 | ) -> tuple[bool, Token | None, Storage]: |
| 551 | local_stores = set(uop.local_stores) |
| 552 | reachable = True |
| 553 | tkn = stmt.contents[-1] |
| 554 | try: |
| 555 | if stmt in uop.properties.escaping_calls and not self.cannot_escape: |
| 556 | escape = uop.properties.escaping_calls[stmt] |
| 557 | if escape.kills is not None: |
| 558 | self.stackref_kill(escape.kills, storage, True) |
| 559 | self.emit_save(storage) |
| 560 | tkn_iter = TokenIterator(stmt.contents) |
| 561 | for tkn in tkn_iter: |
| 562 | if tkn.kind == "GOTO": |
| 563 | label_tkn = next(tkn_iter) |
| 564 | self.goto_label(tkn, label_tkn, storage) |
| 565 | reachable = False |
| 566 | elif tkn.kind == "RETURN": |
| 567 | self.emit(tkn) |
| 568 | semicolon = emit_to(self.out, tkn_iter, "SEMI") |
| 569 | self.emit(semicolon) |
| 570 | reachable = False |
| 571 | elif tkn.kind == "IDENTIFIER": |
| 572 | if tkn.text in self._replacers: |
| 573 | if not self._replacers[tkn.text](tkn, tkn_iter, uop, storage, inst): |
| 574 | reachable = False |
| 575 | else: |
| 576 | if tkn in local_stores: |
| 577 | for var in storage.inputs: |
| 578 | if var.name == tkn.text: |
| 579 | var.in_local = True |
| 580 | var.memory_offset = None |
| 581 | break |
| 582 | for var in storage.outputs: |
| 583 | if var.name == tkn.text: |
| 584 | var.in_local = True |
| 585 | var.memory_offset = None |
| 586 | break |
| 587 | if tkn.text.startswith("DISPATCH"): |
| 588 | reachable = False |
| 589 | self.out.emit(tkn) |
| 590 | else: |
| 591 | self.out.emit(tkn) |
| 592 | if stmt in uop.properties.escaping_calls and not self.cannot_escape: |
| 593 | self.emit_reload(storage) |
| 594 | return reachable, None, storage |
| 595 | except StackError as ex: |
| 596 | raise analysis_error(ex.args[0], tkn) #from None |
| 597 | |
| 598 | |
| 599 | def emit_MacroIfStmt( |
nothing calls this directly
no test coverage detected