From 71ea8280368d7c8432e991fb76076aac24293488 Mon Sep 17 00:00:00 2001 From: Emilien Bauer Date: Mon, 18 Dec 2023 10:20:49 +0000 Subject: [PATCH] dialects: Switch math to properties. (#1881) --- xdsl/dialects/experimental/math.py | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/xdsl/dialects/experimental/math.py b/xdsl/dialects/experimental/math.py index f08aa05d8f..d8f1a32af2 100644 --- a/xdsl/dialects/experimental/math.py +++ b/xdsl/dialects/experimental/math.py @@ -8,7 +8,7 @@ Operand, irdl_op_definition, operand_def, - opt_attr_def, + opt_prop_def, result_def, ) @@ -27,7 +27,7 @@ class AbsFOp(IRDLOperation): """ name = "math.absf" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -88,7 +88,7 @@ class Atan2Op(IRDLOperation): """ name = "math.atan2" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) lhs: Operand = operand_def(AnyFloat) rhs: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -124,7 +124,7 @@ class AtanOp(IRDLOperation): """ name = "math.atan" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -155,7 +155,7 @@ class CbrtOp(IRDLOperation): """ name = "math.cbrt" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -187,7 +187,7 @@ class CeilOp(IRDLOperation): """ name = "math.ceil" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -220,7 +220,7 @@ class CopySignOp(IRDLOperation): """ name = "math.copysign" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) lhs: Operand = operand_def(AnyFloat) rhs: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -257,7 +257,7 @@ class CosOp(IRDLOperation): """ name = "math.cos" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -352,7 +352,7 @@ class ErfOp(IRDLOperation): """ name = "math.erf" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -384,7 +384,7 @@ class Exp2Op(IRDLOperation): """ name = "math.exp2" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -418,7 +418,7 @@ class ExpM1Op(IRDLOperation): """ name = "math.expm1" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -450,7 +450,7 @@ class ExpOp(IRDLOperation): """ name = "math.exp" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -490,7 +490,7 @@ class FPowIOp(IRDLOperation): """ name = "math.fpowi" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) lhs: Operand = operand_def(AnyFloat) rhs: Operand = operand_def(IntegerType) result: OpResult = result_def(AnyFloat) @@ -527,7 +527,7 @@ class FloorOp(IRDLOperation): """ name = "math.floor" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -564,7 +564,7 @@ class FmaOp(IRDLOperation): """ name = "math.fma" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) a: Operand = operand_def(AnyFloat) b: Operand = operand_def(AnyFloat) c: Operand = operand_def(AnyFloat) @@ -626,7 +626,7 @@ class Log10Op(IRDLOperation): """ name = "math.log10" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -657,7 +657,7 @@ class Log1pOp(IRDLOperation): """ name = "math.log1p" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -686,7 +686,7 @@ class Log2Op(IRDLOperation): """ name = "math.log2" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -715,7 +715,7 @@ class LogOp(IRDLOperation): """ name = "math.log" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -747,7 +747,7 @@ class PowFOp(IRDLOperation): """ name = "math.powf" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) lhs: Operand = operand_def(AnyFloat) rhs: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -787,7 +787,7 @@ class RoundEvenOp(IRDLOperation): """ name = "math.roundeven" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -822,7 +822,7 @@ class RoundOp(IRDLOperation): """ name = "math.round" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -850,7 +850,7 @@ class RsqrtOp(IRDLOperation): """ name = "math.rsqrt" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -882,7 +882,7 @@ class SinOp(IRDLOperation): """ name = "math.sin" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -910,7 +910,7 @@ class SqrtOp(IRDLOperation): """ name = "math.sqrt" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -939,7 +939,7 @@ class TanOp(IRDLOperation): """ name = "math.tan" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -968,7 +968,7 @@ class TanhOp(IRDLOperation): """ name = "math.tanh" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat) @@ -1002,7 +1002,7 @@ class TruncOp(IRDLOperation): """ name = "math.trunc" - fastmath: FastMathFlagsAttr | None = opt_attr_def(FastMathFlagsAttr) + fastmath: FastMathFlagsAttr | None = opt_prop_def(FastMathFlagsAttr) operand: Operand = operand_def(AnyFloat) result: OpResult = result_def(AnyFloat)