Bases: ModulePass
Allocates unallocated registers in the module.
The allocatable set depends on the target, read from the x86.arch module
attribute. Without it the conservative VEX-only set is used, since handing
out EVEX-only registers produces assembly the target cannot decode.
Source code in xdsl/transforms/x86_allocate_registers.py
| @dataclass(frozen=True)
class X86AllocateRegisters(ModulePass):
"""
Allocates unallocated registers in the module.
The allocatable set depends on the target, read from the `x86.arch` module
attribute. Without it the conservative VEX-only set is used, since handing
out EVEX-only registers produces assembly the target cannot decode.
"""
name = "x86-allocate-registers"
def apply(self, ctx: Context, op: ModuleOp) -> None:
arch = X86Arch.from_module(op)
for inner_op in op.walk():
if isinstance(inner_op, x86_func.FuncOp):
available_registers = X86RegisterStack.get_for_arch(arch)
allocator = X86RegisterAllocator(available_registers)
allocator.allocate_func(inner_op)
|
Source code in xdsl/transforms/x86_allocate_registers.py
| def apply(self, ctx: Context, op: ModuleOp) -> None:
arch = X86Arch.from_module(op)
for inner_op in op.walk():
if isinstance(inner_op, x86_func.FuncOp):
available_registers = X86RegisterStack.get_for_arch(arch)
allocator = X86RegisterAllocator(available_registers)
allocator.allocate_func(inner_op)
|