Mercurial > hg > Members > anatofuz > nqp-cbc-tools
changeset 15:6c1384a939a0
add tran2opcode.pl
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 27 Nov 2018 17:07:52 +0900 |
parents | 2e4c952bcdfb |
children | 8192d3609350 |
files | trans2opcode.pl |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trans2opcode.pl Tue Nov 27 17:07:52 2018 +0900 @@ -0,0 +1,20 @@ +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/lib"; +use OPCODE2Function; + +my $input = shift; #or die 'use input cur_op'; +chomp $input; + +if ( $input =~ /^\d+$/){ + print OPCODE2Function->codes($input)."\n"; +} else { + my $ref = OPCODE2Function->name2bitecode($input); + if (ref($ref ) eq "ARRAY"){ + map { print "$_\n";} @$ref; + } else { + print "$_\n"; + } +}