[project @ 2000-06-29 13:18:38 by simonmar]
[ghc-hetmet.git] / ghc / driver / mangler / ghc-asm.lprl
index 20d9043..b5db622 100644 (file)
@@ -42,6 +42,28 @@ for the same reason.  Advantage: No more ridiculous call sequences.
 
 %************************************************************************
 %*                                                                     *
+\subsection{Top-level code}
+%*                                                                     *
+%************************************************************************
+
+\begin{code}
+$TargetPlatform = $TARGETPLATFORM;
+
+($Pgm = $0) =~ s|.*/||;
+$ifile = $ARGV[0];
+$ofile = $ARGV[1];
+
+if ( $TargetPlatform =~ /^i386-/ ) {
+    $StolenX86Regs = $ARGV[2];
+}
+
+&mangle_asm($ifile,$ofile);
+
+exit(0);
+\end{code}
+
+%************************************************************************
+%*                                                                     *
 \subsection{Constants for various architectures}
 %*                                                                     *
 %************************************************************************
@@ -435,7 +457,7 @@ sub mangle_asm {
            $chkcat[$i]  = 'literal';
            $chksymb[$i] = $1;
 
-       } elsif ( /^$TUS[@]?__stg_split_marker(\d+)$TPOSTLBL[@]?$/o ) {
+       } elsif ( /^$TUS[@]?__stg_split_marker(\d*)$TPOSTLBL[@]?$/o ) {
            $chk[++$i]   = $_;
            $chkcat[$i]  = 'splitmarker';
            $chksymb[$i] = $1;
@@ -734,7 +756,7 @@ sub mangle_asm {
                # HWL HACK: dont die, just print a warning
                #print stderr "HWL: this should die! Epilogue junk?: $e\n" if $e =~ /^\t[^\.]/
                #    && $TargetPlatform !~ /^powerpc-/; #ToDo: remove test
-               die "Epilogue junk?: $e\n" if $e =~ /^\t[^\.]/
+               die "Epilogue junk?: $e\n" if $e =~ /^\t[^\.\n]/
                    && $TargetPlatform !~ /^powerpc-/; #ToDo: remove test
 
                # glue together what's left
@@ -793,7 +815,7 @@ sub mangle_asm {
            #    blah_closure:
            #           ...
             #
-           if ( $TargetPlatform =~ /^i386/ && $to_move =~ /$TCOPYDIRVS/ ) {
+           if ( $TargetPlatform =~ /^(i386|sparc)/ && $to_move =~ /$TCOPYDIRVS/ ) {
                $j = $i + 1;
                while ( $j < $numchks  && $chk[$j] =~ /$T_CONST_LBL/) {
                        $j++;
@@ -1495,7 +1517,12 @@ sub mangle_powerpc_tailjump {
       };
     $c;
 }
+\end{code}
 
-# make "require"r happy...
-1;
+\begin{code}
+sub tidy_up_and_die {
+    local($return_val, $msg) = @_;
+    print STDERR $msg;
+    exit (($return_val == 0) ? 0 : 1);
+}
 \end{code}