X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverPhases.hs;h=2efe293bd63cfde7e3a882dd3ed1259c6e5f7373;hb=70b6c54b3c140d96b69287f8f400f88a0b7e9c18;hp=08715628e57490b85fde9e7b151801e3cca90147;hpb=3b9b4df7ea723ad6c3c1974c148ccc81f9e67270;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverPhases.hs b/ghc/compiler/main/DriverPhases.hs index 0871562..2efe293 100644 --- a/ghc/compiler/main/DriverPhases.hs +++ b/ghc/compiler/main/DriverPhases.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverPhases.hs,v 1.21 2002/07/05 20:30:38 sof Exp $ +-- $Id: DriverPhases.hs,v 1.25 2003/06/04 15:47:59 simonmar Exp $ -- -- GHC Driver -- @@ -11,12 +11,12 @@ module DriverPhases ( Phase(..), + happensBefore, startPhase, -- :: String -> Phase phaseInputExt, -- :: Phase -> String haskellish_file, haskellish_suffix, haskellish_src_file, haskellish_src_suffix, - hsbootish_file, hsbootish_suffix, objish_file, objish_suffix, cish_file, cish_suffix, isExtCore_file, extcoreish_suffix, @@ -41,12 +41,10 @@ import DriverUtil -} data Phase - = MkDependHS -- haskell dependency generation - | Unlit + = Unlit | Cpp | HsPp | Hsc - | HsBoot | Cc | HCc -- Haskellised C (as opposed to vanilla C) compilation | Mangle -- assembly mangling, now done by a separate script. @@ -60,6 +58,17 @@ data Phase #endif deriving (Eq, Show) +-- Partial ordering on phases: we want to know which phases will occur before +-- which others. This is used for sanity checking, to ensure that the +-- pipeline will stop at some point (see DriverPipeline.runPipeline). +x `happensBefore` y + | x `elem` haskell_pipe = y `elem` tail (dropWhile (/= x) haskell_pipe) + | x `elem` c_pipe = y `elem` tail (dropWhile (/= x) c_pipe) + | otherwise = False + +haskell_pipe = [Unlit,Cpp,HsPp,Hsc,HCc,Mangle,As,Ln] +c_pipe = [Cc,As,Ln] + -- the first compilation phase for a given file is determined -- by its suffix. startPhase "lhs" = Unlit @@ -67,7 +76,6 @@ startPhase "hs" = Cpp startPhase "hscpp" = HsPp startPhase "hspp" = Hsc startPhase "hcr" = Hsc -startPhase "hs-boot" = HsBoot startPhase "hc" = HCc startPhase "c" = Cc startPhase "cpp" = Cc @@ -93,8 +101,6 @@ phaseInputExt SplitMangle = "split_s" -- not really generated phaseInputExt As = "s" phaseInputExt SplitAs = "split_s" -- not really generated phaseInputExt Ln = "o" -phaseInputExt MkDependHS = "dep" -phaseInputExt HsBoot = "hs-boot" #ifdef ILX phaseInputExt Ilx2Il = "ilx" phaseInputExt Ilasm = "il" @@ -103,9 +109,10 @@ phaseInputExt Ilasm = "il" haskellish_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr", "hc", "raw_s" ]) haskellish_src_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr"]) cish_suffix = (`elem` [ "c", "cpp", "C", "cc", "cxx", "s", "S" ]) -hsbootish_suffix = (`elem` [ "hs-boot" ]) extcoreish_suffix = (`elem` [ "hcr" ]) +-- Use the appropriate suffix for the system on which +-- the GHC-compiled code will run #if mingw32_TARGET_OS || cygwin32_TARGET_OS objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ]) #else @@ -115,10 +122,8 @@ objish_suffix = (`elem` [ "o" ]) haskellish_file = haskellish_suffix . getFileSuffix haskellish_src_file = haskellish_src_suffix . getFileSuffix cish_file = cish_suffix . getFileSuffix -objish_file = objish_suffix . getFileSuffix -hsbootish_file = hsbootish_suffix . getFileSuffix - isExtCore_file = extcoreish_suffix . getFileSuffix +objish_file = objish_suffix . getFileSuffix isSourceFile :: FilePath -> Bool isSourceFile f =