Ptr
ptr
RawPtr
dataclass
Data structure to help simulate pointers into memory.
Source code in xdsl/interpreters/utils/ptr.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
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
Source code in xdsl/interpreters/utils/ptr.py
34 35 | |
zeros(count: int) -> RawPtr
staticmethod
Returns a new Ptr of size count with offset 0.
Source code in xdsl/interpreters/utils/ptr.py
37 38 39 40 41 42 | |
__add__(offset: int) -> RawPtr
Aliases the data, so storing into the offset stores for all other references to the list.
Source code in xdsl/interpreters/utils/ptr.py
44 45 46 47 48 49 | |
index(index_bitwidth: int) -> TypedPtr[int]
Source code in xdsl/interpreters/utils/ptr.py
59 60 61 62 63 64 | |
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
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
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
Source code in xdsl/interpreters/utils/ptr.py
93 94 | |
get_iter() -> Iterator[_T]
Source code in xdsl/interpreters/utils/ptr.py
96 97 98 99 100 101 102 103 | |
get_list(count: int) -> list[_T]
Source code in xdsl/interpreters/utils/ptr.py
105 106 | |
__getitem__(index: int) -> _T
Source code in xdsl/interpreters/utils/ptr.py
108 109 110 | |
__setitem__(index: int, value: _T)
Source code in xdsl/interpreters/utils/ptr.py
112 113 114 | |
zeros(count: int, *, xtype: PackableType[_T]) -> TypedPtr[_T]
staticmethod
Source code in xdsl/interpreters/utils/ptr.py
116 117 118 119 | |
new(els: Sequence[_T], *, xtype: PackableType[_T]) -> TypedPtr[_T]
staticmethod
Returns a new TypedPtr with the specified els packed into memory.
Source code in xdsl/interpreters/utils/ptr.py
121 122 123 124 125 126 127 128 129 130 | |
new_float32(els: Sequence[float]) -> TypedPtr[float]
staticmethod
Source code in xdsl/interpreters/utils/ptr.py
132 133 134 | |
new_float64(els: Sequence[float]) -> TypedPtr[float]
staticmethod
Source code in xdsl/interpreters/utils/ptr.py
136 137 138 | |
new_int32(els: Sequence[int]) -> TypedPtr[int]
staticmethod
Source code in xdsl/interpreters/utils/ptr.py
140 141 142 | |
new_int64(els: Sequence[int]) -> TypedPtr[int]
staticmethod
Source code in xdsl/interpreters/utils/ptr.py
144 145 146 | |
new_index(els: Sequence[int], index_bitwidth: int) -> TypedPtr[int]
staticmethod
Source code in xdsl/interpreters/utils/ptr.py
148 149 150 151 152 153 154 | |
index(bitwidth: Literal[32, 64]) -> PackableType[int]
Source code in xdsl/interpreters/utils/ptr.py
75 76 | |