X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverPhases.hs;h=8d67ae0760b0b23d126c55b8dff4c9b3068975c0;hb=536e2a029dcc11c33c9448146b34513c682f17ad;hp=e85bbe7ad659d4e7540ca9db5c29960b2d6b3f68;hpb=395917a05328e935f40abd080b169aa25546b083;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverPhases.hs b/ghc/compiler/main/DriverPhases.hs index e85bbe7..8d67ae0 100644 --- a/ghc/compiler/main/DriverPhases.hs +++ b/ghc/compiler/main/DriverPhases.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverPhases.hs,v 1.23 2003/02/24 12:39:27 simonpj Exp $ +-- $Id: DriverPhases.hs,v 1.27 2003/06/26 21:55:47 sof Exp $ -- -- GHC Driver -- @@ -11,15 +11,16 @@ 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, + haskellish_user_src_file, isSourceFile -- :: FilePath -> Bool ) where @@ -41,12 +42,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 +59,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,SplitMangle,As,SplitAs,Ln] +c_pipe = [Cc,As,Ln] + -- the first compilation phase for a given file is determined -- by its suffix. startPhase "lhs" = Unlit @@ -67,7 +77,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,18 +102,16 @@ 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" #endif -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" ]) +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" ]) +extcoreish_suffix = (`elem` [ "hcr" ]) +haskellish_user_src_suffix = (`elem` [ "hs", "lhs" ]) -- Use the appropriate suffix for the system on which -- the GHC-compiled code will run @@ -114,13 +121,12 @@ objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ]) objish_suffix = (`elem` [ "o" ]) #endif -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 +haskellish_file = haskellish_suffix . getFileSuffix +haskellish_src_file = haskellish_src_suffix . getFileSuffix +cish_file = cish_suffix . getFileSuffix +isExtCore_file = extcoreish_suffix . getFileSuffix +objish_file = objish_suffix . getFileSuffix +haskellish_user_src_file = haskellish_user_src_suffix . getFileSuffix isSourceFile :: FilePath -> Bool isSourceFile f =