Lines Matching refs:self
224 my $self = {};
228 bless $self,$class;
229 $self->{op} = $1;
230 $ret = $self;
233 undef $self->{sz};
234 if ($self->{op} =~ /^(movz)x?([bw]).*/) { # movz is pain...
235 $self->{op} = $1;
236 $self->{sz} = $2;
237 } elsif ($self->{op} =~ /call|jmp/) {
238 $self->{sz} = "";
239 } elsif ($self->{op} =~ /^p/ && $' !~ /^(ush|op|insrw)/) { # SSEn
240 $self->{sz} = "";
241 } elsif ($self->{op} =~ /^[vk]/) { # VEX or k* such as kmov
242 $self->{sz} = "";
243 } elsif ($self->{op} =~ /mov[dq]/ && $$line =~ /%xmm/) {
244 $self->{sz} = "";
245 } elsif ($self->{op} =~ /([a-z]{3,})([qlwb])$/) {
246 $self->{op} = $1;
247 $self->{sz} = $2;
253 my ($self, $sz) = @_;
254 $self->{sz} = $sz if (defined($sz) && !defined($self->{sz}));
255 $self->{sz};
258 my $self = shift;
260 if ($self->{op} eq "movz") { # movz is pain...
261 sprintf "%s%s%s",$self->{op},$self->{sz},shift;
262 } elsif ($self->{op} =~ /^set/) {
263 "$self->{op}";
264 } elsif ($self->{op} eq "ret") {
271 } elsif ($self->{op} eq "call" && !$elf && $current_segment eq ".init") {
274 "$self->{op}$self->{sz}";
277 $self->{op} =~ s/^movz/movzx/;
278 if ($self->{op} eq "ret") {
279 $self->{op} = "";
281 $self->{op} = "mov rdi,QWORD$PTR\[8+rsp\]\t;WIN64 epilogue\n\t".
284 $self->{op} .= "DB\t0F3h,0C3h\t\t;repret";
285 } elsif ($self->{op} =~ /^(pop|push)f/) {
286 $self->{op} .= $self->{sz};
287 } elsif ($self->{op} eq "call" && $current_segment eq ".CRT\$XCU") {
288 $self->{op} = "\tDQ";
290 $self->{op};
294 my ($self, $op) = @_;
295 $self->{op}=$op if (defined($op));
296 $self->{op};
302 my $self = {};
306 bless $self, $class;
307 $self->{value} = $1;
308 $ret = $self;
314 my $self = shift;
316 $self->{value} =~ s/\b(0b[0-1]+)/oct($1)/eig;
320 my $value = $self->{value};
324 $self->{value} = $value;
326 sprintf "\$%s",$self->{value};
328 my $value = $self->{value};
344 my $self = {};
349 bless $self, $class;
350 $self->{asterisk} = $1;
351 $self->{label} = $2;
352 ($self->{base},$self->{index},$self->{scale})=split(/,/,$3);
353 $self->{scale} = 1 if (!defined($self->{scale}));
354 $self->{opmask} = $4;
355 $ret = $self;
358 if ($win64 && $self->{label} =~ s/\@GOTPCREL//) {
362 $self->{base} =~ s/^%//;
363 $self->{index} =~ s/^%// if (defined($self->{index}));
364 $self->{opcode} = $opcode;
370 my ($self, $sz) = @_;
372 $self->{label} =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
373 $self->{label} =~ s/\.L/$decor/g;
378 $self->{index} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/;
379 $self->{base} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/;
384 $self->{label} =~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi;
385 $self->{label} =~ s/\b([0-9]+\s*[\*\/\%]\s*[0-9]+)\b/eval($1)/eg;
390 $self->{label} =~ s/\b([0-9]+)\b/$1<<32>>32/eg;
392 $self->{label} =~ s/\b([0-9]+)\b/$1>>0/eg;
397 if (!$self->{label} && $self->{index} && $self->{scale}==1 &&
398 $self->{base} =~ /(rbp|r13)/) {
399 $self->{base} = $self->{index}; $self->{index} = $1;
403 $self->{label} =~ s/^___imp_/__imp__/ if ($flavour eq "mingw64");
405 if (defined($self->{index})) {
407 $self->{asterisk},$self->{label},
408 $self->{base}?"%$self->{base}":"",
409 $self->{index},$self->{scale},
410 $self->{opmask};
412 sprintf "%s%s(%%%s)%s", $self->{asterisk},$self->{label},
413 $self->{base},$self->{opmask};
416 $self->{label} =~ s/\./\$/g;
417 $self->{label} =~ s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/ig;
418 $self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/);
420 my $mnemonic = $self->{opcode}->mnemonic();
421 ($self->{asterisk}) && ($sz="q") ||
427 $self->{opmask} =~ s/%(k[0-7])/$1/;
429 if (defined($self->{index})) {
431 $self->{label}?"$self->{label}+":"",
432 $self->{index},$self->{scale},
433 $self->{base}?"+$self->{base}":"",
434 $self->{opmask};
435 } elsif ($self->{base} eq "rip") {
436 sprintf "%s[%s]",$szmap{$sz},$self->{label};
439 $self->{label}?"$self->{label}+":"",
440 $self->{base},$self->{opmask};
448 my $self = {};
453 bless $self,$class;
454 $self->{asterisk} = $1;
455 $self->{value} = $2;
456 $self->{opmask} = $3;
457 $opcode->size($self->size());
458 $ret = $self;
464 my $self = shift;
467 if ($self->{value} =~ /^r[\d]+b$/i) { $ret="b"; }
468 elsif ($self->{value} =~ /^r[\d]+w$/i) { $ret="w"; }
469 elsif ($self->{value} =~ /^r[\d]+d$/i) { $ret="l"; }
470 elsif ($self->{value} =~ /^r[\w]+$/i) { $ret="q"; }
471 elsif ($self->{value} =~ /^[a-d][hl]$/i){ $ret="b"; }
472 elsif ($self->{value} =~ /^[\w]{2}l$/i) { $ret="b"; }
473 elsif ($self->{value} =~ /^[\w]{2}$/i) { $ret="w"; }
474 elsif ($self->{value} =~ /^e[a-z]{2}$/i){ $ret="l"; }
479 my $self = shift;
480 if ($gas) { sprintf "%s%%%s%s", $self->{asterisk},
481 $self->{value},
482 $self->{opmask}; }
483 else { $self->{opmask} =~ s/%(k[0-7])/$1/;
484 $self->{value}.$self->{opmask}; }
490 my $self = {};
494 bless $self,$class;
495 $self->{value} = $1;
496 $ret = $self;
499 $self->{value} =~ s/^\.L/$decor/;
504 my $self = shift;
507 my $func = ($globals{$self->{value}} or $self->{value}) . ":";
508 if ($win64 && $current_function->{name} eq $self->{value}
525 } elsif ($self->{value} ne "$current_function->{name}") {
527 $self->{value} .= ":" if ($masm);
528 $self->{value} . ":";
557 my $self = {};
561 bless $self,$class;
562 $self->{value} = $1;
563 $ret = $self;
566 $self->{value} =~ s/\@PLT// if (!$elf);
567 $self->{value} =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
568 $self->{value} =~ s/\.L/$decor/g;
569 $self->{opcode} = $opcode;
574 my $self = shift;
575 if ($nasm && $self->{opcode}->mnemonic()=~m/^j(?![re]cxz)/) {
576 "NEAR ".$self->{value};
578 $self->{value};
750 my $self = {};
754 bless $self,$class;
755 $ret = $self;
756 undef $self->{value};
791 $self->{value} = ".cfi_adjust_cfa_offset\t8\n";
793 $self->{value} .= ".cfi_offset\t$$line,$cfa_rsp";
799 $self->{value} = ".cfi_adjust_cfa_offset\t-8\n";
801 $self->{value} .= ".cfi_restore\t$$line";
806 $self->{value} = ".cfi_escape\t" .
821 $self->{value} = ".cfi_$dir\t$$line" if ($dir);
829 my $self = shift;
830 return ($elf ? $self->{value} : undef);
836 my $self = {};
844 bless $self,$class;
846 $ret = $self;
847 undef $self->{value};
886 $self->{value} = $dir . "\t" . $$line;
889 $self->{value} = ""; # swallow extern
891 $self->{value} = "";
892 $self->{value} = ".def\t" . ($globals{$1} or $1) . ";\t" .
897 $self->{value} = "";
899 $self->{value} .= "${decor}SEH_end_$current_function->{name}:"
904 $self->{value} = ".p2align\t" . (log($$line)/log(2));
911 $self->{value} =~ s/(.+)\s+align\s*=.*$/$1/;
927 if ($flavour eq "macosx") { $self->{value} = ".section\t__DATA,__const"; }
928 elsif ($flavour eq "mingw64") { $self->{value} = ".section\t.rodata"; }
931 if ($flavour eq "macosx") { $self->{value} = ".mod_init_func"; }
932 elsif ($flavour eq "mingw64") { $self->{value} = ".section\t.ctors"; }
945 if ($flavour eq "macosx") { $self->{value} = ".private_extern\t$prefix$$line"; }
946 elsif ($flavour eq "mingw64") { $self->{value} = ""; }
948 $self->{value} = "$dir\t$prefix$$line";
949 $self->{value} =~ s|,([0-9]+),([0-9]+)$|",$1,".log($2)/log(2)|e if ($flavour eq "macosx");
960 $self->{value} = $current_segment if ($flavour eq "mingw64");
963 return $self;
989 $self->{value} = $v;
1002 $self->{value} = $v;
1066 $self->{value} = $v;
1069 /\.extern/ && do { $self->{value} = "EXTERN\t".$$line;
1070 $self->{value} .= ":NEAR" if ($masm);
1074 && do { $self->{value} = $masm?"PUBLIC":"global";
1075 $self->{value} .= "\t".$$line;
1079 undef $self->{value};
1081 $self->{value}="${decor}SEH_end_$current_function->{name}:";
1082 $self->{value}.=":\n" if($masm);
1084 $self->{value}.="$current_function->{name}\tENDP" if($masm && $current_function->{name});
1090 $self->{value} = "ALIGN\t".($$line>$max?$max:$$line);
1106 $self->{value} = "\tD$sz\t";
1107 for (@arr) { $self->{value} .= &$conv($_).","; }
1108 $self->{value} .= &$conv($last);
1115 $self->{value}.="DB\t"
1119 $self->{value}.="DB\t"
1135 $self->{value} = $v;
1163 $self->{value} = $v;
1173 my $self = shift;
1174 $self->{value};