diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-03 21:01:46 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-04 07:23:59 +0900 |
| commit | 8b689c5ff077252a68c88bc7d70990405fc8dd5a (patch) | |
| tree | 216bef1b2bd71892086a2961617bcdb7d22ea2b1 /src/Structure/Instructions/Instrs/Control | |
| parent | 996259e6a1a04f91179d2b83cc19e3fbb371cd33 (diff) | |
| download | php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.tar.gz php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.tar.zst php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.zip | |
feat: implement more instructions
Diffstat (limited to 'src/Structure/Instructions/Instrs/Control')
16 files changed, 75 insertions, 0 deletions
diff --git a/src/Structure/Instructions/Instrs/Control/Block.php b/src/Structure/Instructions/Instrs/Control/Block.php index a4842c0..29e68fd 100644 --- a/src/Structure/Instructions/Instrs/Control/Block.php +++ b/src/Structure/Instructions/Instrs/Control/Block.php @@ -16,4 +16,9 @@ final readonly class Block extends Instr public array $body, ) { } + + public static function opName(): string + { + return "block"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BlockType.php b/src/Structure/Instructions/Instrs/Control/BlockType.php index 68c6bd4..c2fe106 100644 --- a/src/Structure/Instructions/Instrs/Control/BlockType.php +++ b/src/Structure/Instructions/Instrs/Control/BlockType.php @@ -18,4 +18,9 @@ abstract readonly class BlockType { return new BlockTypes\ValType($type); } + + public static function opName(): string + { + return "hoge"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php b/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php index b633bb7..bb798e4 100644 --- a/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php +++ b/src/Structure/Instructions/Instrs/Control/BlockTypes/TypeIdx.php @@ -12,4 +12,9 @@ final readonly class TypeIdx extends BlockType protected function __construct(public OrigTypeIdx $inner) { } + + public static function opName(): string + { + return "hoge"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php b/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php index 1a56ce4..8c3880b 100644 --- a/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php +++ b/src/Structure/Instructions/Instrs/Control/BlockTypes/ValType.php @@ -12,4 +12,9 @@ final readonly class ValType extends BlockType protected function __construct(public ?OrigValType $inner) { } + + public static function opName(): string + { + return "hoge"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Br.php b/src/Structure/Instructions/Instrs/Control/Br.php index b8564a0..26af157 100644 --- a/src/Structure/Instructions/Instrs/Control/Br.php +++ b/src/Structure/Instructions/Instrs/Control/Br.php @@ -13,4 +13,9 @@ final readonly class Br extends Instr public LabelIdx $label, ) { } + + public static function opName(): string + { + return "br"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BrIf.php b/src/Structure/Instructions/Instrs/Control/BrIf.php index 980c76e..c6a4b3c 100644 --- a/src/Structure/Instructions/Instrs/Control/BrIf.php +++ b/src/Structure/Instructions/Instrs/Control/BrIf.php @@ -13,4 +13,9 @@ final readonly class BrIf extends Instr public LabelIdx $label, ) { } + + public static function opName(): string + { + return "br_if"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/BrTable.php b/src/Structure/Instructions/Instrs/Control/BrTable.php index 37f61ed..c7685f6 100644 --- a/src/Structure/Instructions/Instrs/Control/BrTable.php +++ b/src/Structure/Instructions/Instrs/Control/BrTable.php @@ -17,4 +17,9 @@ final readonly class BrTable extends Instr public LabelIdx $defaultLabel, ) { } + + public static function opName(): string + { + return "br_table"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Call.php b/src/Structure/Instructions/Instrs/Control/Call.php index 472752b..ba73037 100644 --- a/src/Structure/Instructions/Instrs/Control/Call.php +++ b/src/Structure/Instructions/Instrs/Control/Call.php @@ -13,4 +13,9 @@ final readonly class Call extends Instr public FuncIdx $func, ) { } + + public static function opName(): string + { + return "call"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/CallIndirect.php b/src/Structure/Instructions/Instrs/Control/CallIndirect.php index 6f43e06..d6fcea4 100644 --- a/src/Structure/Instructions/Instrs/Control/CallIndirect.php +++ b/src/Structure/Instructions/Instrs/Control/CallIndirect.php @@ -15,4 +15,9 @@ final readonly class CallIndirect extends Instr public TypeIdx $type, ) { } + + public static function opName(): string + { + return "call_indirect"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Else_.php b/src/Structure/Instructions/Instrs/Control/Else_.php index 665b11f..c04d571 100644 --- a/src/Structure/Instructions/Instrs/Control/Else_.php +++ b/src/Structure/Instructions/Instrs/Control/Else_.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Else_ extends Instr { + public static function opName(): string + { + return "else"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/End.php b/src/Structure/Instructions/Instrs/Control/End.php index 275dc6d..14535c0 100644 --- a/src/Structure/Instructions/Instrs/Control/End.php +++ b/src/Structure/Instructions/Instrs/Control/End.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class End extends Instr { + public static function opName(): string + { + return "end"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/If_.php b/src/Structure/Instructions/Instrs/Control/If_.php index 1eeee47..f758395 100644 --- a/src/Structure/Instructions/Instrs/Control/If_.php +++ b/src/Structure/Instructions/Instrs/Control/If_.php @@ -18,4 +18,9 @@ final readonly class If_ extends Instr public array $elseBody, ) { } + + public static function opName(): string + { + return "if"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Loop.php b/src/Structure/Instructions/Instrs/Control/Loop.php index 839f75d..1572e4b 100644 --- a/src/Structure/Instructions/Instrs/Control/Loop.php +++ b/src/Structure/Instructions/Instrs/Control/Loop.php @@ -16,4 +16,9 @@ final readonly class Loop extends Instr public array $body, ) { } + + public static function opName(): string + { + return "loop"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Nop.php b/src/Structure/Instructions/Instrs/Control/Nop.php index dbb1b6c..3aaeb4d 100644 --- a/src/Structure/Instructions/Instrs/Control/Nop.php +++ b/src/Structure/Instructions/Instrs/Control/Nop.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Nop extends Instr { + public static function opName(): string + { + return "nop"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Return_.php b/src/Structure/Instructions/Instrs/Control/Return_.php index 0322076..1391b1a 100644 --- a/src/Structure/Instructions/Instrs/Control/Return_.php +++ b/src/Structure/Instructions/Instrs/Control/Return_.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Return_ extends Instr { + public static function opName(): string + { + return "return"; + } } diff --git a/src/Structure/Instructions/Instrs/Control/Unreachable.php b/src/Structure/Instructions/Instrs/Control/Unreachable.php index 49f586b..6993099 100644 --- a/src/Structure/Instructions/Instrs/Control/Unreachable.php +++ b/src/Structure/Instructions/Instrs/Control/Unreachable.php @@ -8,4 +8,8 @@ use Nsfisis\Waddiwasi\Structure\Instructions\Instr; final readonly class Unreachable extends Instr { + public static function opName(): string + { + return "unreachable"; + } } |
