[project @ 2000-04-07 16:20:53 by sewardj]
[ghc-hetmet.git] / ghc / driver / ghc.lprl
index 0075940..a8af730 100644 (file)
@@ -12,6 +12,8 @@ It is written in \tr{perl}.  The first section includes a long
 %************************************************************************
 
 \begin{code}
+use 5;   # require Perl version 5 or later.
+
 ($Pgm = $0) =~ s|.*/||;
 $ShortUsage  =  "\nUsage: For basic information, try the `-help' option.\n";
 $LongUsage = "\n" . <<EOUSAGE;
@@ -476,7 +478,6 @@ $CollectingGCstats = 0;
 $CollectGhcTimings = 0;
 $DEBUGging = '';       # -DDEBUG and all that it entails (um... not really)
 $PROFing = '';         # set to p or e if profiling
-$PROFgroup = '';       # set to group if an explicit -Ggroup specified
 $PROFauto = '';                # set to relevant hsc flag if -auto or -auto-all
 $PROFcaf  = '';                # set to relevant hsc flag if -caf-all
 $PROFdict = '';                # set to relevant hsc flag if -auto-dicts
@@ -494,7 +495,7 @@ $Osuffix    = '';   # default: use the normal suffix for that kind of output
 $HiSuffix   = 'hi';
 $HiSuffix_prelude = '';
 $CompilingPrelude=0;
-$Do_recomp_chkr = 0;   # don't use the recompilatio checker unless asked
+$Do_recomp_chkr = 1;   # Use the recompilation checker by default
 $Do_cc     = -1;   # a MAGIC indeterminate value; will be set to 1 or 0.
 $Do_as     = 1;
 
@@ -676,12 +677,6 @@ The (outwards-)let-floater should be the {\em last} Core-to-Core pass
 that's run.  (Um, well, howzabout the simplifier just once more...)
 \end{description}
 
-STG-TO-STG PASSES:
-\begin{description}
-\item[\tr{-fupdate-analysis}:]
-It really really wants to be the last STG-to-STG pass that is run.
-\end{description}
-
 \begin{code}
 
 sub setupOptimiseFlags {
@@ -725,25 +720,18 @@ sub setupOptimiseFlags {
                '-fno-rules',           # Similarly, don't apply any rules until after full laziness
                                        # Notably, list fusion can prevent floating.
 
+               '-fno-case-of-case',    # Don't do case-of-case transformations.
+                                       # This makes full laziness work better
+
                '-fmax-simplifier-iterations2',
          ']',
 
        # Specialisation is best done before full laziness
        # so that overloaded functions have all their dictionary lambdas manifest
        ($Oopt_DoSpecialise) ? ( $Oopt_DoSpecialise, ) : (),
-       '-ffull-laziness',
+       '-ffloat-outwards',
        '-ffloat-inwards',
 
-#      '-fsimplify',
-#        '[', 
-#              # Run the simplifier before specialising, so that overloaded functions
-#              # look like             f = \d -> ...
-#              # (Full laziness may lift out something hiding the \d
-#              '-finline-phase1',
-#              '-fmax-simplifier-iterations1',
-#        ']',
-
-
        '-fsimplify',
          '[', 
                '-finline-phase1',
@@ -765,10 +753,17 @@ sub setupOptimiseFlags {
                # before strictness analysis runs
 
                '-finline-phase2',
-               $Oopt_MaxSimplifierIterations,  
+               '-fmax-simplifier-iterations2',
          ']',
 
 
+       '-fsimplify',
+         '[', 
+               '-fmax-simplifier-iterations2',
+               # No -finline-phase: allow all Ids to be inlined now
+               # This gets foldr inlined before strictness analysis
+         ']',
+
        '-fstrictness',
        '-fcpr-analyse',
        '-fworker-wrapper',
@@ -779,12 +774,19 @@ sub setupOptimiseFlags {
                # No -finline-phase: allow all Ids to be inlined now
          ']',
 
-       '-ffull-laziness',      # nofib/spectral/hartel/wang doubles in speed if you
+       '-ffloat-outwards',     # nofib/spectral/hartel/wang doubles in speed if you
                                # do full laziness late in the day.  It only happens
                                # after fusion and other stuff, so the early pass doesn't
                                # catch it.  For the record, the redex is 
                                #       f_el22 (f_el21 r_midblock)
 
+# Leave out lambda lifting for now
+#      '-fsimplify',   # Tidy up results of full laziness
+#        '[', 
+#              '-fmax-simplifier-iterations2',
+#        ']',
+#      '-ffloat-outwards-full',        
+
        # We want CSE to follow the final full-laziness pass, because it may
        # succeed in commoning up things floated out by full laziness.
        #
@@ -827,8 +829,7 @@ sub setupOptimiseFlags {
 
       # SPECIAL FLAGS for -O2
        ($OptLevel == 2) ? (
-         '-fupdate-analysis',  # virtually useless; relegated to -O2
-         '-fsemi-tagging',
+           # none at the present time
        ) : (),
       );
 
@@ -1095,19 +1096,20 @@ sub setupLinkOpts {
           ,'-u', "${uscore}PrelAddr_I64zh_con_info"
           ,'-u', "${uscore}PrelAddr_W64zh_con_info"
           ,'-u', "${uscore}PrelStable_StablePtr_con_info"
-          ,'-u', "${uscore}PrelBase_False_static_closure"
-          ,'-u', "${uscore}PrelBase_True_static_closure"
+          ,'-u', "${uscore}PrelBase_False_closure"
+          ,'-u', "${uscore}PrelBase_True_closure"
           ,'-u', "${uscore}PrelPack_unpackCString_closure"
           ,'-u', "${uscore}PrelException_stackOverflow_closure"
           ,'-u', "${uscore}PrelException_heapOverflow_closure"
-          ,'-u', "${uscore}PrelException_NonTermination_static_closure"
+          ,'-u', "${uscore}PrelException_NonTermination_closure"
+          ,'-u', "${uscore}PrelException_PutFullMVar_closure"
+          ,'-u', "${uscore}PrelException_BlockedOnDeadMVar_closure"
+          ,'-u', "${uscore}__init_Prelude"
+          ,'-u', "${uscore}__init_PrelMain"
        ));
   if (!$NoHaskellMain) {
    unshift (@Ld_flags,'-u', "${uscore}PrelMain_mainIO_closure");
   }
-  if ($PROFing ne '') {
-   unshift (@Ld_flags,'-u', "${uscore}_regPrelude");
-  }
   if ($TargetPlatform =~ /^powerpc-|^rs6000-/) {
     # sometimes we have lots of toc entries...
     #  unshift(@Ld_flags, ('-Xlinker -bbigtoc -Xlinker -bnoquiet')); 
@@ -1666,23 +1668,12 @@ sub runHscAndProcessInterfaces {
        # Tell the C compiler and assembler not to run
        $do_cc = 0; $do_as = 0;
 
-       # Update dependency info, touch both object file and 
-       # interface file, so that the following invariant is
-        # maintained:
-       #
-       #   a dependent module's interface file should after recompilation
-        #   checking be newer than the interface files of its imports. 
-        #
-       # That is, if module A's interface file changes, then module B
-       # (which import from A) needs to be checked.
-        # If A's change does not affect B, which causes the compiler to bail
-       # out early, we still need to touch the interface file of B. The reason
-        # for this is that B may export A's interface.
+       # Update dependency info, by touching the object file
+       # This records in the file system that the work of
+       # recompiling this module has been done
        #
        &run_something("touch $ofile_target",
                       "Touch $ofile_target,  to propagate dependencies") if $HscOut ne '-N=';
-       &run_something("touch $hifile_target", 
-                      "Touch $hifile_target,  to propagate dependencies") if $ProduceHi =~ /-nohifile=/ ;
 
     } else {   
 
@@ -1860,7 +1851,8 @@ sub runLinker
     local($lnkr) = ( $Lnkr ) ? $Lnkr : $CcRegd;
 
     if ( ($Specific_output_file eq '') && 
-         ($TargetPlatform eq 'i386-unknown-cygwin32') ) {
+         ( ($TargetPlatform eq 'i386-unknown-cygwin32') ||
+          ($TargetPlatform eq 'i386-unknown-mingw32')) ) {
          $Specific_output_file = 'main.exe';
          print STDERR "Output file not specified, defaulting to \"main.exe\"\n";
     }
@@ -2554,7 +2546,7 @@ sub add_syslib {
               : "$TopPwd/hslibs/data"
          )
        , '' # where to find the cbits archive to use when linking
-       , '' # Syslib dependencies
+       , 'lang' # Syslib dependencies
        , '' # extra ghc opts
        , '' # extra cc opts
        , '' # extra ld opts
@@ -2608,7 +2600,7 @@ sub add_syslib {
        [  # where to slurp interface files from
          ( $INSTALLING 
               ? "$InstLibDirGhc/imports/text"
-              : "$TopPwd/hslibs/text:$TopPwd/hslibs/text/html"
+              : "$TopPwd/hslibs/text:$TopPwd/hslibs/text/html:$TopPwd/hslibs/text/haxml/lib"
          )
        , # where to find the archive to use when linking
          ( $INSTALLING 
@@ -2620,7 +2612,7 @@ sub add_syslib {
               ? "$InstLibDirGhc"
               : "$TopPwd/hslibs/text/cbits"
          )
-       , 'lang' # Syslib dependencies
+       , 'lang data' # Syslib dependencies
        , '' # extra ghc opts
        , '' # extra cc opts
        , '' # extra ld opts
@@ -2630,7 +2622,7 @@ sub add_syslib {
        [  # where to slurp interface files from
          ( $INSTALLING 
               ? "$InstLibDirGhc/imports/util"
-              : "$TopPwd/hslibs/util"
+              : "$TopPwd/hslibs/util:$TopPwd/hslibs/util/check"
          )
        , # where to find the archive to use when linking
          ( $INSTALLING 
@@ -3033,9 +3025,6 @@ arg: while($_ = $Args[0]) {
                $PROFignore_scc = '-W';
                next arg; };
 
-    /^-G(.*)$/ && do { push(@HsC_flags, "-G=$1");   # set group for cost centres
-                       next arg; };
-
     /^-unprof-scc-auto/ && do {
                # generate auto SCCs on top level bindings when not profiling.
                # Used to measure optimisation effects of presence of sccs.
@@ -3218,8 +3207,8 @@ arg: while($_ = $Args[0]) {
 
     # ---------------
 
-    /^-fasm-(.*)$/  && do { $HscOut = '-S='; next arg; }; # force using nativeGen
-    /^-fvia-[cC]$/         && do { $HscOut = '-C='; next arg; }; # force using C compiler
+    /^-fasm-(.*)$/     && do { $HscOut = '-S='; next arg; }; # force using nativeGen
+    /^-fvia-[cC]$/     && do { $HscOut = '-C='; next arg; }; # force using C compiler
 
     # ---------------