Load a Python literal object (dest = 'foo' / b'foo' / ...). This is used to load a static PyObject * value corresponding to a literal of one of the supported types. Tuple / frozenset literals must contain only valid literal values as items. NOTE: You can use this to load boxed (Py
| 834 | |
| 835 | @final |
| 836 | class LoadLiteral(RegisterOp): |
| 837 | """Load a Python literal object (dest = 'foo' / b'foo' / ...). |
| 838 | |
| 839 | This is used to load a static PyObject * value corresponding to |
| 840 | a literal of one of the supported types. |
| 841 | |
| 842 | Tuple / frozenset literals must contain only valid literal values as items. |
| 843 | |
| 844 | NOTE: You can use this to load boxed (Python) int objects. Use |
| 845 | Integer to load unboxed, tagged integers or fixed-width, |
| 846 | low-level integers. |
| 847 | |
| 848 | For int literals, both int_rprimitive (CPyTagged) and |
| 849 | object_primitive (PyObject *) are supported as rtype. However, |
| 850 | when using int_rprimitive, the value must *not* be small enough |
| 851 | to fit in an unboxed integer. |
| 852 | """ |
| 853 | |
| 854 | error_kind = ERR_NEVER |
| 855 | is_borrowed = True |
| 856 | |
| 857 | def __init__(self, value: LiteralValue, rtype: RType, line: int = -1) -> None: |
| 858 | super().__init__(line) |
| 859 | self.value = value |
| 860 | self.type = rtype |
| 861 | |
| 862 | def sources(self) -> list[Value]: |
| 863 | return [] |
| 864 | |
| 865 | def set_sources(self, new: list[Value]) -> None: |
| 866 | assert not new |
| 867 | |
| 868 | def accept(self, visitor: OpVisitor[T]) -> T: |
| 869 | return visitor.visit_load_literal(self) |
| 870 | |
| 871 | |
| 872 | @final |
no outgoing calls
searching dependent graphs…