aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WebAssembly/Structure/Instructions/Instrs/Control
diff options
context:
space:
mode:
Diffstat (limited to 'src/WebAssembly/Structure/Instructions/Instrs/Control')
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php24
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php25
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php14
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php20
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Br.php20
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/BrIf.php20
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/BrTable.php24
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php20
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/CallIndirect.php21
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Else_.php15
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/End.php15
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/If_.php26
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php24
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php15
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Return_.php15
-rw-r--r--src/WebAssembly/Structure/Instructions/Instrs/Control/Unreachable.php15
16 files changed, 313 insertions, 0 deletions
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php
new file mode 100644
index 0000000..af2c97f
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Block.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Block extends Instr
+{
+ /**
+ * @param list<Instr> $body
+ */
+ protected function __construct(
+ public BlockType $type,
+ public array $body,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "block";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php
new file mode 100644
index 0000000..1188625
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockType.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType;
+
+abstract readonly class BlockType
+{
+ final public static function TypeIdx(int $type): BlockTypes\TypeIdx
+ {
+ return new BlockTypes\TypeIdx($type);
+ }
+
+ final public static function ValType(?ValType $type): BlockTypes\ValType
+ {
+ return new BlockTypes\ValType($type);
+ }
+
+ public static function opName(): string
+ {
+ return "hoge";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php
new file mode 100644
index 0000000..2ed694b
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php
@@ -0,0 +1,14 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control\BlockTypes;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control\BlockType;
+
+final readonly class TypeIdx extends BlockType
+{
+ protected function __construct(public int $inner)
+ {
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php
new file mode 100644
index 0000000..e7caa3f
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control\BlockTypes;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control\BlockType;
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType as OrigValType;
+
+final readonly class ValType extends BlockType
+{
+ protected function __construct(public ?OrigValType $inner)
+ {
+ }
+
+ public static function opName(): string
+ {
+ return "hoge";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Br.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Br.php
new file mode 100644
index 0000000..6235a36
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Br.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Br extends Instr
+{
+ protected function __construct(
+ public int $label,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "br";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/BrIf.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/BrIf.php
new file mode 100644
index 0000000..7c8a896
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/BrIf.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class BrIf extends Instr
+{
+ protected function __construct(
+ public int $label,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "br_if";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/BrTable.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/BrTable.php
new file mode 100644
index 0000000..2841814
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/BrTable.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class BrTable extends Instr
+{
+ /**
+ * @param list<int> $labelTable
+ */
+ protected function __construct(
+ public array $labelTable,
+ public int $defaultLabel,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "br_table";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php
new file mode 100644
index 0000000..461f561
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Call.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Call extends Instr
+{
+ protected function __construct(
+ public int $func,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "call";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/CallIndirect.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/CallIndirect.php
new file mode 100644
index 0000000..7017723
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/CallIndirect.php
@@ -0,0 +1,21 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class CallIndirect extends Instr
+{
+ protected function __construct(
+ public int $funcTable,
+ public int $type,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "call_indirect";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Else_.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Else_.php
new file mode 100644
index 0000000..1407543
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Else_.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Else_ extends Instr
+{
+ public static function opName(): string
+ {
+ return "else";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/End.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/End.php
new file mode 100644
index 0000000..5bdb8b9
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/End.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class End extends Instr
+{
+ public static function opName(): string
+ {
+ return "end";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/If_.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/If_.php
new file mode 100644
index 0000000..8afdc8b
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/If_.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class If_ extends Instr
+{
+ /**
+ * @param list<Instr> $thenBody
+ * @param list<Instr> $elseBody
+ */
+ protected function __construct(
+ public BlockType $type,
+ public array $thenBody,
+ public array $elseBody,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "if";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php
new file mode 100644
index 0000000..ca48ca1
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Loop.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Loop extends Instr
+{
+ /**
+ * @param list<Instr> $body
+ */
+ protected function __construct(
+ public BlockType $type,
+ public array $body,
+ ) {
+ }
+
+ public static function opName(): string
+ {
+ return "loop";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php
new file mode 100644
index 0000000..50a3773
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Nop.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Nop extends Instr
+{
+ public static function opName(): string
+ {
+ return "nop";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Return_.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Return_.php
new file mode 100644
index 0000000..b80fdfe
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Return_.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Return_ extends Instr
+{
+ public static function opName(): string
+ {
+ return "return";
+ }
+}
diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Control/Unreachable.php b/src/WebAssembly/Structure/Instructions/Instrs/Control/Unreachable.php
new file mode 100644
index 0000000..e43ade8
--- /dev/null
+++ b/src/WebAssembly/Structure/Instructions/Instrs/Control/Unreachable.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Control;
+
+use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr;
+
+final readonly class Unreachable extends Instr
+{
+ public static function opName(): string
+ {
+ return "unreachable";
+ }
+}