MLIR

Multi-Level IR Compiler Framework

'wasmssa' Dialect

The wasmssa dialect is intended to represent WebAssembly modules in SSA form for easier manipulation.

Operations 

source

wasmssa.abs (wasmssa::AbsOp) 

Floating point absolute value

Syntax:

operation ::= `wasmssa.abs` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.abs %b : f32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.add (wasmssa::AddOp) 

Sum two values

Syntax:

operation ::= `wasmssa.add` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.add %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.and (wasmssa::AndOp) 

Compute the bitwise AND between two values

Syntax:

operation ::= `wasmssa.and` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.and %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.block (wasmssa::BlockOp) 

Create a nesting level with a label at its exit.

Syntax:

operation ::= `wasmssa.block` (`(`$inputs^`)` `:` type($inputs))? attr-dict  `:` $body `>` $target

Defines a Wasm block, creating a new nested scope. A block contains a body region and an optional list of input values. Control can enter the block and later branch out to the block target. Example:


wasmssa.block {

  // instructions

} > ^successor

Traits: `Terminator`

Interfaces: `LabelLevelOpInterface`

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `inputs` | variadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference |

#### Successors:

| Successor | Description |
| :-------: | ----------- |
| `target` | any successor |



### `wasmssa.block_return` (wasmssa::BlockReturnOp)

_Return from the current block_

Syntax:

operation ::= wasmssa.block_return ($inputs^ : type($inputs))? attr-dict


Escape from the current nesting level and return the control flow to its successor.
Optionally, mark the arguments that should be transfered to the successor block.

This shouldn't be confused with branch operations that targets the label defined
by the nesting level operation.

For instance, a `wasmssa.block_return` in a loop will give back control to the
successor of the loop, where a `branch` targeting the loop will flow back to the entry block of the loop.

Example:

```mlir
  wasmssa.block_return

Traits: Terminator

Interfaces: LabelBranchingOpInterface

Operands: 

OperandDescription
inputsvariadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.branch_if (wasmssa::BranchIfOp) 

Jump to target level if condition has non-zero value

Syntax:

operation ::= `wasmssa.branch_if` $condition `to` `level` $exitLevel (`with` `args`  `(`$inputs^ `:` type($inputs)`)`)?  `else` $elseSuccessor  attr-dict

Jump to target level if the condition is has a non-zero value.

Example:

wasmssa.branch_if %a to level 0 with args(%b : i32) else ^bb1

Traits: Terminator

Interfaces: LabelBranchingOpInterface

Attributes: 

AttributeMLIR TypeDescription
exitLevel::mlir::IntegerAttr32-bit unsigned integer attribute

Operands: 

OperandDescription
condition32-bit signless integer
inputsvariadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

Successors: 

SuccessorDescription
elseSuccessorany successor

wasmssa.call (wasmssa::FuncCallOp) 

Calling a Wasm function

Syntax:

operation ::= `wasmssa.call` $callee (`(`$operands^`)`)? attr-dict `:` functional-type($operands, $results)

Emits a call to a defined function

Example:

%a = wasmssa.call @func_0 : () -> i32

Attributes: 

AttributeMLIR TypeDescription
callee::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands: 

OperandDescription
operandsvariadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

Results: 

ResultDescription
resultsvariadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.ceil (wasmssa::CeilOp) 

Ceil rounding of floating point value

Syntax:

operation ::= `wasmssa.ceil` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.ceil %b : f32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.clz (wasmssa::ClzOp) 

Count leading zeroes of an integer

Syntax:

operation ::= `wasmssa.clz` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.clz %b : i32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.const (wasmssa::ConstOp) 

Operator that represents a constant value

Syntax:

operation ::= `wasmssa.const` $value attr-dict

Defines a constant value.

Example:

// Example of integer constant
%a = wasmssa.const 1 : i32

// Example of floating point constant
%b = wasmssa.const 9.000000e+00 : f64

Traits: ConstantExprOpTrait

Interfaces: InferTypeOpInterface

Attributes: 

AttributeMLIR TypeDescription
value::mlir::TypedAttr
TypedAttr instance
This interface is used for attributes that have a type. The type of an
attribute is understood to represent the type of the data contained in the
attribute and is often used as the type of a value with this data.

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.convert_s (wasmssa::ConvertSOp) 

_Convert integer interpreted as 2’s complement signed value to floating-point value.

Consume an integer and produces a floating point value containing the rounded value of the original operand. Rounding is round to nearest, tie to even._

Syntax:

operation ::= `wasmssa.convert_s` $input `:` type($input) `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.convert_s %b : i32 to f64
```

Operands: 

OperandDescription
input32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.convert_u (wasmssa::ConvertUOp) 

_Convert integer, interpreted as binary encoded positive value, to floating-point value.

Consume an integer and produces a floating point value containing the rounded value of the original operand. Rounding is round to nearest, tie to even._

Syntax:

operation ::= `wasmssa.convert_u` $input `:` type($input) `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.convert_u %b : i32 to f64
```

Operands: 

OperandDescription
input32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.copysign (wasmssa::CopySignOp) 

Copy sign from one floating point value to the other.

Syntax:

operation ::= `wasmssa.copysign` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.copysign %b %c : f32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit float or 64-bit float
rhs32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.ctz (wasmssa::CtzOp) 

Count trailing zeroes of an integer

Syntax:

operation ::= `wasmssa.ctz` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.ctz %b : i32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.demote (wasmssa::DemoteOp) 

Convert a f64 value to f32

Syntax:

operation ::= `wasmssa.demote` $input `:` type($input) `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.demote %b : f64 to f32
```

Operands: 

OperandDescription
input64-bit float

Results: 

ResultDescription
result32-bit float

wasmssa.div (wasmssa::DivOp) 

Division between floating point values

Syntax:

operation ::= `wasmssa.div` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.div %b %c : f32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit float or 64-bit float
rhs32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.div_si (wasmssa::DivSIOp) 

Divide values interpreted as signed int

Syntax:

operation ::= `wasmssa.div_si` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.div_si %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.div_ui (wasmssa::DivUIOp) 

Divide values interpreted as unsigned int

Syntax:

operation ::= `wasmssa.div_ui` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.div_ui %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.eq (wasmssa::EqOp) 

Check if two values are equal

Syntax:

operation ::= `wasmssa.eq` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.eq %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer

wasmssa.eqz (wasmssa::EqzOp) 

Check if the given value is equal to zero

Syntax:

operation ::= `wasmssa.eqz` $input`:` type($input) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.eqz %b : i64 -> i32
 ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
input32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.extend (wasmssa::ExtendLowBitsSOp) 

Syntax:

operation ::= `wasmssa.extend` $bitsToTake `low` `bits` `from` $input `:` type($input) attr-dict

Extend low bytes of a value to fit a given width. For instance, signed extension from 8 low bits of the 32-bits integer value 254 (0x000000FE) would produce the value -2 (0xFFFFFFFE).

This corresponds to the extendnn instruction of Wasm, which shouldn’t be confused with the extend_inn Wasm instruction, for which all input bits are used and widened to wider output type. In this operation, input and output types are the same.

Example:

%a = wasmssa.extend 16 low bits from %[[VAL_0]]: i64

Interfaces: InferTypeOpInterface

Attributes: 

AttributeMLIR TypeDescription
bitsToTake::mlir::IntegerAttr
An Attribute containing a integer value
Syntax:
integer-attribute ::= (integer-literal ( `:` (index-type | integer-type) )?)
                      | `true` | `false`

An integer attribute is a literal attribute that represents an integral value of the specified integer or index type. i1 integer attributes are treated as boolean attributes, and use a unique assembly format of either true or false depending on the value. The default type for non-boolean integer attributes, if a type is not specified, is signless 64-bit integer.

Examples:

10 : i32
10    // : i64 is implied here.
true  // A bool, i.e. i1, value.
false // A bool, i.e. i1, value.

Operands: 

OperandDescription
input32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.extend_i32_s (wasmssa::ExtendSI32Op) 

Sign extend i32 to i64.

Syntax:

operation ::= `wasmssa.extend_i32_s` $input `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.extend_i32_s %b to i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
input32-bit signless integer

Results: 

ResultDescription
result64-bit signless integer

wasmssa.extend_i32_u (wasmssa::ExtendUI32Op) 

Zero extend i32 to i64.

Syntax:

operation ::= `wasmssa.extend_i32_u` $input `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.extend_i32_s %b to i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
input32-bit signless integer

Results: 

ResultDescription
result64-bit signless integer

wasmssa.floor (wasmssa::FloorOp) 

Floor rounding of floating point value

Syntax:

operation ::= `wasmssa.floor` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.floor %b : f32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.func (wasmssa::FuncOp) 

Represents a Wasm function definition.

In Wasm function, locals and function arguments are interchangeable. They are for instance both accessed using local.get instruction.

On the other hand, a function type is defined as a pair of tuples of Wasm value types. To model this, the wasm.func operation has:

  • A function type that represents the corresponding Wasm type (tuples of value types)

  • Arguments of the entry block of type !wasm<local T>, with T the corresponding type in the function type.

By default, wasmssa.func have nested visibility. Functions exported by the module are marked with the exported attribute. This gives them public visibility.

Example:

// Internal function with no arguments that returns a float32
wasmssa.func @my_f32_func() -> f32

// Exported function with no arguments that returns a float32
wasmssa.func exported @my_f32_func() -> f32

// A function that takes a local ref argument
wasmssa.func @i64_wrap(%a: !wasmssa<local ref to i64>) -> i32

Traits: AffineScope, AutomaticAllocationScope, IsolatedFromAbove

Interfaces: ArgAndResultAttrsOpInterface, CallableOpInterface, FunctionOpInterface, Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
functionType::mlir::TypeAttrtype attribute of function type
arg_attrs::mlir::ArrayAttrArray of dictionary attributes
res_attrs::mlir::ArrayAttrArray of dictionary attributes
exported::mlir::UnitAttrunit attribute

wasmssa.ge (wasmssa::GeOp) 

Check if a float value is greater or equal to another

Syntax:

operation ::= `wasmssa.ge` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.ge %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit float or 64-bit float
rhs32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer

wasmssa.ge_si (wasmssa::GeSIOp) 

Check if a signed integer value is greater or equal to another

Syntax:

operation ::= `wasmssa.ge_si` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.ge_si %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.ge_ui (wasmssa::GeUIOp) 

Check if an unsigned integer value is greater or equal to another

Syntax:

operation ::= `wasmssa.ge_ui` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.ge_ui %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.global (wasmssa::GlobalOp) 

WebAssembly global value

WebAssembly global variable. Body contains the initialization instructions for the variable value. The body must contain only instructions considered const in a webassembly context, such as wasmssa.const or global.get.

By default, wasmssa.global have nested visibility. Global exported by the module are marked with the exported attribute. This gives them public visibility.

Example:

// Define module_global_var, an internal mutable i32 global variable equal to 10.
wasmssa.global @module_global_var i32 mutable : {
      %[[VAL_0:.*]] = wasmssa.const 10 : i32
      wasmssa.return %[[VAL_0]] : i32
}

// Define global_var, an exported constant i32 global variable equal to 42.
wasmssa.global @global_var i32 : {
      %[[VAL_0:.*]] = wasmssa.const 42 : i32
      wasmssa.return %[[VAL_0]] : i32
}

Traits: AffineScope, AutomaticAllocationScope, ConstantExpressionInitializerOpTrait, IsolatedFromAbove

Interfaces: Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
type::mlir::TypeAttrtype attribute of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference
isMutable::mlir::UnitAttrunit attribute
exported::mlir::UnitAttrunit attribute

wasmssa.global_get (wasmssa::GlobalGetOp) 

Returns the value of the global passed as argument.

Syntax:

operation ::= `wasmssa.global_get` $global attr-dict `:` type($global_val)

Retrieves the value of the global passed as argument and stores it in a variable

Example:

// Gets the value of `@global_0` and stores its value in %a
%a = wasmssa.global_get @global_0 : i32

Traits: ConstantExprOpTrait

Interfaces: SymbolUserOpInterface

Attributes: 

AttributeMLIR TypeDescription
global::mlir::FlatSymbolRefAttrflat symbol reference attribute

Results: 

ResultDescription
global_val32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.gt (wasmssa::GtOp) 

Check if a float value is greater than another

Syntax:

operation ::= `wasmssa.gt` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.gt %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit float or 64-bit float
rhs32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer

wasmssa.gt_si (wasmssa::GtSIOp) 

Check if a signed integer value is greater than another

Syntax:

operation ::= `wasmssa.gt_si` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.gt_si %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.gt_ui (wasmssa::GtUIOp) 

Check if an unsigned integer value is greater than another

Syntax:

operation ::= `wasmssa.gt_ui` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.gt_ui %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.if (wasmssa::IfOp) 

Execute the if region if condition value is non-zero, the else region otherwise.

Syntax:

operation ::= `wasmssa.if` $condition (`(`$inputs^`)` `:` type($inputs))? attr-dict  `:` $if custom<ElseRegion>($else) `>` $target

Execute the if region if the condition is non-zero. Otherwise the else region is executed. The else region can be empty but must return the same datatype as the if region. If clauses can be nested.

Example:

// Runs the if clause is %a is non-zero
wasmssa.if %a {
   // Execute if %a is non-zero
} else {
   // else clause
}

Traits: Terminator

Interfaces: LabelLevelOpInterface

Operands: 

OperandDescription
condition32-bit signless integer
inputsvariadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

Successors: 

SuccessorDescription
targetany successor

wasmssa.import_func (wasmssa::FuncImportOp) 

Importing a function variable

Syntax:

operation ::= `wasmssa.import_func` $importName `from` $moduleName `as` $sym_name attr-dict

Imports a function from another module

Example:

// Imports foo(i32) -> () from the module my_module
wasmssa.import_func "foo" from "my_module" as @func_0 {sym_visibility = "nested", type = (i32) -> ()}

Interfaces: ArgAndResultAttrsOpInterface, CallableOpInterface, ImportOpInterface, Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
moduleName::mlir::StringAttrstring attribute
importName::mlir::StringAttrstring attribute
type::mlir::TypeAttrtype attribute of function type
arg_attrs::mlir::ArrayAttrArray of dictionary attributes
res_attrs::mlir::ArrayAttrArray of dictionary attributes

wasmssa.import_global (wasmssa::GlobalImportOp) 

Importing a global variable

Imports a global from another module

Example:

// Imports the "glob" i32 global from the module my_module as "global_0"
wasmssa.import_global "glob" from "my_module" as @global_0 nested : i32

Interfaces: ImportOpInterface, Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
moduleName::mlir::StringAttrstring attribute
importName::mlir::StringAttrstring attribute
type::mlir::TypeAttrtype attribute of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference
isMutable::mlir::UnitAttrunit attribute

wasmssa.import_mem (wasmssa::MemImportOp) 

Importing a memory

Syntax:

operation ::= `wasmssa.import_mem` $importName `from` $moduleName `as` $sym_name attr-dict

Import a memory from another module.

Example:

// Import the memory `mem` from `my_module` as @mem_0
wasmssa.import_mem "mem" from "my_module" as @mem_0 {limits = !wasmssa<limit[2:]>}

Interfaces: ImportOpInterface, Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
moduleName::mlir::StringAttrstring attribute
importName::mlir::StringAttrstring attribute
limits::mlir::TypeAttrtype attribute of Wasm limit type

wasmssa.import_table (wasmssa::TableImportOp) 

Importing a table

Syntax:

operation ::= `wasmssa.import_table` $importName `from` $moduleName `as` $sym_name attr-dict

Import a table from another module.

Example:

// Import the table `table` from `my_module` as @table_0
wasmssa.import_table "table" from "my_module" as @table_0 {type = !wasmssa<tabletype !wasmssa.funcref [2:]>}

Interfaces: ImportOpInterface, Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
moduleName::mlir::StringAttrstring attribute
importName::mlir::StringAttrstring attribute
type::mlir::TypeAttrtype attribute of Wasm table type

wasmssa.le (wasmssa::LeOp) 

Check if a float value is less or equal to another

Syntax:

operation ::= `wasmssa.le` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.le %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit float or 64-bit float
rhs32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer

wasmssa.le_si (wasmssa::LeSIOp) 

Check if a signed integer value is less or equal to another

Syntax:

operation ::= `wasmssa.le_si` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.le_si %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.le_ui (wasmssa::LeUIOp) 

Check if an unsigned integer value is less or equal to another

Syntax:

operation ::= `wasmssa.le_ui` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.le_ui %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.local (wasmssa::LocalOp) 

Declaration of local variable

Syntax:

operation ::= `wasmssa.local` `of` `type` $type attr-dict

Declares a local variable

Example:

// Declares `%a`, a float32 local
%a = wasmssa.local of type f32

Interfaces: InferTypeOpInterface

Attributes: 

AttributeMLIR TypeDescription
type::mlir::TypeAttrtype attribute of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

Results: 

ResultDescription
resultType of a local variable

wasmssa.local_get (wasmssa::LocalGetOp) 

Set local to value and return the operand.

Syntax:

operation ::= `wasmssa.local_get` $localVar `:` type($localVar) attr-dict

Gets the value of a local variable and returns a reference to it.

Example:

// Retrieves a reference to `%a`, a float32 local
%b = wasmssa.local_get %a : ref to f32

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
localVarType of a local variable

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.local_set (wasmssa::LocalSetOp) 

Set local to given value

Syntax:

operation ::= `wasmssa.local_set` $localVar `:` type($localVar) `to` $value `:` type($value) attr-dict

Sets the value of a local variable.

Example:

// Sets `%d`, to the value of `%c`
wasmssa.local_set %d :  ref to i32 to %c : i32

Operands: 

OperandDescription
localVarType of a local variable
value32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.local_tee (wasmssa::LocalTeeOp) 

Set local to value and return the operand.

Syntax:

operation ::= `wasmssa.local_tee` $localVar `:` type($localVar) `to` $value `:` type($value) attr-dict

Sets the value of a local variable and returns it.

Example:

// Sets `%b`, to the value of `%c` and returns it in %a
 %a = wasmssa.local_tee %b :  ref to i32 to %c : i32

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
localVarType of a local variable
value32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.loop (wasmssa::LoopOp) 

Create a nesting level that define its entry as jump target.

Syntax:

operation ::= `wasmssa.loop` (`(`$inputs^`)` `:` type($inputs))? attr-dict  `:` $body `>` $target

Represents a Wasm loop construct. This defines a nesting level with a label at the entry of the region.

Example:


wasmssa.loop {

} > ^successor

Traits: `Terminator`

Interfaces: `LabelLevelOpInterface`

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `inputs` | variadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference |

#### Successors:

| Successor | Description |
| :-------: | ----------- |
| `target` | any successor |



### `wasmssa.lt` (wasmssa::LtOp)

_Check if a float value is less than another_

Syntax:

operation ::= wasmssa.lt $lhs $rhs : type($lhs) -> type($result) attr-dict


Example:

     ```mlir
     %a = wasmssa.lt %b %c : i32
    ```

Interfaces: `InferTypeOpInterface`

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `lhs` | 32-bit float or 64-bit float |
| `rhs` | 32-bit float or 64-bit float |

#### Results:

| Result | Description |
| :----: | ----------- |
| `result` | 32-bit signless integer |



### `wasmssa.lt_si` (wasmssa::LtSIOp)

_Check if a signed integer value is less than another_

Syntax:

operation ::= wasmssa.lt_si $lhs $rhs : type($lhs) -> type($result) attr-dict


Example:

     ```mlir
     %a = wasmssa.lt_si %b %c : i32
    ```

Interfaces: `InferTypeOpInterface`

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `lhs` | 32-bit signless integer or 64-bit signless integer |
| `rhs` | 32-bit signless integer or 64-bit signless integer |

#### Results:

| Result | Description |
| :----: | ----------- |
| `result` | 32-bit signless integer |



### `wasmssa.lt_ui` (wasmssa::LtUIOp)

_Check if an unsigned integer value is less than another_

Syntax:

operation ::= wasmssa.lt_ui $lhs $rhs : type($lhs) -> type($result) attr-dict


Example:

     ```mlir
     %a = wasmssa.lt_ui %b %c : i32
    ```

Interfaces: `InferTypeOpInterface`

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `lhs` | 32-bit signless integer or 64-bit signless integer |
| `rhs` | 32-bit signless integer or 64-bit signless integer |

#### Results:

| Result | Description |
| :----: | ----------- |
| `result` | 32-bit signless integer |



### `wasmssa.max` (wasmssa::MaxOp)

_Compute the minimum of two floating point values._

Syntax:

operation ::= wasmssa.max $lhs $rhs : type($lhs) attr-dict


Example:

     ```mlir
     %a = wasmssa.max %b %c : f32
    ```

Interfaces: `InferTypeOpInterface`

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `lhs` | 32-bit float or 64-bit float |
| `rhs` | 32-bit float or 64-bit float |

#### Results:

| Result | Description |
| :----: | ----------- |
| `result` | 32-bit float or 64-bit float |



### `wasmssa.memory` (wasmssa::MemOp)

_WebAssembly memory definition_

Syntax:

operation ::= wasmssa.memory (exported $exported^)? $sym_name $limits attr-dict


Define a memory to be used by the program.
Multiple memories can be defined in the same module.

By default, `wasmssa.memory` have nested visibility. Memory exported by
the module are marked with the exported attribute. This gives them public
visibility.

 Example:

 ```mlir
 // Define the `mem_0` (internal)  memory with defined size bounds of [0:65536]
 wasmssa.memory @mem_0 !wasmssa<limit[0:65536]>

 // Define the `mem_1` exported  memory with minimal size of 512
 wasmssa.memory exported @mem_1 !wasmssa<limit[512:]>

Interfaces: Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
limits::mlir::TypeAttrtype attribute of Wasm limit type
exported::mlir::UnitAttrunit attribute

wasmssa.min (wasmssa::MinOp) 

Compute the minimum of two floating point values.

Syntax:

operation ::= `wasmssa.min` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.min %b %c : f32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit float or 64-bit float
rhs32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.mul (wasmssa::MulOp) 

Multiply two values

Syntax:

operation ::= `wasmssa.mul` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.mul %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.ne (wasmssa::NeOp) 

Check if two values are different

Syntax:

operation ::= `wasmssa.ne` $lhs $rhs `:` type($lhs) `->` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.ne %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer

wasmssa.neg (wasmssa::NegOp) 

Floating point negation

Syntax:

operation ::= `wasmssa.neg` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.neg %b : f32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.or (wasmssa::OrOp) 

Compute the bitwise OR of two values

Syntax:

operation ::= `wasmssa.or` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.or %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.popcnt (wasmssa::PopCntOp) 

Population count of an integer.

Syntax:

operation ::= `wasmssa.popcnt` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.popcnt %b : i32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.promote (wasmssa::PromoteOp) 

Get f64 representation of a f32 value.

Syntax:

operation ::= `wasmssa.promote` $input `:` type($input) `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.promote %b : f32 to f64
 ```

Operands: 

OperandDescription
input32-bit floating-point type

Results: 

ResultDescription
result64-bit floating-point type

wasmssa.reinterpret (wasmssa::ReinterpretOp) 

Reinterpret the value represented by a bit vector by bit-casting it to another type of same representation width.

Syntax:

operation ::= `wasmssa.reinterpret` $input `:` type($input) `as` type($result) attr-dict

Example:

 ```mlir
 %a = wasmssa.reinterpret %b : f32 as i32
 ```

Operands: 

OperandDescription
input32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.rem_si (wasmssa::RemSIOp) 

Calculate the remainder of dividing two integer values as signed integer

Syntax:

operation ::= `wasmssa.rem_si` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.rem_si %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.rem_ui (wasmssa::RemUIOp) 

Calculate the remainder of dividing two integer values as an unsigned integer

Syntax:

operation ::= `wasmssa.rem_ui` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.rem_ui %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer
rhs32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.return (wasmssa::ReturnOp) 

Return from the current function frame

Syntax:

operation ::= `wasmssa.return` attr-dict ($operands^ `:` type($operands))?

Traits: Terminator

Operands: 

OperandDescription
operandsvariadic of 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

wasmssa.rotl (wasmssa::RotlOp) 

_Rotate left.

Consume an integer and an integer rotate. The first
integer shall be rotated left by N bits, where N is the value of the
second integer._

Syntax:

operation ::= `wasmssa.rotl` $val `by` $bits `bits` `:` type($val) attr-dict

Example:

 ```mlir
 %a = wasmssa.rotl %b by %c bits : i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
val32-bit signless integer or 64-bit signless integer
bits32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.rotr (wasmssa::RotrOp) 

_Rotate right.

Consume an integer, and an integer rotate. The first
integer shall be rotated right by N bits, where N is the value of the
second integer._

Syntax:

operation ::= `wasmssa.rotr` $val `by` $bits `bits` `:` type($val) attr-dict

Example:

 ```mlir
 %a = wasmssa.rotr %b by %c bits : i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
val32-bit signless integer or 64-bit signless integer
bits32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.shl (wasmssa::ShLOp) 

Consume an integer and an integer shift amount. The first integer shall be shifted left by N bits, where N is the value of the second integer.

Syntax:

operation ::= `wasmssa.shl` $val `by` $bits `bits` `:` type($val) attr-dict

Example:

 ```mlir
 %a = wasmssa.shl %b by %c bits : i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
val32-bit signless integer or 64-bit signless integer
bits32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.shr_s (wasmssa::ShRSOp) 

_Arithmetic right shift.

Consume an integer and an integer shift amount. The first
integer shall be shifted right by N bits, where N is the value of the
second integer.

Vacated bits on the left shall be filled with the sign bit._

Syntax:

operation ::= `wasmssa.shr_s` $val `by` $bits `bits` `:` type($val) attr-dict

Example:

 ```mlir
 %a = wasmssa.shr_s %b by %c bits : i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
val32-bit signless integer or 64-bit signless integer
bits32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.shr_u (wasmssa::ShRUOp) 

_Logical right shift.

Consume an integer, and an integer shift amount. The first
integer shall be shifted right by N bits, where N is the value of the
second integer.

Vacated bits on the left shall be filled with zeroes._

Syntax:

operation ::= `wasmssa.shr_u` $val `by` $bits `bits` `:` type($val) attr-dict

Example:

 ```mlir
 %a = wasmssa.shr_u %b by %c bits : i64
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
val32-bit signless integer or 64-bit signless integer
bits32-bit signless integer or 64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer

wasmssa.sqrt (wasmssa::SqrtOp) 

Floating point square root

Syntax:

operation ::= `wasmssa.sqrt` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.sqrt %b : f32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.sub (wasmssa::SubOp) 

Subtract two values

Syntax:

operation ::= `wasmssa.sub` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.sub %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

wasmssa.table (wasmssa::TableOp) 

WebAssembly table value

Syntax:

operation ::= `wasmssa.table` (`exported` $exported^)? $sym_name $type attr-dict

Interfaces: Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
type::mlir::TypeAttrtype attribute of Wasm table type
exported::mlir::UnitAttrunit attribute

wasmssa.trunc (wasmssa::TruncOp) 

Trunc of floating point value

Syntax:

operation ::= `wasmssa.trunc` $src`:` type($src) attr-dict

Example:

                                     ```mlir
                                     %a = wasmssa.trunc %b : f32
                                     ```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
src32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit float or 64-bit float

wasmssa.wrap (wasmssa::WrapOp) 

Cast an i64 to i32 by using a wrapping mechanism: y = x mod 2^32

Syntax:

operation ::= `wasmssa.wrap` $input `:` type($input) `to` type($result)  attr-dict

Example:

 ```mlir
 %a = wasmssa.wrap %b : i64 to i32
 ```

Operands: 

OperandDescription
input64-bit signless integer

Results: 

ResultDescription
result32-bit signless integer

wasmssa.xor (wasmssa::XOrOp) 

Compute the bitwise XOR of two values

Syntax:

operation ::= `wasmssa.xor` $lhs $rhs `:` type($lhs) attr-dict

Example:

 ```mlir
 %a = wasmssa.xor %b %c : i32
```

Interfaces: InferTypeOpInterface

Operands: 

OperandDescription
lhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float
rhs32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Results: 

ResultDescription
result32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float

Types 

ExternRefType 

Opaque type for external reference

Syntax: !wasmssa.externref

FuncRefType 

Opaque type for function reference

Syntax: !wasmssa.funcref

LimitType 

Wasm limit type

Syntax:

!wasmssa.limit<
  uint32_t,   # min
  std::optional<uint32_t>   # max
>

Parameters: 

ParameterC++ typeDescription
minuint32_t
maxstd::optional<uint32_t>

LocalRefType 

Type of a local variable

Syntax:

!wasmssa.local<
  ::mlir::Type   # elementType
>

Parameters: 

ParameterC++ typeDescription
elementType::mlir::Type32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float or 128-bit signless integer or Opaque type for function reference or Opaque type for external reference

TableType 

Wasm table type

Syntax:

!wasmssa.tabletype<
  ::mlir::Type,   # reference
  ::mlir::wasmssa::LimitType   # limit
>

Parameters: 

ParameterC++ typeDescription
reference::mlir::TypeOpaque type for function reference or Opaque type for external reference
limit::mlir::wasmssa::LimitTypeWasm limit type