X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDriverPhases.hs;h=99f60890f24b379af86fb4613b92b5f93815f84e;hb=b4229ab662b6d87b1477bafa85d2db46e5a9a152;hp=6e945314cb1e109ef4b92fd34b2eaaef9ea83686;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs index 6e94531..99f6089 100644 --- a/compiler/main/DriverPhases.hs +++ b/compiler/main/DriverPhases.hs @@ -1,3 +1,10 @@ +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + ----------------------------------------------------------------------------- -- $Id: DriverPhases.hs,v 1.38 2005/05/17 11:01:59 simonmar Exp $ -- @@ -33,8 +40,8 @@ module DriverPhases ( isSourceFilename -- :: FilePath -> Bool ) where -import Util ( suffixOf ) import Panic ( panic ) +import System.FilePath ----------------------------------------------------------------------------- -- Phases @@ -71,6 +78,7 @@ data Phase | Cpp HscSource | HsPp HscSource | Hsc HscSource + | Ccpp | Cc | HCc -- Haskellised C (as opposed to vanilla C) compilation | Mangle -- assembly mangling, now done by a separate script. @@ -99,6 +107,7 @@ eqPhase (Unlit _) (Unlit _) = True eqPhase (Cpp _) (Cpp _) = True eqPhase (HsPp _) (HsPp _) = True eqPhase (Hsc _) (Hsc _) = True +eqPhase Ccpp Ccpp = True eqPhase Cc Cc = True eqPhase HCc HCc = True eqPhase Mangle Mangle = True @@ -129,6 +138,7 @@ nextPhase Mangle = SplitMangle nextPhase SplitMangle = As nextPhase As = SplitAs nextPhase SplitAs = StopLn +nextPhase Ccpp = As nextPhase Cc = As nextPhase CmmCpp = Cmm nextPhase Cmm = HCc @@ -145,10 +155,10 @@ startPhase "hspp" = Hsc HsSrcFile startPhase "hcr" = Hsc ExtCoreFile startPhase "hc" = HCc startPhase "c" = Cc -startPhase "cpp" = Cc +startPhase "cpp" = Ccpp startPhase "C" = Cc -startPhase "cc" = Cc -startPhase "cxx" = Cc +startPhase "cc" = Ccpp +startPhase "cxx" = Ccpp startPhase "raw_s" = Mangle startPhase "split_s" = SplitMangle startPhase "s" = As @@ -171,6 +181,7 @@ phaseInputExt (Hsc _) = "hspp" -- intermediate only -- because runPipeline uses the StopBefore phase to pick the -- output filename. That could be fixed, but watch out. phaseInputExt HCc = "hc" +phaseInputExt Ccpp = "cpp" phaseInputExt Cc = "c" phaseInputExt Mangle = "raw_s" phaseInputExt SplitMangle = "split_s" -- not really generated @@ -179,10 +190,6 @@ phaseInputExt SplitAs = "split_s" -- not really generated phaseInputExt CmmCpp = "cmm" phaseInputExt Cmm = "cmmcpp" phaseInputExt StopLn = "o" -#ifdef ILX -phaseInputExt Ilx2Il = "ilx" -phaseInputExt Ilasm = "il" -#endif haskellish_src_suffixes = haskellish_user_src_suffixes ++ [ "hspp", "hscpp", "hcr", "cmm" ] @@ -213,17 +220,18 @@ isCishSuffix s = s `elem` cish_suffixes isExtCoreSuffix s = s `elem` extcoreish_suffixes isObjectSuffix s = s `elem` objish_suffixes isHaskellUserSrcSuffix s = s `elem` haskellish_user_src_suffixes -isDynLibSuffix s = s `elem` dynlib_suffixes +isDynLibSuffix s = s `elem` dynlib_suffixes isSourceSuffix suff = isHaskellishSuffix suff || isCishSuffix suff -isHaskellishFilename f = isHaskellishSuffix (suffixOf f) -isHaskellSrcFilename f = isHaskellSrcSuffix (suffixOf f) -isCishFilename f = isCishSuffix (suffixOf f) -isExtCoreFilename f = isExtCoreSuffix (suffixOf f) -isObjectFilename f = isObjectSuffix (suffixOf f) -isHaskellUserSrcFilename f = isHaskellUserSrcSuffix (suffixOf f) -isDynLibFilename f = isDynLibSuffix (suffixOf f) -isSourceFilename f = isSourceSuffix (suffixOf f) +-- takeExtension return .foo, so we drop 1 to get rid of the . +isHaskellishFilename f = isHaskellishSuffix (drop 1 $ takeExtension f) +isHaskellSrcFilename f = isHaskellSrcSuffix (drop 1 $ takeExtension f) +isCishFilename f = isCishSuffix (drop 1 $ takeExtension f) +isExtCoreFilename f = isExtCoreSuffix (drop 1 $ takeExtension f) +isObjectFilename f = isObjectSuffix (drop 1 $ takeExtension f) +isHaskellUserSrcFilename f = isHaskellUserSrcSuffix (drop 1 $ takeExtension f) +isDynLibFilename f = isDynLibSuffix (drop 1 $ takeExtension f) +isSourceFilename f = isSourceSuffix (drop 1 $ takeExtension f)