Ptr
ptr
¶
RawPtr
dataclass
¶
Data structure to help simulate pointers into memory.
Source code in xdsl/interpreters/utils/ptr.py
memory: bytearray
instance-attribute
¶
offset: int = field(default=0)
class-attribute
instance-attribute
¶
memoryview: memoryview
property
¶
int32: TypedPtr[int]
property
¶
int64: TypedPtr[int]
property
¶
float32: TypedPtr[float]
property
¶
float64: TypedPtr[float]
property
¶
__init__(memory: bytearray, offset: int = 0) -> None
¶
copy() -> RawPtr
¶
zeros(count: int) -> RawPtr
staticmethod
¶
__add__(offset: int) -> RawPtr
¶
Aliases the data, so storing into the offset stores for all other references to the list.
index(index_bitwidth: int) -> TypedPtr[int]
¶
Source code in xdsl/interpreters/utils/ptr.py
TypedPtr
dataclass
¶
Bases: Generic[_T]
A typed pointer into memory, similar to numpy's ndarray, but without the shape.
Source code in xdsl/interpreters/utils/ptr.py
raw: RawPtr
instance-attribute
¶
_: KW_ONLY
instance-attribute
¶
xtype: PackableType[_T]
instance-attribute
¶
size: int
property
¶
__init__(raw: RawPtr, *, xtype: PackableType[_T]) -> None
¶
copy() -> Self
¶
get_iter() -> Iterator[_T]
¶
Source code in xdsl/interpreters/utils/ptr.py
get_list(count: int) -> list[_T]
¶
__getitem__(index: int) -> _T
¶
__setitem__(index: int, value: _T)
¶
zeros(count: int, *, xtype: PackableType[_T]) -> TypedPtr[_T]
staticmethod
¶
new(els: Sequence[_T], *, xtype: PackableType[_T]) -> TypedPtr[_T]
staticmethod
¶
Returns a new TypedPtr with the specified els packed into memory.