Skip to content

Symref

symref

Symref = Dialect('symref', [DeclareOp, FetchOp, UpdateOp], []) module-attribute

DeclareOp

Bases: IRDLOperation

Source code in xdsl/dialects/symref.py
14
15
16
17
18
19
20
21
22
23
24
@irdl_op_definition
class DeclareOp(IRDLOperation):
    name = "symref.declare"
    sym_name = prop_def(StringAttr)

    assembly_format = "$sym_name attr-dict"

    def __init__(self, sym_name: str | StringAttr):
        if isinstance(sym_name, str):
            sym_name = StringAttr(sym_name)
        super().__init__(properties={"sym_name": sym_name})

name = 'symref.declare' class-attribute instance-attribute

sym_name = prop_def(StringAttr) class-attribute instance-attribute

assembly_format = '$sym_name attr-dict' class-attribute instance-attribute

__init__(sym_name: str | StringAttr)

Source code in xdsl/dialects/symref.py
21
22
23
24
def __init__(self, sym_name: str | StringAttr):
    if isinstance(sym_name, str):
        sym_name = StringAttr(sym_name)
    super().__init__(properties={"sym_name": sym_name})

FetchOp

Bases: IRDLOperation

Source code in xdsl/dialects/symref.py
27
28
29
30
31
32
33
34
35
36
37
38
@irdl_op_definition
class FetchOp(IRDLOperation):
    name = "symref.fetch"
    value = result_def()
    symbol = prop_def(SymbolRefAttr)

    assembly_format = "$symbol attr-dict `:` type($value)"

    def __init__(self, symbol: str | SymbolRefAttr, result_type: Attribute):
        if isinstance(symbol, str):
            symbol = SymbolRefAttr(symbol)
        super().__init__(properties={"symbol": symbol}, result_types=[result_type])

name = 'symref.fetch' class-attribute instance-attribute

value = result_def() class-attribute instance-attribute

symbol = prop_def(SymbolRefAttr) class-attribute instance-attribute

assembly_format = '$symbol attr-dict `:` type($value)' class-attribute instance-attribute

__init__(symbol: str | SymbolRefAttr, result_type: Attribute)

Source code in xdsl/dialects/symref.py
35
36
37
38
def __init__(self, symbol: str | SymbolRefAttr, result_type: Attribute):
    if isinstance(symbol, str):
        symbol = SymbolRefAttr(symbol)
    super().__init__(properties={"symbol": symbol}, result_types=[result_type])

UpdateOp

Bases: IRDLOperation

Source code in xdsl/dialects/symref.py
41
42
43
44
45
46
47
48
49
50
51
52
@irdl_op_definition
class UpdateOp(IRDLOperation):
    name = "symref.update"
    value = operand_def()
    symbol = prop_def(SymbolRefAttr)

    assembly_format = "$symbol `=` $value attr-dict `:` type($value)"

    def __init__(self, symbol: str | SymbolRefAttr, value: Operation | SSAValue):
        if isinstance(symbol, str):
            symbol = SymbolRefAttr(symbol)
        super().__init__(operands=[value], properties={"symbol": symbol})

name = 'symref.update' class-attribute instance-attribute

value = operand_def() class-attribute instance-attribute

symbol = prop_def(SymbolRefAttr) class-attribute instance-attribute

assembly_format = '$symbol `=` $value attr-dict `:` type($value)' class-attribute instance-attribute

__init__(symbol: str | SymbolRefAttr, value: Operation | SSAValue)

Source code in xdsl/dialects/symref.py
49
50
51
52
def __init__(self, symbol: str | SymbolRefAttr, value: Operation | SSAValue):
    if isinstance(symbol, str):
        symbol = SymbolRefAttr(symbol)
    super().__init__(operands=[value], properties={"symbol": symbol})