x86_64 assembler translator update.
This commit is contained in:
parent
9e5790ce21
commit
4b45051902
@ -30,15 +30,18 @@
|
|||||||
# stack frame allocation. If volatile storage is actually required
|
# stack frame allocation. If volatile storage is actually required
|
||||||
# that is. If not, just leave the stack as is.
|
# that is. If not, just leave the stack as is.
|
||||||
# 3. Functions tagged with ".type name,@function" get crafted with
|
# 3. Functions tagged with ".type name,@function" get crafted with
|
||||||
# unified Windows prologue and epilogue automatically. If you want
|
# unified Win64 prologue and epilogue automatically. If you want
|
||||||
# to take care of ABI differences yourself, tag functions as
|
# to take care of ABI differences yourself, tag functions as
|
||||||
# ".type name,@abi-omnipotent."
|
# ".type name,@abi-omnipotent" instead.
|
||||||
# 4. As minor optimization you can specify number of input arguments
|
# 4. To optimize the Win64 prologue you can specify number of input
|
||||||
# as ".type name,@function,N." Keep in mind that if N is larger
|
# arguments as ".type name,@function,N." Keep in mind that if N is
|
||||||
# than 6, then you *have to* write "abi-omnipotent" code, because
|
# larger than 6, then you *have to* write "abi-omnipotent" code,
|
||||||
# it can't be resolved with unified prologue.
|
# because >6 cases can't be addressed with unified prologue.
|
||||||
# 5. Name local labels as .L*.
|
# 5. Name local labels as .L*, do *not* use dynamic labels such as 1:
|
||||||
# 6. Don't use repret, it's generated automatically.
|
# (sorry about latter).
|
||||||
|
# 6. Don't use [or hand-code with .byte] "rep ret." "ret" mnemonic is
|
||||||
|
# required to identify the spots, where to inject Win64 epilogue!
|
||||||
|
# But on the pros, it's then prefixed with rep automatically:-)
|
||||||
|
|
||||||
my $output = shift;
|
my $output = shift;
|
||||||
open STDOUT,">$output" || die "can't open $output: $!";
|
open STDOUT,">$output" || die "can't open $output: $!";
|
||||||
@ -143,6 +146,11 @@ my $current_function;
|
|||||||
my $sz = shift;
|
my $sz = shift;
|
||||||
|
|
||||||
if (!$masm) {
|
if (!$masm) {
|
||||||
|
# elder GNU assembler insists on 64-bit EAs:-(
|
||||||
|
# on pros side, this results in more compact code:-)
|
||||||
|
$self->{index} =~ s/^[er](.?[0-9xp])[d]?$/r\1/;
|
||||||
|
$self->{base} =~ s/^[er](.?[0-9xp])[d]?$/r\1/;
|
||||||
|
|
||||||
if (defined($self->{index})) {
|
if (defined($self->{index})) {
|
||||||
sprintf "%s(%%%s,%%%s,%d)", $self->{label},$self->{base},
|
sprintf "%s(%%%s,%%%s,%d)", $self->{label},$self->{base},
|
||||||
$self->{index},$self->{scale};
|
$self->{index},$self->{scale};
|
||||||
@ -340,8 +348,9 @@ while($line=<>) {
|
|||||||
|
|
||||||
chomp($line);
|
chomp($line);
|
||||||
|
|
||||||
$line =~ s/\[#!].*$//; # get rid of comments...
|
$line =~ s|[#!].*$||; # get rid of asm-style comments...
|
||||||
$line =~ s/^\s+//; # ... and skip white spaces
|
$line =~ s|/\*.*\*/||; # ... and C-style comments...
|
||||||
|
$line =~ s|^\s+||; # ... and skip white spaces in beginning
|
||||||
|
|
||||||
undef $label;
|
undef $label;
|
||||||
undef $opcode;
|
undef $opcode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user