| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DriverPipeline
Synopsis
- oneShot :: HscEnv -> Phase -> [(String, Maybe Phase)] -> IO ()
- compileFile :: HscEnv -> Phase -> (FilePath, Maybe Phase) -> IO FilePath
- linkBinary :: DynFlags -> [FilePath] -> [InstalledUnitId] -> IO ()
- preprocess :: HscEnv -> (FilePath, Maybe Phase) -> IO (DynFlags, FilePath)
- compileOne :: HscEnv -> ModSummary -> Int -> Int -> Maybe ModIface -> Maybe Linkable -> SourceModified -> IO HomeModInfo
- compileOne' :: Maybe TcGblEnv -> Maybe Messager -> HscEnv -> ModSummary -> Int -> Int -> Maybe ModIface -> Maybe Linkable -> SourceModified -> IO HomeModInfo
- link :: GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag
- data PhasePlus
- newtype CompPipeline a = P {}
- data PipeEnv = PipeEnv {
- stop_phase :: Phase
- src_filename :: String
- src_basename :: String
- src_suffix :: String
- output_spec :: PipelineOutput
- data PipeState = PipeState {
- hsc_env :: HscEnv
- maybe_loc :: Maybe ModLocation
- foreign_os :: [FilePath]
- phaseOutputFilename :: Phase -> CompPipeline FilePath
- getOutputFilename :: Phase -> PipelineOutput -> String -> DynFlags -> Phase -> Maybe ModLocation -> IO FilePath
- getPipeState :: CompPipeline PipeState
- getPipeEnv :: CompPipeline PipeEnv
- hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase
- getLocation :: HscSource -> ModuleName -> CompPipeline ModLocation
- setModLocation :: ModLocation -> CompPipeline ()
- setDynFlags :: DynFlags -> CompPipeline ()
- runPhase :: PhasePlus -> FilePath -> DynFlags -> CompPipeline (PhasePlus, FilePath)
- exeFileName :: Bool -> DynFlags -> FilePath
- maybeCreateManifest :: DynFlags -> FilePath -> IO [FilePath]
- linkingNeeded :: DynFlags -> Bool -> [Linkable] -> [InstalledUnitId] -> IO Bool
- checkLinkInfo :: DynFlags -> [InstalledUnitId] -> FilePath -> IO Bool
- writeInterfaceOnlyMode :: DynFlags -> Bool
Documentation
linkBinary :: DynFlags -> [FilePath] -> [InstalledUnitId] -> IO () Source #
Arguments
Just preprocess a file, put the result in a temp. file (used by the compilation manager during the summary phase).
We return the augmented DynFlags, because they contain the result of slurping in the OPTIONS pragmas
Arguments
summary for module being compiled
module N ...
... of M
Compile
Compile a single module, under the control of the compilation manager.
This is the interface between the compilation manager and the compiler proper (hsc), where we deal with tedious details like reading the OPTIONS pragma from the source file, converting the C or assembly that GHC produces into an object file, and compiling FFI stub files.
NB. No old interface can also mean that the source has changed.
Arguments
summary for module being compiled
module N ...
... of M
link :: GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag Source #
newtype CompPipeline a Source #
Instances
Instance details
Defined in PipelineMonad
Methods
(>>=) :: CompPipeline a -> (a -> CompPipeline b) -> CompPipeline b #
(>>) :: CompPipeline a -> CompPipeline b -> CompPipeline b #
return :: a -> CompPipeline a #
fail :: String -> CompPipeline a #
Instance details
Defined in PipelineMonad
Methods
fmap :: (a -> b) -> CompPipeline a -> CompPipeline b #
(<$) :: a -> CompPipeline b -> CompPipeline a #
Instance details
Defined in PipelineMonad
Methods
pure :: a -> CompPipeline a #
(<*>) :: CompPipeline (a -> b) -> CompPipeline a -> CompPipeline b #
liftA2 :: (a -> b -> c) -> CompPipeline a -> CompPipeline b -> CompPipeline c #
(*>) :: CompPipeline a -> CompPipeline b -> CompPipeline b #
(<*) :: CompPipeline a -> CompPipeline b -> CompPipeline a #
Constructors
Fields
- stop_phase :: Phase
Stop just before this phase
- src_filename :: String
basename of original input source
- src_basename :: String
basename of original input source
- src_suffix :: String
its extension
- output_spec :: PipelineOutput
says where to put the pipeline output
Constructors
Fields
- hsc_env :: HscEnv
only the DynFlags change in the HscEnv. The DynFlags change at various points, for example when we read the OPTIONS_GHC pragmas in the Cpp phase.
- maybe_loc :: Maybe ModLocation
the ModLocation. This is discovered during compilation, in the Hsc phase where we read the module header.
- foreign_os :: [FilePath]
additional object files resulting from compiling foreign code. They come from two sources: foreign stubs, and add{C,Cxx,Objc,Objcxx}File from template haskell
phaseOutputFilename :: Phase -> CompPipeline FilePath Source #
Computes the next output filename after we run next_phase.
Like getOutputFilename , but it operates in the CompPipeline monad
(which specifies all of the ambient information.)
getOutputFilename :: Phase -> PipelineOutput -> String -> DynFlags -> Phase -> Maybe ModLocation -> IO FilePath Source #
Computes the next output filename for something in the compilation pipeline. This is controlled by several variables:
Phase: the last phase to be run (e.g.stopPhase). This is used to tell if we're in the last phase or not, because in that case flags like-omay be important.PipelineOutput: is this intended to be aTemporaryorPersistentbuild output? Temporary files just go in a fresh temporary name.String: what was the basename of the original input file?DynFlags: the obvious thingPhase: the phase we want to determine the output filename of.Maybe ModLocation: theModLocationof the module we're compiling; this can be used to override the default output of an object file. (TODO: do we actually need this?)
hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase Source #
What phase to run after one of the backend code generators has run
getLocation :: HscSource -> ModuleName -> CompPipeline ModLocation Source #
setModLocation :: ModLocation -> CompPipeline () Source #
setDynFlags :: DynFlags -> CompPipeline () Source #
Arguments
Run this phase
name of the input file
for convenience, we pass the current dflags in
Each phase in the pipeline returns the next phase to execute, and the name of the file in which the output was placed.
We must do things dynamically this way, because we often don't know what the rest of the phases will be until part-way through the compilation: for example, an {--} at the beginning of a source file can change the latter stages of the pipeline from taking the LLVM route to using the native code generator.
linkingNeeded :: DynFlags -> Bool -> [Linkable] -> [InstalledUnitId] -> IO Bool Source #
checkLinkInfo :: DynFlags -> [InstalledUnitId] -> FilePath -> IO Bool Source #