Wasmssa
wasmssa
¶
RefType: TypeAlias = FuncRefType | ExternRefType
module-attribute
¶
Type alias for opaque references in WebAssembly
WasmIntegerType: TypeAlias = I32 | I64
module-attribute
¶
Type alias for integer types that are supported by WebAssembly
WasmFPType: TypeAlias = Float32Type | Float64Type
module-attribute
¶
Type alias for floating-point types that are supported by WebAssembly
NumericType: TypeAlias = WasmIntegerType | WasmFPType
module-attribute
¶
Type alias for numeric types that are supported by WebAssembly
ValType: TypeAlias = I128 | NumericType | FuncRefType | ExternRefType
module-attribute
¶
Type alias for value types that are supported by WebAssembly
WasmSSA = Dialect('wasmssa', [AbsOp, AddOp, AndOp, CeilOp, ClzOp, ConstOp, ConvertSOp, ConvertUOp, CopySignOp, CtzOp, DemoteOp, DivOp, DivSIOp, DivUIOp, EqOp, EqzOp, FloorOp, ExtendLowBitsSOp, ExtendSI32Op, ExtendUI32Op, GeOp, GeSIOp, GeUIOp, GlobalGetOp, GtOp, GtSIOp, GtUIOp, LeOp, LeSIOp, LeUIOp, LtOp, LtSIOp, LtUIOp, MaxOp, MinOp, MulOp, NeOp, NegOp, OrOp, PopCntOp, RemSIOp, RemUIOp, RotlOp, RotrOp, ShLOp, ShRSOp, ShRUOp, SqrtOp, SubOp, TruncOp, PromoteOp, ReinterpretOp, WrapOp, XOrOp], [ExternRefType, FuncRefType, LimitType, LocalRefType, TableType])
module-attribute
¶
FuncRefType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Opaque type for function reference
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.funcref'
class-attribute
instance-attribute
¶
ExternRefType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Opaque type for extern reference
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.externref'
class-attribute
instance-attribute
¶
LimitType
dataclass
¶
Bases: ParametrizedAttribute, OpaqueSyntaxAttribute, TypeAttribute
Wasm limit type
Prints as !wasmssa<limit[$min: $max]>
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.limit'
class-attribute
instance-attribute
¶
min: IntAttr
instance-attribute
¶
max: IntAttr | NoneAttr
instance-attribute
¶
parse_parameters(parser: AttrParser) -> tuple[IntAttr, IntAttr | NoneAttr]
classmethod
¶
Source code in xdsl/dialects/wasmssa.py
print_parameters(printer: Printer) -> None
¶
Source code in xdsl/dialects/wasmssa.py
LocalRefType
dataclass
¶
Bases: ParametrizedAttribute, SpacedOpaqueSyntaxAttribute, TypeAttribute
Type of a local variable
Prints as !wasmssa<local ref to $elementType>
Source code in xdsl/dialects/wasmssa.py
TableType
dataclass
¶
Bases: ParametrizedAttribute, SpacedOpaqueSyntaxAttribute, TypeAttribute
Wasm table type
Prints as !wasmssa<tabletype $reference [$limit.min: $limit.max]>
Source code in xdsl/dialects/wasmssa.py
ConstOp
¶
Bases: IRDLOperation
Define a WebAssembly numeric constant.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.const'
class-attribute
instance-attribute
¶
T: ClassVar = VarConstraint.get('T', NumericType)
class-attribute
instance-attribute
¶
value = prop_def(ParamAttrConstraint(IntegerAttr, (AnyAttr(), T)) | ParamAttrConstraint(FloatAttr, (AnyAttr(), T)))
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
traits = traits_def(ConstantLike())
class-attribute
instance-attribute
¶
assembly_format = '$value attr-dict'
class-attribute
instance-attribute
¶
GlobalGetOp
¶
Bases: IRDLOperation
Return the value of a WebAssembly global.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.global_get'
class-attribute
instance-attribute
¶
global_ = prop_def(FlatSymbolRefAttrConstr, prop_name='global')
class-attribute
instance-attribute
¶
global_val = result_def(ValType)
class-attribute
instance-attribute
¶
traits = traits_def(ConstantLike())
class-attribute
instance-attribute
¶
assembly_format = '$global attr-dict `:` type($global_val)'
class-attribute
instance-attribute
¶
__init__(global_: str | SymbolRefAttr, result_type: ValType)
¶
BinaryNumericalOperation
¶
Bases: IRDLOperation, ABC, Generic[_NumericTypeInvT]
Base class for binary WebAssembly numeric operations.
Source code in xdsl/dialects/wasmssa.py
T: ClassVar = VarConstraint('T', irdl_to_attr_constraint(_NumericTypeInvT, allow_type_var=True))
class-attribute
instance-attribute
¶
lhs = operand_def(T)
class-attribute
instance-attribute
¶
rhs = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = '$lhs $rhs `:` type($lhs) attr-dict'
class-attribute
instance-attribute
¶
AddOp
dataclass
¶
Bases: BinaryNumericalOperation
Sum two WebAssembly numeric values.
Source code in xdsl/dialects/wasmssa.py
AndOp
dataclass
¶
Bases: BinaryNumericalOperation
Compute the bitwise AND between two values.
Source code in xdsl/dialects/wasmssa.py
DivOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmFPType]
Divide two floating-point values.
Source code in xdsl/dialects/wasmssa.py
DivUIOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmIntegerType]
Divide two values interpreted as unsigned integers.
Source code in xdsl/dialects/wasmssa.py
DivSIOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmIntegerType]
Divide two values interpreted as signed integers.
Source code in xdsl/dialects/wasmssa.py
MulOp
dataclass
¶
OrOp
dataclass
¶
Bases: BinaryNumericalOperation
Compute the bitwise OR between two values.
Source code in xdsl/dialects/wasmssa.py
SubOp
dataclass
¶
RemUIOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmIntegerType]
Compute the unsigned integer remainder of two values.
Source code in xdsl/dialects/wasmssa.py
RemSIOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmIntegerType]
Compute the signed integer remainder of two values.
Source code in xdsl/dialects/wasmssa.py
XOrOp
dataclass
¶
Bases: BinaryNumericalOperation
Compute the bitwise XOR between two values.
Source code in xdsl/dialects/wasmssa.py
MinOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmFPType]
Compute the minimum of two floating-point values.
Source code in xdsl/dialects/wasmssa.py
MaxOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmFPType]
Compute the maximum of two floating-point values.
Source code in xdsl/dialects/wasmssa.py
CopySignOp
dataclass
¶
Bases: BinaryNumericalOperation[WasmFPType]
Copy the sign of the second floating-point value to the first.
Source code in xdsl/dialects/wasmssa.py
BinaryComparisonOperation
¶
Bases: IRDLOperation, ABC, Generic[_NumericTypeInvT]
Base class for binary WebAssembly comparison operations.
Source code in xdsl/dialects/wasmssa.py
T: ClassVar = VarConstraint('T', irdl_to_attr_constraint(_NumericTypeInvT, allow_type_var=True))
class-attribute
instance-attribute
¶
lhs = operand_def(T)
class-attribute
instance-attribute
¶
rhs = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(I32)
class-attribute
instance-attribute
¶
assembly_format = '$lhs $rhs `:` type($lhs) `->` type($result) attr-dict'
class-attribute
instance-attribute
¶
EqOp
dataclass
¶
Bases: BinaryComparisonOperation
Check if two numeric values are equal.
Source code in xdsl/dialects/wasmssa.py
NeOp
dataclass
¶
Bases: BinaryComparisonOperation
Check if two numeric values are different.
Source code in xdsl/dialects/wasmssa.py
LtSIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if a signed integer is less than another.
Source code in xdsl/dialects/wasmssa.py
LtUIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if an unsigned integer is less than another.
Source code in xdsl/dialects/wasmssa.py
LeSIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if a signed integer is less than or equal to another.
Source code in xdsl/dialects/wasmssa.py
LeUIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if an unsigned integer is less than or equal to another.
Source code in xdsl/dialects/wasmssa.py
GtSIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if a signed integer is greater than another.
Source code in xdsl/dialects/wasmssa.py
GtUIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if an unsigned integer is greater than another.
Source code in xdsl/dialects/wasmssa.py
GeSIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if a signed integer is greater than or equal to another.
Source code in xdsl/dialects/wasmssa.py
GeUIOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmIntegerType]
Check if an unsigned integer is greater than or equal to another.
Source code in xdsl/dialects/wasmssa.py
LtOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmFPType]
Check if a floating-point value is less than another.
Source code in xdsl/dialects/wasmssa.py
LeOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmFPType]
Check if a floating-point value is less than or equal to another.
Source code in xdsl/dialects/wasmssa.py
GtOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmFPType]
Check if a floating-point value is greater than another.
Source code in xdsl/dialects/wasmssa.py
GeOp
dataclass
¶
Bases: BinaryComparisonOperation[WasmFPType]
Check if a floating-point value is greater than or equal to another.
Source code in xdsl/dialects/wasmssa.py
EqzOp
¶
Bases: IRDLOperation
Check if an integer value is equal to zero.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.eqz'
class-attribute
instance-attribute
¶
input = operand_def(WasmIntegerType)
class-attribute
instance-attribute
¶
result = result_def(I32)
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = '$input `:` type($input) `->` type($result) attr-dict'
class-attribute
instance-attribute
¶
ShiftRotateOperation
¶
Bases: IRDLOperation, ABC
Base class for WebAssembly integer shift and rotate operations.
Source code in xdsl/dialects/wasmssa.py
T: ClassVar = VarConstraint.get('T', WasmIntegerType)
class-attribute
instance-attribute
¶
val = operand_def(T)
class-attribute
instance-attribute
¶
bits = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = '$val `by` $bits `bits` `:` type($val) attr-dict'
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
ShLOp
dataclass
¶
ShRSOp
dataclass
¶
Bases: ShiftRotateOperation
Shift a signed integer value right.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.shr_s'
class-attribute
instance-attribute
¶
ShRUOp
dataclass
¶
Bases: ShiftRotateOperation
Shift an unsigned integer value right.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.shr_u'
class-attribute
instance-attribute
¶
RotlOp
dataclass
¶
RotrOp
dataclass
¶
UnaryNumericalOperation
¶
Bases: IRDLOperation, ABC, Generic[_NumericTypeInvT]
Base class for unary WebAssembly numeric operations.
Source code in xdsl/dialects/wasmssa.py
T: ClassVar = VarConstraint('T', irdl_to_attr_constraint(_NumericTypeInvT, allow_type_var=True))
class-attribute
instance-attribute
¶
src = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = '$src `:` type($src) attr-dict'
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
AbsOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmFPType]
Compute the absolute value of a floating-point value.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.abs'
class-attribute
instance-attribute
¶
CeilOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmFPType]
Round a floating-point value toward positive infinity.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.ceil'
class-attribute
instance-attribute
¶
FloorOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmFPType]
Round a floating-point value toward negative infinity.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.floor'
class-attribute
instance-attribute
¶
NegOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmFPType]
Negate a floating-point value.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.neg'
class-attribute
instance-attribute
¶
SqrtOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmFPType]
Compute the square root of a floating-point value.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.sqrt'
class-attribute
instance-attribute
¶
TruncOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmFPType]
Round a floating-point value toward zero.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.trunc'
class-attribute
instance-attribute
¶
ClzOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmIntegerType]
Count leading zeroes in an integer value.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.clz'
class-attribute
instance-attribute
¶
CtzOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmIntegerType]
Count trailing zeroes in an integer value.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.ctz'
class-attribute
instance-attribute
¶
PopCntOp
dataclass
¶
Bases: UnaryNumericalOperation[WasmIntegerType]
Count set bits in an integer value.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.popcnt'
class-attribute
instance-attribute
¶
ConversionOperation
¶
Bases: IRDLOperation, ABC, Generic[_NumericTypeInvT, _NumericResultTypeInvT]
Base class for WebAssembly conversion operations.
Source code in xdsl/dialects/wasmssa.py
input = operand_def(irdl_to_attr_constraint(_NumericTypeInvT, allow_type_var=True))
class-attribute
instance-attribute
¶
result = result_def(irdl_to_attr_constraint(_NumericResultTypeInvT, allow_type_var=True))
class-attribute
instance-attribute
¶
assembly_format = '$input `:` type($input) `to` type($result) attr-dict'
class-attribute
instance-attribute
¶
ConvertUOp
dataclass
¶
Bases: ConversionOperation[WasmIntegerType, WasmFPType]
Convert an unsigned integer value to a floating-point value.
Source code in xdsl/dialects/wasmssa.py
ConvertSOp
dataclass
¶
Bases: ConversionOperation[WasmIntegerType, WasmFPType]
Convert a signed integer value to a floating-point value.
Source code in xdsl/dialects/wasmssa.py
DemoteOp
dataclass
¶
Bases: ConversionOperation[Float64Type, Float32Type]
Convert an f64 value to f32.
Source code in xdsl/dialects/wasmssa.py
ExtendSI32Op
¶
Bases: IRDLOperation
Sign-extend an i32 value to i64.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.extend_i32_s'
class-attribute
instance-attribute
¶
input = operand_def(I32)
class-attribute
instance-attribute
¶
result = result_def(I64)
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = '$input `to` type($result) attr-dict'
class-attribute
instance-attribute
¶
ExtendUI32Op
¶
Bases: IRDLOperation
Zero-extend an i32 value to i64.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.extend_i32_u'
class-attribute
instance-attribute
¶
input = operand_def(I32)
class-attribute
instance-attribute
¶
result = result_def(I64)
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = '$input `to` type($result) attr-dict'
class-attribute
instance-attribute
¶
ExtendLowBitsSOp
¶
Bases: IRDLOperation
Sign-extend the low bits of an integer value to its full width.
Source code in xdsl/dialects/wasmssa.py
name = 'wasmssa.extend'
class-attribute
instance-attribute
¶
T: ClassVar = VarConstraint.get('T', WasmIntegerType)
class-attribute
instance-attribute
¶
input = operand_def(T)
class-attribute
instance-attribute
¶
bitsToTake = prop_def(IntegerAttr)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = '$bitsToTake `low` `bits` `from` $input `:` type($input) attr-dict'
class-attribute
instance-attribute
¶
__init__(input: SSAValue | Operation, bits_to_take: int | IntegerAttr)
¶
Source code in xdsl/dialects/wasmssa.py
verify_() -> None
¶
Source code in xdsl/dialects/wasmssa.py
PromoteOp
dataclass
¶
Bases: ConversionOperation[Float32Type, Float64Type]
Convert an f32 value to f64.
Source code in xdsl/dialects/wasmssa.py
WrapOp
dataclass
¶
Bases: ConversionOperation[I64, I32]
Wrap an i64 value to i32.
Source code in xdsl/dialects/wasmssa.py
ReinterpretOp
dataclass
¶
Bases: ConversionOperation
Reinterpret a numeric value as a different type of the same bit width.