Skip to content

Commit

Permalink
dialects: Fix inline_asm unitattrs to not be properties (#2223)
Browse files Browse the repository at this point in the history
@superlopuh pointed out that #2203 contains an erroneous implementation
of a UnitAttr being implemented as properties. This is incorrect, since
upstream prints the UnitAttrs as attributes and properties.
It was a bit confusing because some other ops in the LLVM dialect have
the same mistake right now.
This happens under the radar because in testing, properties are printed
as attributes.
This PR fixes the inline_asm operation.
  • Loading branch information
JosseVanDelm authored Feb 22, 2024
1 parent ad8f2e0 commit 836098f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions xdsl/dialects/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
irdl_attr_definition,
irdl_op_definition,
operand_def,
opt_attr_def,
opt_operand_def,
opt_prop_def,
opt_result_def,
Expand Down Expand Up @@ -736,8 +737,9 @@ class InlineAsmOp(IRDLOperation):

asm_string: StringAttr = prop_def(StringAttr)
constraints: StringAttr = prop_def(StringAttr)
has_side_effects: UnitAttr | None = opt_prop_def(UnitAttr)
is_align_stack: UnitAttr | None = opt_prop_def(UnitAttr)

has_side_effects: UnitAttr | None = opt_attr_def(UnitAttr)
is_align_stack: UnitAttr | None = opt_attr_def(UnitAttr)

def __init__(
self,
Expand All @@ -754,13 +756,15 @@ def __init__(
"constraints": StringAttr(constraints),
"asm_dialect": IntegerAttr.from_int_and_width(asm_dialect, 64),
}
if has_side_effects:
props["has_side_effects"] = UnitAttr()
if is_align_stack:
props["is_align_stack"] = UnitAttr()

attrs = {
"has_side_effects": UnitAttr() if has_side_effects else None,
"is_align_stack": UnitAttr() if is_align_stack else None,
}

super().__init__(
operands=operands_,
attributes=attrs,
properties=props,
result_types=res_types,
)
Expand Down

0 comments on commit 836098f

Please sign in to comment.