Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
423ed147
Commit
423ed147
authored
Sep 04, 2007
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring only
parent
6756c643
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
49 deletions
+34
-49
compiler/main/HscMain.lhs
compiler/main/HscMain.lhs
+34
-49
No files found.
compiler/main/HscMain.lhs
View file @
423ed147
...
...
@@ -296,67 +296,52 @@ hscMkCompiler norecomp messenger frontend backend
-- Compilers
--------------------------------------------------------------
-- 1 2 3 4 5 6 7 8 9
-- Compile Haskell, boot and extCore in OneShot mode.
hscCompileOneShot :: Compiler HscStatus
hscCompileOneShot = hscCompileHardCode norecompOneShot oneShotMsg hscOneShot (hscConst (HscRecomp False))
hscCompileOneShot
= hscCompiler norecompOneShot oneShotMsg backend boot_backend
where
backend inp = hscSimplify inp >>= hscNormalIface >>= hscWriteIface >>= hscOneShot
boot_backend inp = hscSimpleIface inp >>= hscWriteIface >> return (HscRecomp False)
-- Compile Haskell, boot and extCore in batch mode.
hscCompileBatch :: Compiler (HscStatus, ModIface, ModDetails)
hscCompileBatch = hscCompileHardCode norecompBatch batchMsg hscBatch hscNothing
-- Compile to hardcode (C,asm,...). This general structure is shared by OneShot and Batch.
hscCompileHardCode :: NoRecomp result -- No recomp necessary
-> (Maybe (Int,Int) -> Bool -> Comp ()) -- Message callback
-> ((ModIface, ModDetails, CgGuts) -> Comp result) -- Compile normal file
-> ((ModIface, ModDetails, ModGuts) -> Comp result) -- Compile boot file
-> Compiler result
hscCompileHardCode norecomp msg compNormal compBoot hsc_env mod_summary =
compiler hsc_env mod_summary
where mkComp = hscMkCompiler norecomp msg
-- How to compile nonBoot files.
nonBootComp inp = hscSimplify inp >>= hscNormalIface >>=
hscWriteIface >>= compNormal
-- How to compile boot files.
bootComp inp = hscSimpleIface inp >>= hscWriteIface >>= compBoot
compiler
= case ms_hsc_src mod_summary of
ExtCoreFile
-> mkComp hscCoreFrontEnd nonBootComp
HsSrcFile
-> mkComp hscFileFrontEnd nonBootComp
HsBootFile
-> mkComp hscFileFrontEnd bootComp
hscCompileBatch
= hscCompiler norecompBatch batchMsg backend boot_backend
where
backend inp = hscSimplify inp >>= hscNormalIface >>= hscWriteIface >>= hscBatch
boot_backend inp = hscSimpleIface inp >>= hscWriteIface >>= hscNothing
-- Type-check Haskell, boot and extCore.
-- Does it make sense to compile extCore to nothing?
hscCompileNothing :: Compiler (HscStatus, ModIface, ModDetails)
hscCompileNothing hsc_env mod_summary
= compiler hsc_env mod_summary
where mkComp = hscMkCompiler norecompBatch batchMsg
pipeline inp = hscSimpleIface inp >>= hscIgnoreIface >>= hscNothing
compiler
= case ms_hsc_src mod_summary of
ExtCoreFile
-> mkComp hscCoreFrontEnd pipeline
HsSrcFile
-> mkComp hscFileFrontEnd pipeline
HsBootFile
-> mkComp hscFileFrontEnd pipeline
hscCompileNothing
= hscCompiler norecompBatch batchMsg backend backend
where
backend inp = hscSimpleIface inp >>= hscIgnoreIface >>= hscNothing
-- Compile Haskell, extCore to bytecode.
hscCompileInteractive :: Compiler (InteractiveStatus, ModIface, ModDetails)
hscCompileInteractive hsc_env mod_summary =
hscMkCompiler norecompInteractive batchMsg
frontend backend
hsc_env mod_summary
where backend inp = hscSimplify inp >>= hscNormalIface >>= hscIgnoreIface >>= hscInteractive
frontend = case ms_hsc_src mod_summary of
ExtCoreFile -> hscCoreFrontEnd
HsSrcFile -> hscFileFrontEnd
HsBootFile -> panic bootErrorMsg
bootErrorMsg = "Compiling a HsBootFile to bytecode doesn't make sense. " ++
"Use 'hscCompileBatch' instead."
hscCompileInteractive
= hscCompiler norecompInteractive batchMsg backend boot_backend
where
backend inp = hscSimplify inp >>= hscNormalIface >>= hscIgnoreIface >>= hscInteractive
boot_backend = panic "hscCompileInteractive: can't do boot files here"
hscCompiler
:: NoRecomp result -- No recomp necessary
-> (Maybe (Int,Int) -> Bool -> Comp ()) -- Message callback
-> (ModGuts -> Comp result) -- Compile normal file
-> (ModGuts -> Comp result) -- Compile boot file
-> Compiler result
hscCompiler norecomp msg nonBootComp bootComp hsc_env mod_summary =
hscMkCompiler norecomp msg frontend backend hsc_env mod_summary
where
(frontend,backend)
= case ms_hsc_src mod_summary of
ExtCoreFile -> (hscCoreFrontEnd, nonBootComp)
HsSrcFile -> (hscFileFrontEnd, nonBootComp)
HsBootFile -> (hscFileFrontEnd, bootComp)
--------------------------------------------------------------
-- NoRecomp handlers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment