X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdriver%2Fghc.lprl;h=8ccef55cfca9dc672f56e680b4959d972549114b;hb=da61874293fdcf7c22117d3f2d1022d3981a1862;hp=9b2d9f179c052ec589e9abd0c8733b0088e9dbf2;hpb=10521d8418fd3a1cf32882718b5bd28992db36fd;p=ghc-hetmet.git diff --git a/ghc/driver/ghc.lprl b/ghc/driver/ghc.lprl index 9b2d9f1..8ccef55 100644 --- a/ghc/driver/ghc.lprl +++ b/ghc/driver/ghc.lprl @@ -1,5 +1,5 @@ % -% (c) The GRASP/AQUA Project, Glasgow University, 1992-1995 +% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996 % % *** MSUB does some substitutions here *** % *** grep for $( *** @@ -160,6 +160,7 @@ $HsCpp = # but this is re-set to "cat" (after options) if -cpp not seen ( $(INSTALLING) ) ? "$InstLibDirGhc/hscpp" : "$TopPwd/$(CURRENT_DIR)/$(GHC_HSCPP)"; @HsCpp_flags = (); +$genSPECS_flag = ''; # See ../utils/hscpp/hscpp.prl $HsP = ( $(INSTALLING) ) ? "$InstLibDirGhc/hsp" : "$TopPwd/$(CURRENT_DIR)/$(GHC_HSP)"; @@ -206,9 +207,11 @@ $Oopt_AddAutoSccs = ''; $Oopt_FinalStgProfilingMassage = ''; $Oopt_StgStats = ''; $Oopt_SpecialiseUnboxed = ''; +$Oopt_DoSpecialise = '-fspecialise'; $Oopt_FoldrBuild = 1; # On by default! $Oopt_FB_Support = '-fdo-new-occur-anal -fdo-arity-expand'; #$Oopt_FoldrBuildWW = 0; # Off by default +$Oopt_FoldrBuildInline = '-fdo-inline-foldr-build'; \end{code} Things to do with C compilers/etc: @@ -280,7 +283,7 @@ $BuildTag = ''; # default is sequential build w/ Appel-style GC %BuildDescr = ('', 'normal sequential', '_p', 'profiling', '_t', 'ticky-ticky profiling', - '_t', 'unregisterized (using portable C only)', + '_u', 'unregisterized (using portable C only)', '_mc', 'concurrent', '_mr', 'profiled concurrent', '_mt', 'ticky concurrent', @@ -372,7 +375,6 @@ $BuildTag = ''; # default is sequential build w/ Appel-style GC # GranSim '_mg', '$StkChkByPageFaultOK = 0; push(@HsC_flags, \'-fconcurrent\'); -#???????????? push(@HsCpp_flags,\'-D__PARALLEL_HASKELL__\', \'-DPAR\'); push(@Cpp_define, \'-D__CONCURRENT_HASKELL__\', \'-DCONCURRENT\', \'-DGRAN\');', '_2s', 'push (@CcBoth_flags, \'-DGC2s\');', @@ -534,6 +536,39 @@ $Cc_consist_options = ''; # we record, in this order: Now slurp through the arguments. \begin{code} + +#---------- user defined prelude --------------------------------------- + +if (grep(/^-user-prelude$/, @ARGV)) { + + # If ARGV contains -user-prelude we are compiling a piece of + # prelude for the user, probably with additional specialise pragmas + + # We strip out the -O -f and -user-prelude flags provided on + # the command line and add the ones used to compile the prelude + # ToDo: get these options from a common definition in mkworld + + # We also enable any options forced through with -user-prelude-force + + # Hey, Check out this grep statement ;-) (PS) + + @ARGV = grep((!/^-O/ && !/^-f/ && !/^-user-prelude$/) || s/^-user-prelude-force//, + @ARGV); + + unshift(@ARGV, + '-prelude', + '-O', + '-fshow-pragma-name-errs', + '-fshow-import-specs', + '-fomit-reexported-instances', + '-fglasgow-exts', + '-genSPECS', + '-DUSE_FOLDR_BUILD', + '-dcore-lint'); + + print STDERR "ghc: -user-prelude options:\n", "@ARGV", "\n"; +} + # can't use getopt(s); what we want is too complicated arg: while($_ = $ARGV[0]) { shift(@ARGV); @@ -566,8 +601,9 @@ arg: while($_ = $ARGV[0]) { /^-nohi$/ && do { $ProduceHi = 0; next arg; }; # don't generate an interface (even if generating C) - /^-hi-diffs$/ && do { $HiDiff_flag = 1; next arg; }; - # show diffs if the interface file changes + /^-hi-diffs$/ && do { $HiDiff_flag = 1; next arg; }; + /^-no-hi-diffs$/ && do { $HiDiff_flag = 0; next arg; }; + # show/disable diffs if the interface file changes /^-E$/ && do { push(@CcBoth_flags, '-E'); $Only_preprocess_C = 1; @@ -828,6 +864,10 @@ arg: while($_ = $ARGV[0]) { /^-D(.*)/ && do { push(@HsCpp_flags, "'-D".&grab_arg_arg('-D',$1)."'"); next arg; }; /^-U(.*)/ && do { push(@HsCpp_flags, "'-U".&grab_arg_arg('-U',$1)."'"); next arg; }; + /^-genSPECS/ && do { $Cpp_flag_set = 1; + $genSPECS_flag = $_; + next arg; }; + #---------- Haskell parser (hsp) --------------------------------------- /^-ddump-parser$/ && do { $Dump_parser_output = 1; next arg; }; @@ -869,12 +909,18 @@ arg: while($_ = $ARGV[0]) { /^-prelude$/ && do { $CompilingPrelude = 1; push(@HsC_flags, $_); next arg; }; + /^-user-prelude-force/ && do { # ignore if not -user-prelude + next arg; }; + /^-split-objs(.*)/ && do { local($sname) = &grab_arg_arg('-split-objs', $1); $sname =~ s/ //g; # no spaces if ( $TargetPlatform =~ /^(alpha|hppa1\.1|i386|m68k|mips|powerpc|sparc)-/ ) { $SplitObjFiles = 1; + $ProduceS = ''; + $ProduceC = 1; + push(@HsC_flags, "-fglobalise-toplev-names$sname"); push(@CcBoth_flags, '-DUSE_SPLIT_MARKERS'); @@ -886,8 +932,6 @@ arg: while($_ = $ARGV[0]) { } next arg; }; - /^-fglobalise-toplev-names$/&& do { push(@HsC_flags, $_); next arg; }; - /^-f(hide-builtin-names|min-builtin-names)$/ && do { push(@HsC_flags, $_); push(@HsP_flags, '-P'); # don't read Prelude.hi @@ -905,12 +949,26 @@ arg: while($_ = $ARGV[0]) { } next arg; }; - /^-fspecialise-unboxed$/ - && do { $Oopt_SpecialiseUnboxed = '-fspecialise-unboxed'; + /^-fspeciali[sz]e-unboxed$/ + && do { $Oopt_DoSpecialise = '-fspecialise'; + $Oopt_SpecialiseUnboxed = '-fspecialise-unboxed'; + next arg; }; + /^-fspeciali[sz]e$/ + && do { $Oopt_DoSpecialise = '-fspecialise'; next arg; }; + /^-fno-speciali[sz]e$/ + && do { $Oopt_DoSpecialise = ''; + next arg; }; + # Now the foldr/build options, which are *on* by default (for -O). + /^-ffoldr-build$/ + && do { $Oopt_FoldrBuild = 1; + $Oopt_FB_Support = '-fdo-new-occur-anal -fdo-arity-expand'; + #print "Yes F/B\n"; + next arg; }; + /^-fno-foldr-build$/ && do { $Oopt_FoldrBuild = 0; $Oopt_FB_Support = ''; @@ -918,12 +976,17 @@ arg: while($_ = $ARGV[0]) { /^-fno-foldr-build-rule$/ && do { $Oopt_FoldrBuild = 0; - next arg; }; + next arg; }; /^-fno-enable-tech$/ && do { $Oopt_FB_Support = ''; next arg; }; + /^-fno-snapback-to-append$/ + && do { $Oopt_FoldrBuildInline .= ' -fdo-not-fold-back-append '; + #print "No Foldback of append\n"; + next arg; }; + # /^-ffoldr-build-ww$/ # && do { $Oopt_FoldrBuildWW = 1; next arg; }; @@ -1023,6 +1086,8 @@ arg: while($_ = $ARGV[0]) { /^-d(dump|ppr)-/ && do { push(@HsC_flags, $_); next arg; }; /^-dverbose-(simpl|stg)/ && do { push(@HsC_flags, $_); next arg; }; + /^-dshow-passes/ && do { push(@HsC_flags, $_); next arg; }; + /^-dsource-stats/ && do { push(@HsC_flags, $_); next arg; }; /^-dsimplifier-stats/ && do { push(@HsC_flags, $_); next arg; }; /^-dstg-stats/ && do { $Oopt_StgStats = $_; next arg; }; @@ -1150,10 +1215,17 @@ arg: while($_ = $ARGV[0]) { close(OFILE); next arg; }; - /^-debug$/ && do { # all this does is mark a .hc/.o as "debugging" - # in the consistency info - $DEBUGging = 'd'; - next arg; }; + /^-debug$/ && do { # all this does is mark a .hc/.o as "debugging" + # in the consistency info + $DEBUGging = 'd'; + next arg; }; + + #---------- linking .a file -------------------------------------------- + + /^-Main(.*)/ && do { + # specifies main or mainPrimIO to be linked + $Ld_main = $1; + next arg; }; #---------- catch unrecognized flags ----------------------------------- @@ -1163,8 +1235,8 @@ arg: while($_ = $ARGV[0]) { next arg; }; #---------- anything else is considered an input file ------------------ - # (well, .o files are immediately queued up as linker fodder..) - if (/\.o$/) { + # (well, .o and .a files are immediately queued up as linker fodder..) + if (/\.[oa]$/) { push(@Link_file, $_); } else { push(@Input_file, $_); @@ -1330,26 +1402,27 @@ It really really wants to be the last STG-to-STG pass that is run. @HsC_minusO_flags # NOTE: used for *both* -O and -O2 (some conditional bits) = ( - # core2core passes - # initial simplify: mk specialiser happy: minimum effort please + # initial simplify: mk specialiser and autoscc happy: minimum effort please '-fsimplify', '\(', "$Oopt_FB_Support", - '-fkeep-spec-pragma-ids', + '-fkeep-spec-pragma-ids', # required before specialisation '-fsimpl-uf-use-threshold0', '-fessential-unfoldings-only', '-fmax-simplifier-iterations1', "$Oopt_PedanticBottoms", '\)', - $Oopt_AddAutoSccs, # dangerous to do with *no* simplification... + $Oopt_AddAutoSccs, # need some basic simplification first - '-fspecialise-overloaded', - $Oopt_SpecialiseUnboxed, - '-fspecialise', + ($Oopt_DoSpecialise) ? ( + '-fspecialise-overloaded', + $Oopt_SpecialiseUnboxed, + $Oopt_DoSpecialise, + ) : (), - '-fsimplify', # need tossing before calc-i... - '\(', + '-fsimplify', # need dependency anal after specialiser ... + '\(', # need tossing before calc-inlinings ... "$Oopt_FB_Support", '-ffloat-lets-exposing-whnf', '-ffloat-primops-ok', @@ -1358,7 +1431,6 @@ It really really wants to be the last STG-to-STG pass that is run. '-fdo-eta-reduction', '-fdo-lambda-eta-expansion', '-freuse-con', -# '-flet-to-case', # no point, before strictness analysis "$Oopt_PedanticBottoms", "$Oopt_MonadEtaExpansion", "$Oopt_UnfoldingUseThreshold", @@ -1380,7 +1452,6 @@ It really really wants to be the last STG-to-STG pass that is run. # '-fdo-eta-reduction', # '-fdo-lambda-eta-expansion', # '-freuse-con', -## '-flet-to-case', # no point, before strictness analysis # "$Oopt_PedanticBottoms", # "$Oopt_MonadEtaExpansion", # "$Oopt_UnfoldingUseThreshold", @@ -1393,6 +1464,8 @@ It really really wants to be the last STG-to-STG pass that is run. '-ffull-laziness', ($Oopt_FoldrBuild) ? ( + '-ffoldr-build-on', # desugar list comprehensions for foldr/build + '-fsimplify', '\(', '-fignore-inline-pragma', # **** NB! @@ -1405,7 +1478,6 @@ It really really wants to be the last STG-to-STG pass that is run. '-fdo-eta-reduction', '-fdo-lambda-eta-expansion', '-freuse-con', - # '-flet-to-case', # no point, before strictness analysis "$Oopt_PedanticBottoms", "$Oopt_MonadEtaExpansion", "$Oopt_UnfoldingUseThreshold", @@ -1425,9 +1497,10 @@ It really really wants to be the last STG-to-STG pass that is run. '-fdo-eta-reduction', '-fdo-lambda-eta-expansion', '-freuse-con', -# '-flet-to-case', # no point, before strictness analysis - '-fdo-inline-foldr-build', - # you need to inline foldr! + ($Oopt_FoldrBuildInline), + # you need to inline foldr and build + ($Oopt_FoldrBuild) ? ('-fdo-foldr-build') : (), + # but do reductions if you see them! "$Oopt_PedanticBottoms", "$Oopt_MonadEtaExpansion", "$Oopt_UnfoldingUseThreshold", @@ -1446,7 +1519,7 @@ It really really wants to be the last STG-to-STG pass that is run. '-fdo-eta-reduction', '-fdo-lambda-eta-expansion', '-freuse-con', - '-flet-to-case', # Aha! + '-flet-to-case', # Aha! Only done after strictness analysis "$Oopt_PedanticBottoms", "$Oopt_MonadEtaExpansion", "$Oopt_UnfoldingUseThreshold", @@ -1476,14 +1549,17 @@ It really really wants to be the last STG-to-STG pass that is run. '-freuse-con', '-flet-to-case', '-fignore-inline-pragma', # **** NB! - '-fdo-inline-foldr-build', # NB + $Oopt_FoldrBuildInline, + ($Oopt_FoldrBuild) ? ('-fdo-foldr-build') : (), + # but still do reductions if you see them! "$Oopt_PedanticBottoms", "$Oopt_MonadEtaExpansion", "$Oopt_UnfoldingUseThreshold", "$Oopt_MaxSimplifierIterations", '\)', -# '-fstatic-args', + # '-fstatic-args', + '-fcalc-inlinings2', # stg2stg passes @@ -1495,11 +1571,10 @@ It really really wants to be the last STG-to-STG pass that is run. # flags for stg2stg '-flet-no-escape', - # how do we desugar list comprehensions ? - (($Oopt_FoldrBuild) ? '-ffoldr-build-on' : '' ), - # SPECIAL FLAGS for -O2 - (($OptLevel == 2) ? '-fsemi-tagging' : '') + ($OptLevel == 2) ? ( + '-fsemi-tagging', + ) : (), ); \end{code} @@ -1715,7 +1790,10 @@ unshift(@Ld_flags, || $TargetPlatform =~ /^powerpc-/ || $TargetPlatform =~ /-solaris/ ) - ? ('-u', 'unsafePerformPrimIO_fast1', + ? (($Ld_main) ? ( + '-u', 'Main_' . $Ld_main . '_closure', + ) : (), + '-u', 'unsafePerformPrimIO_fast1', '-u', 'Nil_closure', '-u', 'IZh_static_info', '-u', 'False_inregs_info', @@ -1724,7 +1802,10 @@ unshift(@Ld_flags, '-u', 'DEBUG_REGS') # just for fun, now... # nice friendly a.out machines... - : ('-u', '_unsafePerformPrimIO_fast1', + : (($Ld_main) ? ( + '-u', '_Main_' . $Ld_main . '_closure', + ) : (), + '-u', '_unsafePerformPrimIO_fast1', '-u', '_Nil_closure', '-u', '_IZh_static_info', '-u', '_False_inregs_info', @@ -1871,7 +1952,7 @@ if ($Do_lnkr) { local($lnkr) = ( $Lnkr ) ? $Lnkr : ($RegisteriseC ? $CcRegd : $CcUnregd ); local($output)= ($Specific_output_file ne '') ? "-o $Specific_output_file" : ''; - @Files_to_tidy = ( ($Specific_output_file ne '') ? "$Specific_output_file" : 'a.out' ); + @Files_to_tidy = ($Specific_output_file ne '') ? "$Specific_output_file" : 'a.out'; local($to_do) = "$lnkr $Verbose @Ld_flags $output @Link_file $TopClosureFile $libdirs @UserLibrary @SysLibrary"; &run_something($to_do, 'Linker'); @@ -1956,7 +2037,7 @@ args: while ($a = shift(@ARGV)) { } } -exec "$SysMan $debug $nprocessors @nonPVM_args"; +exec "$SysMan $debug $pvm_executable $nprocessors @nonPVM_args"; print STDERR "Exec failed!!!: $SysMan $debug $nprocessors @nonPVM_args\n"; exit(1); EOSCRIPT2 @@ -2113,7 +2194,7 @@ it fails. } else { local($includes) = '-I' . join(' -I',@Include_dir); local($to_do) = "echo '#line 1 \"$in_lit2pgm\"' > $hscpp_hsp; ". - "$HsCpp $Verbose @HsCpp_flags -D__HASKELL1__=$haskell1_version -D__GLASGOW_HASKELL__=$ghc_version_info $includes $lit2pgm_hscpp >> $hscpp_hsp"; + "$HsCpp $Verbose $genSPECS_flag @HsCpp_flags -D__HASKELL1__=$haskell1_version -D__GLASGOW_HASKELL__=$ghc_version_info $includes $lit2pgm_hscpp >> $hscpp_hsp"; @Files_to_tidy = ( $hscpp_hsp ); &run_something($to_do, 'Haskellised C pre-processor'); }