DES PIC-ification. Windows companion.

This commit is contained in:
Andy Polyakov 2002-12-14 17:52:35 +00:00
parent b0e88fb11b
commit 9fc866c5eb
2 changed files with 11 additions and 5 deletions

View file

@ -92,6 +92,8 @@ sub get_mem
$addr="_$addr"; $addr="_$addr";
} }
if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; }
$reg1="$regs{$reg1}" if defined($regs{$reg1}); $reg1="$regs{$reg1}" if defined($regs{$reg1});
$reg2="$regs{$reg2}" if defined($regs{$reg2}); $reg2="$regs{$reg2}" if defined($regs{$reg2});
if (($addr ne "") && ($addr ne 0)) if (($addr ne "") && ($addr ne 0))
@ -111,6 +113,7 @@ sub get_mem
{ {
$ret.="[$reg1$post]" $ret.="[$reg1$post]"
} }
$ret =~ s/\[\]//; # in case $addr was the only argument
return($ret); return($ret);
} }
@ -151,7 +154,7 @@ sub main'push { &out1("push",@_); $stack+=4; }
sub main'pop { &out1("pop",@_); $stack-=4; } sub main'pop { &out1("pop",@_); $stack-=4; }
sub main'bswap { &out1("bswap",@_); &using486(); } sub main'bswap { &out1("bswap",@_); &using486(); }
sub main'not { &out1("not",@_); } sub main'not { &out1("not",@_); }
sub main'call { &out1("call",'_'.$_[0]); } sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); }
sub main'ret { &out0("ret"); } sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); } sub main'nop { &out0("nop"); }
@ -338,7 +341,7 @@ sub main'set_label
{ {
if (!defined($label{$_[0]})) if (!defined($label{$_[0]}))
{ {
$label{$_[0]}="${label}${_[0]}"; $label{$_[0]}="\$${label}${_[0]}";
$label++; $label++;
} }
if((defined $_[2]) && ($_[2] == 1)) if((defined $_[2]) && ($_[2] == 1))

View file

@ -98,6 +98,8 @@ sub get_mem
$addr="_$addr"; $addr="_$addr";
} }
if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; }
$reg1="$regs{$reg1}" if defined($regs{$reg1}); $reg1="$regs{$reg1}" if defined($regs{$reg1});
$reg2="$regs{$reg2}" if defined($regs{$reg2}); $reg2="$regs{$reg2}" if defined($regs{$reg2});
if (($addr ne "") && ($addr ne 0)) if (($addr ne "") && ($addr ne 0))
@ -117,6 +119,7 @@ sub get_mem
{ {
$ret.="$reg1$post]" $ret.="$reg1$post]"
} }
$ret =~ s/\+\]/]/; # in case $addr was the only argument
return($ret); return($ret);
} }
@ -160,7 +163,7 @@ sub main'push { &out1("push",@_); $stack+=4; }
sub main'pop { &out1("pop",@_); $stack-=4; } sub main'pop { &out1("pop",@_); $stack-=4; }
sub main'bswap { &out1("bswap",@_); &using486(); } sub main'bswap { &out1("bswap",@_); &using486(); }
sub main'not { &out1("not",@_); } sub main'not { &out1("not",@_); }
sub main'call { &out1("call",'_'.$_[0]); } sub main'call { &out1("call",($_[0]=~/^\.L/?'':'_').$_[0]); }
sub main'ret { &out0("ret"); } sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); } sub main'nop { &out0("nop"); }
@ -312,7 +315,7 @@ sub main'label
{ {
if (!defined($label{$_[0]})) if (!defined($label{$_[0]}))
{ {
$label{$_[0]}="\$${label}${_[0]}"; $label{$_[0]}=".${label}${_[0]}";
$label++; $label++;
} }
return($label{$_[0]}); return($label{$_[0]});
@ -322,7 +325,7 @@ sub main'set_label
{ {
if (!defined($label{$_[0]})) if (!defined($label{$_[0]}))
{ {
$label{$_[0]}="${label}${_[0]}"; $label{$_[0]}=".${label}${_[0]}";
$label++; $label++;
} }
push(@out,"$label{$_[0]}:\n"); push(@out,"$label{$_[0]}:\n");