Register allocatable
register_allocatable
RegisterAllocatableOperation
dataclass
Bases: Operation, ABC
An abstract base class for operations that can be processed during register allocation.
Source code in xdsl/backend/register_allocatable.py
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 73 74 75 76 77 78 79 80 81 | |
iter_used_registers() -> Iterator[RegisterType]
The registers whose contents may be overwritten when executing this operation. By default returns the types of operands and results that are allocated registers.
Source code in xdsl/backend/register_allocatable.py
28 29 30 31 32 33 34 35 | |
iter_excluded_registers() -> Iterator[RegisterType]
The registers that should not be used when this operation is present.
Source code in xdsl/backend/register_allocatable.py
37 38 39 40 41 | |
allocate_registers(allocator: BlockAllocator) -> None
abstractmethod
Allocate registers for this operation.
Source code in xdsl/backend/register_allocatable.py
43 44 45 46 47 | |
update_liveness(ctx: LivenessContext) -> None
abstractmethod
Update ctx.alive from live-after to live-before this operation.
Source code in xdsl/backend/register_allocatable.py
49 50 51 52 53 | |
all_used_registers(region: Region) -> AbstractSet[RegisterType]
staticmethod
All used registers of all operations within a region.
Source code in xdsl/backend/register_allocatable.py
55 56 57 58 59 60 61 62 63 64 65 66 67 | |
all_excluded_registers(region: Region) -> AbstractSet[RegisterType]
staticmethod
All excluded registers as declared by all operations within a region.
Source code in xdsl/backend/register_allocatable.py
69 70 71 72 73 74 75 76 77 78 79 80 81 | |
RegisterConstraints
Bases: NamedTuple
Values used by an instruction.
A collection of operations in inouts represents the constraint that they must be
allocated to the same register.
Source code in xdsl/backend/register_allocatable.py
84 85 86 87 88 89 90 91 92 93 | |
ins: Sequence[SSAValue]
instance-attribute
outs: Sequence[OpResult]
instance-attribute
inouts: Sequence[tuple[SSAValue, OpResult]]
instance-attribute
HasRegisterConstraintsTrait
dataclass
Bases: OpTrait
Trait that verifies that the operation implements HasRegisterConstraints, and that
its constraints account for each operand and result as many times as it occurs.
An operand is declared by ins or inouts, a result by outs or inouts. A value
occupying several operands is declared once per operand, so an operation may read a
value as an in register and also clobber it as an inout register.
Source code in xdsl/backend/register_allocatable.py
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 | |
verify(op: Operation) -> None
Source code in xdsl/backend/register_allocatable.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
HasRegisterConstraints
dataclass
Bases: RegisterAllocatableOperation, ABC
Abstract superclass for operations corresponding to assembly, with registers used as in, out, or inout registers. The use of a register value as inout must be its last use (externally verified, e.g. see pass x86-regalloc-verify-liveness).
Source code in xdsl/backend/register_allocatable.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
traits = traits_def(HasRegisterConstraintsTrait())
class-attribute
instance-attribute
get_register_constraints() -> RegisterConstraints
abstractmethod
The values with register types used by this operation, for use in register allocation.
Source code in xdsl/backend/register_allocatable.py
165 166 167 168 169 170 171 | |
update_liveness(ctx: LivenessContext) -> None
Source code in xdsl/backend/register_allocatable.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
allocate_registers(allocator: BlockAllocator) -> None
Source code in xdsl/backend/register_allocatable.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |