Skip to content

Legalization

legalization

LegalizationContext dataclass

Bases: LivenessContext

Helper to ensure that registers can be allocated in the input, inserting a move if not.

Source code in xdsl/backend/x86/legalization.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@dataclass
class LegalizationContext(LivenessContext):
    """
    Helper to ensure that registers can be allocated in the input, inserting a move if
    not.
    """

    arch: X86Arch
    builder: Builder

    def handle_live_inout(
        self, op: Operation, value: SSAValue, *, duplicate_inout: bool = False
    ) -> SSAValue:
        return self.arch.move_value_to_unallocated(
            value,
            self.builder,
            value_type=None,
            insertion_point=InsertPoint.before(op),
        )

arch: X86Arch instance-attribute

builder: Builder instance-attribute

__init__(alive: set[SSAValue], arch: X86Arch, builder: Builder) -> None

handle_live_inout(op: Operation, value: SSAValue, *, duplicate_inout: bool = False) -> SSAValue

Source code in xdsl/backend/x86/legalization.py
22
23
24
25
26
27
28
29
30
def handle_live_inout(
    self, op: Operation, value: SSAValue, *, duplicate_inout: bool = False
) -> SSAValue:
    return self.arch.move_value_to_unallocated(
        value,
        self.builder,
        value_type=None,
        insertion_point=InsertPoint.before(op),
    )