Register allocator
register_allocator
ValueAllocator
Base class for register allocators.
Source code in xdsl/backend/register_allocator.py
14 15 16 17 18 19 20 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 73 74 75 76 77 78 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 | |
available_registers: RegisterStack = available_registers
instance-attribute
register_base_class: type[RegisterType] = register_base_class
instance-attribute
new_value_by_old_value: dict[SSAValue, SSAValue] = {}
instance-attribute
__init__(available_registers: RegisterStack, register_base_class: type[RegisterType]) -> None
Source code in xdsl/backend/register_allocator.py
23 24 25 26 27 28 29 30 | |
new_type_for_value(reg: SSAValue) -> RegisterType | None
Source code in xdsl/backend/register_allocator.py
32 33 34 | |
allocate_value(val: SSAValue) -> SSAValue | None
Allocate a register if not already allocated.
Source code in xdsl/backend/register_allocator.py
43 44 45 46 47 48 49 50 51 | |
allocate_values_same_reg(vals: Sequence[SSAValue]) -> bool
Allocates the values passed in to the same register.
If some of the values are already allocated, they must be allocated to the same
register, and unallocated values are then allocated to this register.
If the values passed in are already allocated to differing registers, a
DiagnosticException is raised.
Source code in xdsl/backend/register_allocator.py
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 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 | |
free_value(val: SSAValue) -> None
Source code in xdsl/backend/register_allocator.py
110 111 112 | |
BlockAllocator
Bases: ValueAllocator, ABC
Abstract base class for allocators that can process blocks at a time.
Source code in xdsl/backend/register_allocator.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
live_ins_per_block: dict[Block, OrderedSet[SSAValue]] = {}
instance-attribute
__init__(available_registers: RegisterStack, register_base_class: type[RegisterType]) -> None
Source code in xdsl/backend/register_allocator.py
158 159 160 161 162 163 164 | |
allocate_block(block: Block)
abstractmethod
For each operation in the block, allocate the registers.
Source code in xdsl/backend/register_allocator.py
166 167 168 169 170 | |
live_ins_per_block(block: Block) -> dict[Block, OrderedSet[SSAValue]]
Returns a mapping from a block to the set of values used in it but defined outside of it.
Source code in xdsl/backend/register_allocator.py
141 142 143 144 145 146 147 148 | |