[project @ 2000-06-13 15:35:29 by partain]
[ghc-hetmet.git] / ghc / driver / split / ghc-split.lprl
index 962f67d..267315c 100644 (file)
@@ -9,7 +9,7 @@ sub inject_split_markers {
     local($hc_file) = @_;
 
     unlink("$Tmp_prefix.unmkd");
-    local($to_do) = "$Cp $hc_file $Tmp_prefix.unmkd";
+    local($to_do) = "cp $hc_file $Tmp_prefix.unmkd";
     &run_something($to_do, 'Prepare to number split markers');
 
     open(TMPI, "< $Tmp_prefix.unmkd") || &tidy_up_and_die(1,"$Pgm: failed to open `$Tmp_prefix.unmkd' (to read)\n");
@@ -24,14 +24,10 @@ sub inject_split_markers {
        $_ = <TMPI>;
     }
     print TMPO "__STG_SPLIT_MARKER(1)\n";
-    print TMPO $_ if ! /^\s*\/\* SPLIT \*\/\s*$/;
-
-       # Have to be a bit careful detecting /* SPLIT */ comments
-       # since a progam may use a string containing "/* SPLIT */"
-       # We check that there is nothing else on the line
+    print TMPO $_ if ! /\/\* SPLIT \*\//;
 
     while (<TMPI>) {
-       if (/^\s*\/\* SPLIT \*\/\s*$/) {
+       if (/\/\* SPLIT \*\//) {
            $marker_no++;
            print TMPO "__STG_SPLIT_MARKER($marker_no)\n";
            next;
@@ -179,7 +175,6 @@ 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");
@@ -192,15 +187,15 @@ sub process_asm_block_sparc {
     if ( $OptimiseC ) {
        $str =~ s/_?__stg_split_marker.*:\n//;
     } else {
-       $str =~ s/(\.text\n\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/$1/;
-       $str =~ s/(\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/$1/;
+       $str =~ s/(\.text\n\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/\1/;
+       $str =~ s/(\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/\1/;
     }
 
     # make sure the *.hc filename gets saved; not just ghc*.c (temp name)
     $str =~ s/^\.stabs "(ghc\d+\.c)"/.stabs "$ifile_root.hc"/g; # HACK HACK
 
     # remove/record any literal constants defined here
-    while ( $str =~ /(\t\.align .\n(LC\d+):\n(\t\.ascii.*\n)+)/ ) {
+    while ( $str =~ /(\t\.align .\n(LC\d+):\n\t\.ascii.*\n)/ ) {
        local($label) = $2;
        local($body)  = $1;
 
@@ -209,7 +204,7 @@ sub process_asm_block_sparc {
 
        $LocalConstant{$label} = $body;
        
-       $str =~ s/\t\.align .\nLC\d+:\n(\t\.ascii.*\n)+//;
+       $str =~ s/\t\.align .\nLC\d+:\n\t\.ascii.*\n//;
     }
 
     # inject definitions for any local constants now used herein
@@ -227,10 +222,10 @@ sub process_asm_block_sparc {
 sub process_asm_block_m68k {
     local($str) = @_;
 
-    # strip the marker
+    # strip the marker (ToDo: something special for unregisterized???)
 
-    $str =~ s/(\.text\n\t\.even\n)\t\.globl\s+.*_?__stg_split_marker.*\n/$1/;
-    $str =~ s/(\t\.even\n)\t\.globl\s+.*_?__stg_split_marker.*\n/$1/;
+    $str =~ s/(\.text\n\t\.even\n)\t\.globl\s+.*_?__stg_split_marker.*\n/\1/;
+    $str =~ s/(\t\.even\n)\t\.globl\s+.*_?__stg_split_marker.*\n/\1/;
 
     # it seems prudent to stick on one of these:
     $str = "\.text\n\t.even\n" . $str;
@@ -267,7 +262,7 @@ sub process_asm_block_alpha {
     if ( $OptimiseC ) {
        $str =~ s/_?__stg_split_marker.*:\n//;
     } else {
-       $str =~ s/(\t\.align .\n)\t\.globl\s+.*_?__stg_split_marker.*\n\t\.ent.*\n/$1/;
+       $str =~ s/(\t\.align .\n)\t\.globl\s+.*_?__stg_split_marker.*\n\t\.ent.*\n/\1/;
     }
 
     # remove/record any literal constants defined here
@@ -293,7 +288,7 @@ sub process_asm_block_alpha {
     # Slide the dummy direct return code into the vtbl .ent/.end block,
     # to keep the label fixed if it's the last thing in a module, and
     # to avoid having any anonymous text that the linker will complain about
-    $str =~ s/(\t\.end [A-Za-z0-9_]+)\n\t# nop/\tnop\n$1/g;
+    $str =~ s/(\t\.end [A-Za-z0-9_]+)\n\t# nop/\tnop\n\1/g;
 
     print STDERR "### STRIPPED BLOCK (alpha):\n$str" if $Dump_asm_splitting_info;
 
@@ -303,10 +298,10 @@ sub process_asm_block_alpha {
 sub process_asm_block_iX86 {
     local($str) = @_;
 
-    # strip the marker
+    # strip the marker (ToDo: something special for unregisterized???)
 
-    $str =~ s/(\.text\n\t\.align .(,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/$1/;
-    $str =~ s/(\t\.align .(,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/$1/;
+    $str =~ s/(\.text\n\t\.align .(,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/\1/;
+    $str =~ s/(\t\.align .(,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/\1/;
 
     # it seems prudent to stick on one of these:
     $str = "\.text\n\t.align 4\n" . $str;
@@ -397,7 +392,7 @@ sub process_asm_block_mips {
     if ( $OptimiseC ) {
        $str =~ s/_?__stg_split_marker.*:\n//;
     } else {
-       $str =~ s/(\t\.align .\n)\t\.globl\s+.*_?__stg_split_marker.*\n\t\.ent.*\n/$1/;
+       $str =~ s/(\t\.align .\n)\t\.globl\s+.*_?__stg_split_marker.*\n\t\.ent.*\n/\1/;
     }
 
     # remove/record any literal constants defined here
@@ -423,7 +418,7 @@ sub process_asm_block_mips {
     # Slide the dummy direct return code into the vtbl .ent/.end block,
     # to keep the label fixed if it's the last thing in a module, and
     # to avoid having any anonymous text that the linker will complain about
-    $str =~ s/(\t\.end [A-Za-z0-9_]+)\n\t# nop/\tnop\n$1/g;
+    $str =~ s/(\t\.end [A-Za-z0-9_]+)\n\t# nop/\tnop\n\1/g;
 
     $str .= $UNDEFINED_FUNS; # pin on gratuitiously-large amount of info
 
@@ -434,42 +429,6 @@ 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;
 \end{code}