X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverPhases.hs;h=8d67ae0760b0b23d126c55b8dff4c9b3068975c0;hb=536e2a029dcc11c33c9448146b34513c682f17ad;hp=9c9794db7c1dff4a847454549c8028cd4d9bd44a;hpb=d9d000465e182da49260b15d477d688b63c12a17;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverPhases.hs b/ghc/compiler/main/DriverPhases.hs index 9c9794d..8d67ae0 100644 --- a/ghc/compiler/main/DriverPhases.hs +++ b/ghc/compiler/main/DriverPhases.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverPhases.hs,v 1.24 2003/05/21 12:46:19 simonmar Exp $ +-- $Id: DriverPhases.hs,v 1.27 2003/06/26 21:55:47 sof Exp $ -- -- GHC Driver -- @@ -11,6 +11,7 @@ module DriverPhases ( Phase(..), + happensBefore, startPhase, -- :: String -> Phase phaseInputExt, -- :: Phase -> String @@ -19,6 +20,7 @@ module DriverPhases ( objish_file, objish_suffix, cish_file, cish_suffix, isExtCore_file, extcoreish_suffix, + haskellish_user_src_file, isSourceFile -- :: FilePath -> Bool ) where @@ -40,8 +42,7 @@ import DriverUtil -} data Phase - = MkDependHS -- haskell dependency generation - | Unlit + = Unlit | Cpp | HsPp | Hsc @@ -58,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 @@ -90,16 +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" #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" ]) -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 @@ -109,11 +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 -isExtCore_file = extcoreish_suffix . getFileSuffix -objish_file = objish_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 =