Get the address of a value: result = (type)&src Attributes: type: Type of the loaded address(e.g. ptr/object_ptr) src: Source value (str for globals like 'PyList_Type', Register for temporary values or locals, LoadStatic for statics.)
| 1784 | |
| 1785 | @final |
| 1786 | class LoadAddress(RegisterOp): |
| 1787 | """Get the address of a value: result = (type)&src |
| 1788 | |
| 1789 | Attributes: |
| 1790 | type: Type of the loaded address(e.g. ptr/object_ptr) |
| 1791 | src: Source value (str for globals like 'PyList_Type', |
| 1792 | Register for temporary values or locals, LoadStatic |
| 1793 | for statics.) |
| 1794 | """ |
| 1795 | |
| 1796 | error_kind = ERR_NEVER |
| 1797 | is_borrowed = True |
| 1798 | |
| 1799 | def __init__(self, type: RType, src: str | Register | LoadStatic, line: int = -1) -> None: |
| 1800 | super().__init__(line) |
| 1801 | self.type = type |
| 1802 | self.src = src |
| 1803 | |
| 1804 | def sources(self) -> list[Value]: |
| 1805 | if isinstance(self.src, Register): |
| 1806 | return [self.src] |
| 1807 | else: |
| 1808 | return [] |
| 1809 | |
| 1810 | def set_sources(self, new: list[Value]) -> None: |
| 1811 | if new: |
| 1812 | assert isinstance(new[0], Register) |
| 1813 | assert len(new) == 1 |
| 1814 | self.src = new[0] |
| 1815 | |
| 1816 | def accept(self, visitor: OpVisitor[T]) -> T: |
| 1817 | return visitor.visit_load_address(self) |
| 1818 | |
| 1819 | |
| 1820 | @final |
no outgoing calls
searching dependent graphs…