2008-09-26 14:25:10 +00:00
|
|
|
#!/usr/bin/perl -ni
|
|
|
|
|
|
|
|
# This perl script strips out the extra cruft created as a side effect of
|
|
|
|
# splitting syn68k.c into many functions. This will make the resulting
|
|
|
|
# syn68k.o file smaller and also force the real branch targets to be
|
|
|
|
# aligned optimally.
|
|
|
|
|
|
|
|
# Delete the header for each function
|
2009-06-03 11:02:50 +00:00
|
|
|
if (/^\.globl _?s68k_handle_opcode_0x/ .. /^[#\/]APP$/)
|
2008-09-26 14:25:10 +00:00
|
|
|
{
|
|
|
|
print if (/^[#\/]APP/ || /^L/);
|
|
|
|
}
|
|
|
|
|
|
|
|
# Delete the trailer for each function
|
|
|
|
elsif (/^_S68K_DONE_WITH/ .. /^\s*ret$/)
|
|
|
|
{
|
|
|
|
print if (!/\s*movl %ebp,%esp$/
|
|
|
|
&& !/\s*leal\s*(-?\d+)?\(%ebp\),%esp$/
|
|
|
|
&& !/\s*movl\s*(-?\d+)?\(%ebp\),%edi$/
|
|
|
|
&& !/\s*popl/
|
|
|
|
&& !/\s*ret$/
|
|
|
|
&& !/^_S68K_DONE_WITH/
|
|
|
|
&& !/s68k_handle_opcode/);
|
|
|
|
}
|
|
|
|
elsif (/^\s*lods/)
|
|
|
|
{
|
|
|
|
die "lods not allowed; we're punting cld's these days.";
|
|
|
|
}
|
|
|
|
# elsif (/^\s*call/ && !/s68k_handle_opcode/)
|
|
|
|
# { # no longer necessary since we punted lodsl
|
|
|
|
# print "$_\tcld\n";
|
|
|
|
# }
|
|
|
|
elsif (!/s68k_handle_opcode/)
|
|
|
|
{
|
|
|
|
print;
|
|
|
|
}
|