MCPcopy Index your code
hub / github.com/python/mypy / LoadAddress

Class LoadAddress

mypyc/ir/ops.py:1786–1817  ·  view source on GitHub ↗

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.)

Source from the content-addressed store, hash-verified

1784
1785@final
1786class 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

Callers 15

gen_conditionMethod · 0.90
gen_importMethod · 0.90
create_non_ext_infoMethod · 0.90
find_non_ext_metaclassFunction · 0.90
gen_glue_ne_methodFunction · 0.90
emit_yield_from_or_awaitFunction · 0.90
except_bodyFunction · 0.90
transform_ellipsisFunction · 0.90
load_addressMethod · 0.90
none_objectMethod · 0.90

Calls

no outgoing calls

Tested by 3

test_load_NoneMethod · 0.72
test_load_addressMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…