my $current_function;
my %globals;
+{ package vex_prefix; # pick up vex prefixes, example: {vex} vpmadd52luq m256, %ymm, %ymm
+ sub re {
+ my ($class, $line) = @_;
+ my $self = {};
+ my $ret;
+
+ if ($$line =~ /(^\{vex\})/) {
+ bless $self,$class;
+ $self->{value} = $1;
+ $ret = $self;
+ $$line = substr($$line,@+[0]); $$line =~ s/^\s+//;
+ }
+ $ret;
+ }
+ sub out {
+ my $self = shift;
+ $self->{value};
+ }
+}
{ package opcode; # pick up opcodes
sub re {
my ($class, $line) = @_;
if (my $directive=directive->re(\$line)) {
printf "%s",$directive->out();
- } elsif (my $opcode=opcode->re(\$line)) {
+ } else {
+ if (my $vex_prefix=vex_prefix->re(\$line)) {
+ printf "%s",$vex_prefix->out();
+ }
+ if (my $opcode=opcode->re(\$line)) {
my $asm = eval("\$".$opcode->mnemonic());
if ((ref($asm) eq 'CODE') && scalar(my @bytes=&$asm($line))) {
} else {
printf "\t%s",$opcode->out();
}
+ }
}
print $line,"\n";