From: simonmar Date: Thu, 14 Jun 2001 11:46:55 +0000 (+0000) Subject: [project @ 2001-06-14 11:46:55 by simonmar] X-Git-Tag: Approximately_9120_patches~1760 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8245241e08dd6b27da051344a0e42790e25494e1;p=ghc-hetmet.git [project @ 2001-06-14 11:46:55 by simonmar] just move some code around. --- diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index 39052ae..e2bddc4 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverPipeline.hs,v 1.76 2001/06/08 20:09:43 sof Exp $ +-- $Id: DriverPipeline.hs,v 1.77 2001/06/14 11:46:55 simonmar Exp $ -- -- GHC Driver -- @@ -194,8 +194,13 @@ genPipeline todo stop_flag persistent_output lang filename | otherwise = [ ] -- just pass this file through to the linker -- ToDo: this is somewhat cryptic - not_valid = throwDyn (UsageError ("invalid option combination")) + + stop_phase = case todo of + StopBefore As | split -> SplitAs + StopBefore phase -> phase + DoMkDependHS -> Ln + DoLink -> Ln ----------- ----- ---- --- -- -- - - - -- this shouldn't happen. @@ -204,6 +209,17 @@ genPipeline todo stop_flag persistent_output lang filename ++ filename)) else do + -- if we can't find the phase we're supposed to stop before, + -- something has gone wrong. This test carefully avoids the + -- case where we aren't supposed to do any compilation, because the file + -- is already in linkable form (for example). + if start_phase `elem` pipeline && + (stop_phase /= Ln && stop_phase `notElem` pipeline) + then throwDyn (UsageError + ("flag " ++ stop_flag + ++ " is incompatible with source file `" ++ filename ++ "'")) + else do + let -- .o and .hc suffixes can be overriden by command-line options: myPhaseInputExt Ln | Just s <- osuf = s @@ -235,28 +251,12 @@ genPipeline todo stop_flag persistent_output lang filename -- the suffix on an output file is determined by the next phase -- in the pipeline, so we add linking to the end of the pipeline -- to force the output from the final phase to be a .o file. - stop_phase = case todo of - StopBefore As | split -> SplitAs - StopBefore phase -> phase - DoMkDependHS -> Ln - DoLink -> Ln annotated_pipeline = annotatePipeline (pipeline ++ [Ln]) stop_phase phase_ne p (p1,_,_) = (p1 /= p) ----------- ----- ---- --- -- -- - - - - -- if we can't find the phase we're supposed to stop before, - -- something has gone wrong. This test carefully avoids the - -- case where we aren't supposed to do any compilation, because the file - -- is already in linkable form (for example). - if start_phase `elem` pipeline && - (stop_phase /= Ln && stop_phase `notElem` pipeline) - then throwDyn (UsageError - ("flag " ++ stop_flag - ++ " is incompatible with source file `" ++ filename ++ "'")) - else do - return ( takeWhile (phase_ne stop_phase ) $ dropWhile (phase_ne start_phase) $