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
new_type_for_value(reg: SSAValue) -> RegisterType | None
¶
allocate_value(val: SSAValue) -> SSAValue | None
¶
Allocate a register if not already allocated.
Source code in xdsl/backend/register_allocator.py
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
BlockAllocator
¶
Bases: ValueAllocator, ABC
Abstract base class for allocators that can process blocks at a time.
Source code in xdsl/backend/register_allocator.py
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.