Register type
register_type
¶
RegisterType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute, ABC
An abstract register type for target ISA-specific dialects.
Registers store an index as used in the binary encoding. Their assembly names are derived from the index, so aliases identify the same register.
Some approaches for register allocation have stages where values are assigned to a
fixed set of registers that is distinct from the registers that exist on a target
platform, to separate the graph coloring from roles of registers in the target ABI.
In order to support this scenario, negative indices are allowed in the index,
denoting an infinite register set without any representation in the ABI.
These are printed with a prefix as defined by the infinite_register_prefix
class method, which must not be a prefix of any of the register names defined by
the index_by_name class method.
Source code in xdsl/backend/register_type.py
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 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 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 | |
index: IntAttr | NoneAttr
instance-attribute
¶
register_name: str
property
¶
The canonical assembly name, or an empty string if unallocated.
is_allocated: bool
property
¶
Returns true if the register is allocated, otherwise false
__init__(index: IntAttr | NoneAttr) -> None
¶
__init_subclass__() -> None
¶
Source code in xdsl/backend/register_type.py
unallocated() -> Self
classmethod
¶
from_name(register_name: StringAttr | str) -> Self
classmethod
¶
from_index(index: int) -> Self
classmethod
¶
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
¶
Source code in xdsl/backend/register_type.py
print_parameters(printer: Printer) -> None
¶
verify() -> None
¶
Source code in xdsl/backend/register_type.py
allocatable_registers() -> Sequence[Self]
classmethod
¶
register_pool_key() -> str
classmethod
¶
Pool key used when allocating unallocated values of this type and for infinite
spill registers. Defaults to the dialect type name (cls.name).
index_by_name() -> dict[str, int]
abstractmethod
classmethod
¶
abi_name_by_index() -> dict[int, str]
classmethod
¶
Returns a mapping from ABI register indices to their names.
Source code in xdsl/backend/register_type.py
infinite_register_prefix() -> str
abstractmethod
classmethod
¶
Provide the prefix for the name for a register at the given index in the
"infinite" register set.
For a prefix x, the name of the first infinite register will be x0.
Source code in xdsl/backend/register_type.py
infinite_register(index: int) -> Self
classmethod
¶
Provide the register at the given index in the "infinite" register set. Index must be nonnegative.
Source code in xdsl/backend/register_type.py
RegisterAllocatedMemoryEffect
dataclass
¶
Bases: MemoryEffect
An assembly operation that only has side-effect if some registers are allocated to it.
Source code in xdsl/backend/register_type.py
get_effects(op: Operation) -> set[EffectInstance]
classmethod
¶
Source code in xdsl/backend/register_type.py
iter_used_registers(op: Operation) -> Iterator[RegisterType]
staticmethod
¶
Iterator over the registers read from or written to according to the operation's
memory effects with resource RegisterResource.