[WebAssembly] Fixup order of ins variables for table instructions
authorPaulo Matos <pmatos@igalia.com>
Mon, 3 May 2021 20:04:50 +0000 (13:04 -0700)
committerThomas Lively <tlively@google.com>
Mon, 3 May 2021 20:04:51 +0000 (13:04 -0700)
WebAssembly instruction arguments should have their arguments ordered from
the deepest to the shallowest on the stack.

llvm/lib/Target/WebAssembly/WebAssemblyInstrTable.td

index 97638c3..8fa80ad 100644 (file)
@@ -20,24 +20,24 @@ multiclass TABLE<WebAssemblyRegClass rt> {
                          "table.get\t$table",
                          0x25>;
 
-  defm TABLE_SET_#rt : I<(outs), (ins table32_op:$table, rt:$val, I32:$i),
+  defm TABLE_SET_#rt : I<(outs), (ins table32_op:$table, I32:$i, rt:$val),
                          (outs), (ins table32_op:$table),
                          [],
-                         "table.set\t$table, $val, $i",
+                         "table.set\t$table, $i, $val",
                          "table.set\t$table",
                          0x26>;
 
-  defm TABLE_GROW_#rt : I<(outs I32:$sz), (ins table32_op:$table, I32:$n, rt:$val),
+  defm TABLE_GROW_#rt : I<(outs I32:$sz), (ins table32_op:$table, rt:$val, I32:$n),
                           (outs), (ins table32_op:$table),
                           [],
-                          "table.grow\t$sz, $table, $n, $val",
+                          "table.grow\t$sz, $table, $val, $n",
                           "table.grow\t$table",
                           0xfc0f>;
 
-  defm TABLE_FILL_#rt : I<(outs), (ins table32_op:$table, I32:$n, rt:$val, I32:$i),
+  defm TABLE_FILL_#rt : I<(outs), (ins table32_op:$table, I32:$i, rt:$val, I32:$n),
                           (outs), (ins table32_op:$table),
                           [],
-                          "table.fill\t$table, $n, $val, $i",
+                          "table.fill\t$table, $i, $val, $n",
                           "table.fill\t$table",
                           0xfc11>;
 
@@ -55,10 +55,10 @@ defm TABLE_SIZE : I<(outs I32:$sz), (ins table32_op:$table),
                     Requires<[HasReferenceTypes]>;
 
 
-defm TABLE_COPY : I<(outs), (ins table32_op:$table1, table32_op:$table2, I32:$n, I32:$s, I32:$d),
+defm TABLE_COPY : I<(outs), (ins table32_op:$table1, table32_op:$table2, I32:$d, I32:$s, I32:$n),
                     (outs), (ins table32_op:$table1, table32_op:$table2),
                     [],
-                    "table.copy\t$table1, $table2, $n, $s, $d",
+                    "table.copy\t$table1, $table2, $d, $s, $n",
                     "table.copy\t$table1, $table2",
                     0xfc0e>,
                     Requires<[HasReferenceTypes]>;