Skip to content
Snippets Groups Projects
Commit 95ef475e authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 2000-06-13 15:35:29 by simonm]

Fix splitting on i386-unknwon-linux: string constants were being
duplicated in each object, leading to large increases in binary
sizes.
parent 888363ea
No related merge requests found
......@@ -179,6 +179,7 @@ sub process_asm_block {
return(&process_asm_block_alpha($str)) if $TargetPlatform =~ /^alpha-/;
return(&process_asm_block_hppa($str)) if $TargetPlatform =~ /^hppa/;
return(&process_asm_block_mips($str)) if $TargetPlatform =~ /^mips-/;
return(&process_asm_block_powerpc($str)) if $TargetPlatform =~ /^powerpc-|^rs6000-/;
# otherwise...
&tidy_up_and_die(1,"$Pgm: no process_asm_block for $TargetPlatform\n");
......@@ -311,7 +312,7 @@ sub process_asm_block_iX86 {
$str = "\.text\n\t.align 4\n" . $str;
# remove/record any literal constants defined here
while ( ($str =~ /((LC\d+):\n\t\.ascii.*\n)/ )) {
while ( ($str =~ /((\.?LC\d+):\n\t\.(ascii|string).*\n)/ )) {
local($label) = $2;
local($body) = $1;
......@@ -320,7 +321,7 @@ sub process_asm_block_iX86 {
$LocalConstant{$label} = $body;
$str =~ s/LC\d+:\n\t\.ascii.*\n//;
$str =~ s/\.?LC\d+:\n\t\.(ascii|string).*\n//;
}
# inject definitions for any local constants now used herein
......@@ -432,6 +433,42 @@ sub process_asm_block_mips {
}
\end{code}
\begin{code}
sub process_asm_block_powerpc {
local($str) = @_;
# strip the marker
$str =~ s/___stg_split_marker.*\n//;
$str =~ s/___stg_split_marker.*\n//; # yes, twice.
# remove/record any literal constants defined here
while ( $str =~ /^(.csect .data[RW]\n\s+\.align.*\n(LC\.\.\d+):\n(\s\.byte .*\n)+)/ ) {
local($label) = $2;
local($body) = $1;
&tidy_up_and_die(1,"Local constant label $label already defined!\n")
if $LocalConstant{$label};
$LocalConstant{$label} = $body;
$str =~ s/^.csect .data[RW]\n\s+\.align.*\nLC\.\.\d+:\n(\s\.byte .*\n)+//;
}
# inject definitions for any local constants now used herein
foreach $k (keys %LocalConstant) {
if ( $str =~ /\b$k(\b|\[)/ ) {
$str = $LocalConstant{$k} . $str;
}
}
print STDERR "### STRIPPED BLOCK (powerpc/rs6000):\n$str" if $Dump_asm_splitting_info;
$str = ".toc\n" . $str;
$str;
}
\end{code}
\begin{code}
# make "require"r happy...
1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment