X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverFlags.hs;h=328dac36efdb9c37e99367553e59ae05acf3efac;hb=a0928e35b5991b08e01cf8b26128eb54a6eb25ee;hp=89270803474ed644f26753c0d1121377f827809d;hpb=6f57245bd52f902080e003bffe0d511f89b15592;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverFlags.hs b/ghc/compiler/main/DriverFlags.hs index 8927080..328dac3 100644 --- a/ghc/compiler/main/DriverFlags.hs +++ b/ghc/compiler/main/DriverFlags.hs @@ -1,7 +1,5 @@ -{-# OPTIONS -#include "hschooks.h" #-} - ----------------------------------------------------------------------------- --- $Id: DriverFlags.hs,v 1.84 2002/01/04 16:02:04 simonmar Exp $ +-- $Id: DriverFlags.hs,v 1.108 2002/12/17 13:50:29 simonmar Exp $ -- -- Driver flags -- @@ -19,6 +17,7 @@ module DriverFlags ( #include "HsVersions.h" #include "../includes/config.h" +import MkIface ( showIface ) import DriverState import DriverPhases import DriverUtil @@ -28,10 +27,10 @@ import Config import Util import Panic -import Exception -import IOExts -import System ( exitWith, ExitCode(..) ) +import EXCEPTION +import DATA_IOREF ( readIORef, writeIORef ) +import System ( exitWith, ExitCode(..) ) import IO import Maybe import Monad @@ -137,8 +136,8 @@ findArg spec arg arg_ok (NoArg _) rest arg = null rest arg_ok (HasArg _) rest arg = True arg_ok (SepArg _) rest arg = null rest -arg_ok (Prefix _) rest arg = not (null rest) -arg_ok (PrefixPred p _) rest arg = not (null rest) && p rest +arg_ok (Prefix _) rest arg = notNull rest +arg_ok (PrefixPred p _) rest arg = notNull rest && p rest arg_ok (OptPrefix _) rest arg = True arg_ok (PassFlag _) rest arg = null rest arg_ok (AnySuffix _) rest arg = True @@ -163,6 +162,10 @@ static_flags = , ( "-numeric-version", NoArg (do putStrLn cProjectVersion exitWith ExitSuccess)) + ------- interfaces ---------------------------------------------------- + , ( "-show-iface" , HasArg (\f -> do showIface f + exitWith ExitSuccess)) + ------- verbosity ---------------------------------------------------- , ( "n" , NoArg setDryRun ) @@ -198,6 +201,7 @@ static_flags = , ( "gransim" , NoArg (addNoDups v_Ways WayGran) ) , ( "smp" , NoArg (addNoDups v_Ways WaySMP) ) , ( "debug" , NoArg (addNoDups v_Ways WayDebug) ) + , ( "ndp" , NoArg (addNoDups v_Ways WayNDP) ) -- ToDo: user ways ------ Debugging ---------------------------------------------------- @@ -225,7 +229,7 @@ static_flags = ------- Output Redirection ------------------------------------------ , ( "odir" , HasArg (writeIORef v_Output_dir . Just) ) , ( "o" , SepArg (writeIORef v_Output_file . Just) ) - , ( "osuf" , HasArg (writeIORef v_Object_suf . Just) ) + , ( "osuf" , HasArg (writeIORef v_Object_suf) ) , ( "hcsuf" , HasArg (writeIORef v_HC_suf . Just) ) , ( "hisuf" , HasArg (writeIORef v_Hi_suf) ) , ( "hidir" , HasArg (writeIORef v_Hi_dir . Just) ) @@ -257,8 +261,14 @@ static_flags = ------- Libraries --------------------------------------------------- , ( "L" , Prefix (addToDirList v_Library_paths) ) - , ( "l" , Prefix (add v_Cmdline_libraries) ) + , ( "l" , AnySuffix (\s -> add v_Opt_l s >> add v_Opt_dll s) ) +#ifdef darwin_TARGET_OS + ------- Frameworks -------------------------------------------------- + -- -framework-path should really be -F ... + , ( "framework-path" , HasArg (addToDirList v_Framework_paths) ) + , ( "framework" , HasArg (add v_Cmdline_frameworks) ) +#endif ------- Packages ---------------------------------------------------- , ( "package-name" , HasArg (\s -> add v_Opt_C ("-inpackage="++s)) ) @@ -267,13 +277,24 @@ static_flags = , ( "syslib" , HasArg (addPackage) ) -- for compatibility w/ old vsns ------- Specific phases -------------------------------------------- - , ( "pgm" , HasArg setPgm ) + , ( "pgmP" , HasArg setPgmP ) + , ( "pgmF" , HasArg setPgmF ) + , ( "pgmc" , HasArg setPgmc ) + , ( "pgmm" , HasArg setPgmm ) + , ( "pgms" , HasArg setPgms ) + , ( "pgma" , HasArg setPgma ) + , ( "pgml" , HasArg setPgml ) +#ifdef ILX + , ( "pgmI" , HasArg setPgmI ) + , ( "pgmi" , HasArg setPgmi ) +#endif , ( "optdep" , HasArg (add v_Opt_dep) ) , ( "optl" , HasArg (add v_Opt_l) ) , ( "optdll" , HasArg (add v_Opt_dll) ) ----- Linker -------------------------------------------------------- + , ( "no-link" , NoArg (writeIORef v_NoLink True) ) , ( "static" , NoArg (writeIORef v_Static True) ) , ( "dynamic" , NoArg (writeIORef v_Static False) ) , ( "rdynamic" , NoArg (return ()) ) -- ignored for compat w/ gcc @@ -306,9 +327,6 @@ static_flags = -- -fno-* pattern below doesn't work. We therefore allow -- certain optimisation passes to be turned off explicitly: , ( "fno-strictness" , NoArg (writeIORef v_Strictness False) ) -#ifdef DEBUG - , ( "fno-cpr" , NoArg (writeIORef v_CPR False) ) -#endif , ( "fno-cse" , NoArg (writeIORef v_CSE False) ) -- All other "-fno-" options cancel out "-f" on the hsc cmdline @@ -345,7 +363,7 @@ dynamic_flags = [ -- on all other systems, quoting is necessary, to avoid interpretation -- of shell metacharacters in the arguments (e.g. green-card's -- -DBEGIN_GHC_ONLY='}-' trick). -#ifndef mingw32_TARGET_OS +#ifndef mingw32_HOST_OS , ( "D", Prefix (\s -> addOpt_P ("-D'"++s++"'") ) ) , ( "U", Prefix (\s -> addOpt_P ("-U'"++s++"'") ) ) #else @@ -383,6 +401,7 @@ dynamic_flags = [ , ( "dshow-passes", NoArg (setVerbosity "2") ) , ( "ddump-rn-trace", NoArg (setDynFlag Opt_D_dump_rn_trace) ) , ( "ddump-tc-trace", NoArg (setDynFlag Opt_D_dump_tc_trace) ) + , ( "ddump-splices", NoArg (setDynFlag Opt_D_dump_splices) ) , ( "ddump-rn-stats", NoArg (setDynFlag Opt_D_dump_rn_stats) ) , ( "ddump-stix", NoArg (setDynFlag Opt_D_dump_stix) ) , ( "ddump-simpl-stats", NoArg (setDynFlag Opt_D_dump_simpl_stats) ) @@ -393,6 +412,7 @@ dynamic_flags = [ , ( "ddump-hi-diffs", NoArg (setDynFlag Opt_D_dump_hi_diffs) ) , ( "ddump-hi", NoArg (setDynFlag Opt_D_dump_hi) ) , ( "ddump-minimal-imports", NoArg (setDynFlag Opt_D_dump_minimal_imports) ) + , ( "ddump-vect", NoArg (setDynFlag Opt_D_dump_vect) ) , ( "dcore-lint", NoArg (setDynFlag Opt_DoCoreLinting) ) , ( "dstg-lint", NoArg (setDynFlag Opt_DoStgLinting) ) , ( "dusagesp-lint", NoArg (setDynFlag Opt_DoUSPLinting) ) @@ -405,6 +425,7 @@ dynamic_flags = [ ------ Warning opts ------------------------------------------------- , ( "W" , NoArg (mapM_ setDynFlag minusWOpts) ) + , ( "Werror" , NoArg (setDynFlag Opt_WarnIsError) ) , ( "Wall" , NoArg (mapM_ setDynFlag minusWallOpts) ) , ( "Wnot" , NoArg (mapM_ unSetDynFlag minusWallOpts) ) /* DEPREC */ , ( "w" , NoArg (mapM_ unSetDynFlag minusWallOpts) ) @@ -418,6 +439,8 @@ dynamic_flags = [ -- "active negatives" , ( "fno-implicit-prelude", NoArg (setDynFlag Opt_NoImplicitPrelude) ) + , ( "fno-monomorphism-restriction", + NoArg (setDynFlag Opt_NoMonomorphismRestriction) ) -- the rest of the -f* and -fno-* flags , ( "fno-", PrefixPred (\f -> isFFlag f) (\f -> unSetDynFlag (getFFlag f)) ) @@ -442,6 +465,10 @@ fFlags = [ ( "warn-unused-matches", Opt_WarnUnusedMatches ), ( "warn-deprecations", Opt_WarnDeprecations ), ( "glasgow-exts", Opt_GlasgowExts ), + ( "fi", Opt_FFI ), -- support `-ffi'... + ( "ffi", Opt_FFI ), -- ...and also `-fffi' + ( "with", Opt_With ), -- with keyword + ( "parr", Opt_PArr ), ( "allow-overlapping-instances", Opt_AllowOverlappingInstances ), ( "allow-undecidable-instances", Opt_AllowUndecidableInstances ), ( "allow-incoherent-instances", Opt_AllowIncoherentInstances ), @@ -469,8 +496,13 @@ decodeSize str ----------------------------------------------------------------------------- -- RTS Hooks +#if __GLASGOW_HASKELL__ >= 504 +foreign import ccall unsafe "setHeapSize" setHeapSize :: Int -> IO () +foreign import ccall unsafe "enableTimingStats" enableTimingStats :: IO () +#else foreign import "setHeapSize" unsafe setHeapSize :: Int -> IO () foreign import "enableTimingStats" unsafe enableTimingStats :: IO () +#endif ----------------------------------------------------------------------------- -- Build the Hsc static command line opts @@ -511,7 +543,11 @@ buildStaticHscOpts = do machdepCCOpts | prefixMatch "alpha" cTARGETPLATFORM - = return ( ["-static", "-w", "-mieee"], [] ) + = return ( ["-static", "-w", "-mieee" +#ifdef HAVE_THREADED_RTS_SUPPORT + , "-D_REENTRANT" +#endif + ], [] ) -- For now, to suppress the gcc warning "call-clobbered -- register used for global register variable", we simply -- disable all warnings altogether using the -w flag. Oh well. @@ -540,12 +576,20 @@ machdepCCOpts -- the fp (%ebp) for our register maps. = do n_regs <- dynFlag stolen_x86_regs sta <- readIORef v_Static - return ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else "", - if suffixMatch "mingw32" cTARGETPLATFORM then "-mno-cygwin" else "" ], + return ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else "" +-- , if suffixMatch "mingw32" cTARGETPLATFORM then "-mno-cygwin" else "" + ], [ "-fno-defer-pop", "-fomit-frame-pointer", + -- we want -fno-builtin, because when gcc inlines + -- built-in functions like memcpy() it tends to + -- run out of registers, requiring -monly-n-regs + "-fno-builtin", "-DSTOLEN_X86_REGS="++show n_regs ] ) + | prefixMatch "ia64" cTARGETPLATFORM + = return ( [], ["-fomit-frame-pointer", "-G0"] ) + | prefixMatch "mips" cTARGETPLATFORM = return ( ["-static"], [] ) @@ -556,7 +600,15 @@ machdepCCOpts -- disable all warnings altogether using the -w flag. Oh well. | prefixMatch "powerpc-apple-darwin" cTARGETPLATFORM - = return ( ["-no-cpp-precomp"], [""] ) + -- -no-cpp-precomp: + -- Disable Apple's precompiling preprocessor. It's a great thing + -- for "normal" programs, but it doesn't support register variable + -- declarations. + -- -mdynamic-no-pic: + -- As we don't support haskell code in shared libraries anyway, + -- we might as well turn of PIC code generation and save space and time. + -- This is completely optional. + = return ( ["-no-cpp-precomp","-mdynamic-no-pic"], [] ) | prefixMatch "powerpc" cTARGETPLATFORM || prefixMatch "rs6000" cTARGETPLATFORM = return ( ["-static"], ["-finhibit-size-directive"] )