Skip to content

X86 allocate registers

x86_allocate_registers

X86AllocateRegisters dataclass

Bases: ModulePass

Allocates unallocated registers in the module.

Source code in xdsl/transforms/x86_allocate_registers.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@dataclass(frozen=True)
class X86AllocateRegisters(ModulePass):
    """
    Allocates unallocated registers in the module.
    """

    name = "x86-allocate-registers"

    def apply(self, ctx: Context, op: ModuleOp) -> None:
        for inner_op in op.walk():
            if isinstance(inner_op, x86_func.FuncOp):
                available_registers = X86RegisterStack.get()
                allocator = X86RegisterAllocator(available_registers)
                allocator.allocate_func(inner_op)

name = 'x86-allocate-registers' class-attribute instance-attribute

__init__() -> None

apply(ctx: Context, op: ModuleOp) -> None

Source code in xdsl/transforms/x86_allocate_registers.py
19
20
21
22
23
24
def apply(self, ctx: Context, op: ModuleOp) -> None:
    for inner_op in op.walk():
        if isinstance(inner_op, x86_func.FuncOp):
            available_registers = X86RegisterStack.get()
            allocator = X86RegisterAllocator(available_registers)
            allocator.allocate_func(inner_op)