GHC.Driver.Pipeline.Execute

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Driver.Pipeline.Execute

Synopsis

- newtype HookedUse a = HookedUse {
  - runHookedUse :: (Hooks, PhaseHook) -> IO a
  }
- runPipeline :: Hooks -> HookedUse a -> IO a
- runPhase :: TPhase out -> IO out
- runLlvmManglePhase :: PipeEnv -> HscEnv -> FilePath -> IO [Char]
- runMergeForeign :: PipeEnv -> HscEnv -> FilePath -> [FilePath] -> IO FilePath
- runLlvmLlcPhase :: PipeEnv -> HscEnv -> FilePath -> IO FilePath
- runLlvmOptPhase :: PipeEnv -> HscEnv -> FilePath -> IO FilePath
- runGenericAsPhase :: (Logger -> DynFlags -> [Option] -> IO ()) -> [Option] -> Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath
- runLlvmAsPhase :: Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath
- runAsPhase :: Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath
- runJsPhase :: PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath
- runForeignJsPhase :: PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath
- runCcPhase :: Phase -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath
- runHscBackendPhase :: PipeEnv -> HscEnv -> ModuleName -> HscSource -> ModLocation -> HscBackendAction -> IO ([FilePath], ModIface, HomeModLinkable, FilePath)
- runUnlitPhase :: HscEnv -> FilePath -> FilePath -> IO FilePath
- getFileArgs :: HscEnv -> FilePath -> IO (DynFlags, Messages PsMessage, Messages DriverMessage)
- runCppPhase :: HscEnv -> FilePath -> FilePath -> IO FilePath
- runHscPhase :: PipeEnv -> HscEnv -> FilePath -> HscSource -> IO (HscEnv, ModSummary, HscRecompStatus)
- mkOneShotModLocation :: PipeEnv -> DynFlags -> HscSource -> ModuleName -> IO ModLocation
- runHscTcPhase :: HscEnv -> ModSummary -> IO (FrontendResult, Messages GhcMessage)
- runHscPostTcPhase :: HscEnv -> ModSummary -> FrontendResult -> Messages GhcMessage -> Maybe Fingerprint -> IO HscBackendAction
- runHsPpPhase :: HscEnv -> FilePath -> FilePath -> FilePath -> IO FilePath
- phaseOutputFilenameNew :: Phase -> PipeEnv -> HscEnv -> Maybe ModLocation -> IO FilePath
- getOutputFilename :: Logger -> TmpFs -> Phase -> PipelineOutput -> String -> DynFlags -> Phase -> Maybe ModLocation -> IO FilePath
- llvmOptions :: LlvmConfig -> DynFlags -> [(String, String)]
- hscPostBackendPhase :: HscSource -> Backend -> Phase
- compileStub :: HscEnv -> FilePath -> IO FilePath
- joinObjectFiles :: HscEnv -> [FilePath] -> FilePath -> IO ()
- getHCFilePackages :: FilePath -> IO [UnitId]
- linkDynLibCheck :: Logger -> TmpFs -> DynFlags -> UnitEnv -> [String] -> [UnitId] -> IO ()
- touchObjectFile :: FilePath -> IO ()

# Documentation

newtype HookedUse a Source #

Constructors

HookedUse |
Fields runHookedUse :: (Hooks, PhaseHook) -> IO a

#### Instances

Instances details

MonadIO HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods liftIO :: IO a -> HookedUse a Source #
MonadCatch HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods catch :: (HasCallStack, Exception e) => HookedUse a -> (e -> HookedUse a) -> HookedUse a Source #
MonadThrow HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods throwM :: (HasCallStack, Exception e) => e -> HookedUse a Source #
Applicative HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods pure :: a -> HookedUse a # (<*>) :: HookedUse (a -> b) -> HookedUse a -> HookedUse b # liftA2 :: (a -> b -> c) -> HookedUse a -> HookedUse b -> HookedUse c # (*>) :: HookedUse a -> HookedUse b -> HookedUse b # (<*) :: HookedUse a -> HookedUse b -> HookedUse a #
Functor HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods fmap :: (a -> b) -> HookedUse a -> HookedUse b # (<$) :: a -> HookedUse b -> HookedUse a #
Monad HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods (>>=) :: HookedUse a -> (a -> HookedUse b) -> HookedUse b # (>>) :: HookedUse a -> HookedUse b -> HookedUse b # return :: a -> HookedUse a #
MonadUse TPhase HookedUse Source # |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods use :: TPhase a -> HookedUse a Source #

runPipeline :: Hooks -> HookedUse a -> IO a Source #

The default mechanism to run a pipeline, see Note [The Pipeline Monad]

runPhase :: TPhase out -> IO out Source #

Default interpretation of each phase, in terms of IO.

runLlvmManglePhase :: PipeEnv -> HscEnv -> FilePath -> IO [Char] Source #

runMergeForeign :: PipeEnv -> HscEnv -> FilePath -> [FilePath] -> IO FilePath Source #

runLlvmLlcPhase :: PipeEnv -> HscEnv -> FilePath -> IO FilePath Source #

runLlvmOptPhase :: PipeEnv -> HscEnv -> FilePath -> IO FilePath Source #

runGenericAsPhase :: (Logger -> DynFlags -> [Option] -> IO ()) -> [Option] -> Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath Source #

runLlvmAsPhase :: Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath Source #

runAsPhase :: Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath Source #

runJsPhase :: PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath Source #

Run the JS Backend postHsc phase.

runForeignJsPhase :: PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath Source #

Deal with foreign JS files (embed them into .o files)

runCcPhase :: Phase -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> IO FilePath Source #

runHscBackendPhase :: PipeEnv -> HscEnv -> ModuleName -> HscSource -> ModLocation -> HscBackendAction -> IO ([FilePath], ModIface, HomeModLinkable, FilePath) Source #

runUnlitPhase :: HscEnv -> FilePath -> FilePath -> IO FilePath Source #

getFileArgs :: HscEnv -> FilePath -> IO (DynFlags, Messages PsMessage, Messages DriverMessage) Source #

runCppPhase :: HscEnv -> FilePath -> FilePath -> IO FilePath Source #

runHscPhase :: PipeEnv -> HscEnv -> FilePath -> HscSource -> IO (HscEnv, ModSummary, HscRecompStatus) Source #

mkOneShotModLocation :: PipeEnv -> DynFlags -> HscSource -> ModuleName -> IO ModLocation Source #

Calculate the ModLocation from the provided DynFlags. This function is only used in one-shot mode and therefore takes into account the effect of -o/-ohi flags (which do nothing in --make mode)

runHscTcPhase :: HscEnv -> ModSummary -> IO (FrontendResult, Messages GhcMessage) Source #

runHscPostTcPhase :: HscEnv -> ModSummary -> FrontendResult -> Messages GhcMessage -> Maybe Fingerprint -> IO HscBackendAction Source #

runHsPpPhase :: HscEnv -> FilePath -> FilePath -> FilePath -> IO FilePath Source #

phaseOutputFilenameNew Source #

Arguments

:: Phase | The next phase
-> PipeEnv |
-> HscEnv |
-> Maybe ModLocation | A ModLocation, if we are compiling a Haskell source file
-> IO FilePath |

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:

1. `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.
2. `PipelineOutput`: is this intended to be a `Temporary` or `Persistent` build output? Temporary files just go in a fresh temporary name.
3. `String`: what was the basename of the original input file?
4. `DynFlags`: the obvious thing
5. `Phase`: the phase we want to determine the output filename of.
6. `Maybe ModLocation`: the `ModLocation` 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?)

llvmOptions Source #

Arguments

:: LlvmConfig |
-> DynFlags |
-> [(String, String)] | pairs of (opt, llc) arguments

LLVM Options. These are flags to be passed to opt and llc, to ensure consistency we list them in pairs, so that they form groups.

hscPostBackendPhase :: HscSource -> Backend -> Phase Source #

What phase to run after one of the backend code generators has run

compileStub :: HscEnv -> FilePath -> IO FilePath Source #

joinObjectFiles :: HscEnv -> [FilePath] -> FilePath -> IO () Source #

See Note [Object merging].

getHCFilePackages :: FilePath -> IO [UnitId] Source #

linkDynLibCheck :: Logger -> TmpFs -> DynFlags -> UnitEnv -> [String] -> [UnitId] -> IO () Source #

touchObjectFile :: FilePath -> IO () Source #