Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- oneShot :: HscEnv -> Phase -> [(String, Maybe Phase)] -> IO ()
- compileFile :: HscEnv -> Phase -> (FilePath, Maybe Phase) -> IO FilePath
- preprocess :: HscEnv -> FilePath -> Maybe InputFileBuffer -> Maybe Phase -> IO (Either ErrorMessages (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 -> Logger -> TmpFs -> Hooks -> DynFlags -> UnitEnv -> Bool -> HomePackageTable -> IO SuccessFlag
- data PhasePlus
- newtype CompPipeline a = P {}
- data PipeEnv = PipeEnv {}
- data PipeState = PipeState {
- hsc_env :: HscEnv
- maybe_loc :: Maybe ModLocation
- foreign_os :: [FilePath]
- iface :: Maybe (ModIface, ModDetails)
- phaseOutputFilename :: Phase -> CompPipeline FilePath
- getOutputFilename :: Logger -> TmpFs -> Phase -> PipelineOutput -> String -> DynFlags -> Phase -> Maybe ModLocation -> IO FilePath
- getPipeState :: CompPipeline PipeState
- getPipeEnv :: CompPipeline PipeEnv
- hscPostBackendPhase :: HscSource -> Backend -> Phase
- getLocation :: HscSource -> ModuleName -> CompPipeline ModLocation
- setModLocation :: ModLocation -> CompPipeline ()
- setDynFlags :: DynFlags -> CompPipeline ()
- runPhase :: PhasePlus -> FilePath -> CompPipeline (PhasePlus, FilePath)
- doCpp :: Logger -> TmpFs -> DynFlags -> UnitEnv -> Bool -> FilePath -> FilePath -> IO ()
- linkingNeeded :: Logger -> DynFlags -> UnitEnv -> Bool -> [Linkable] -> [UnitId] -> IO Bool
- checkLinkInfo :: Logger -> DynFlags -> UnitEnv -> [UnitId] -> FilePath -> IO Bool
- writeInterfaceOnlyMode :: DynFlags -> Bool
Documentation
:: HscEnv | |
-> FilePath | input filename |
-> Maybe InputFileBuffer | optional buffer to use instead of reading the input file |
-> Maybe Phase | starting phase |
-> IO (Either ErrorMessages (DynFlags, FilePath)) |
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
:: HscEnv | |
-> ModSummary | summary for module being compiled |
-> Int | module N ... |
-> Int | ... of M |
-> Maybe ModIface | old interface, if we have one |
-> Maybe Linkable | old linkable, if we have one |
-> SourceModified | |
-> IO HomeModInfo | the complete HomeModInfo, if successful |
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.
:: Maybe TcGblEnv | |
-> Maybe Messager | |
-> HscEnv | |
-> ModSummary | summary for module being compiled |
-> Int | module N ... |
-> Int | ... of M |
-> Maybe ModIface | old interface, if we have one |
-> Maybe Linkable | old linkable, if we have one |
-> SourceModified | |
-> IO HomeModInfo | the complete HomeModInfo, if successful |
:: GhcLink | interactive or batch |
-> Logger | Logger |
-> TmpFs | |
-> Hooks | |
-> DynFlags | dynamic flags |
-> UnitEnv | unit environment |
-> Bool | attempt linking in batch mode? |
-> HomePackageTable | what to link |
-> IO SuccessFlag |
Instances
newtype CompPipeline a Source #
Instances
PipeEnv | |
|
PipeState | |
|
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 :: Logger -> TmpFs -> 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-o
may be important.PipelineOutput
: is this intended to be aTemporary
orPersistent
build 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
: theModLocation
of 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 :: HscSource -> Backend -> 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 #
:: PhasePlus | Run this phase |
-> FilePath | name of the input file |
-> CompPipeline (PhasePlus, FilePath) |
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 {-# OPTIONS -fasm #-} 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.
doCpp :: Logger -> TmpFs -> DynFlags -> UnitEnv -> Bool -> FilePath -> FilePath -> IO () Source #
Run CPP
UnitState is needed to compute MIN_VERSION macros