summaryrefslogtreecommitdiff
path: root/compiler/main/CodeOutput.hs
diff options
context:
space:
mode:
authorPeter Wortmann <scpmw@leeds.ac.uk>2014-11-29 00:07:48 +0100
committerAustin Seipp <austin@well-typed.com>2014-12-16 15:02:39 -0600
commitf46aa7338cd0318e8cd7b3a760dd6024576e0fbb (patch)
treec7676e8eb55a4abd880312938609d1c8b424ee32 /compiler/main/CodeOutput.hs
parent711a51adcf8b32801289478443549947eedd49a2 (diff)
downloadhaskell-f46aa7338cd0318e8cd7b3a760dd6024576e0fbb.tar.gz
Debug data extraction (NCG support)
The purpose of the Debug module is to collect all required information to generate debug information (DWARF etc.) in the back-ends. Our main data structure is the "debug block", which carries all information we have about a block of code that is going to get produced. Notes: * Debug blocks are arranged into a tree according to tick scopes. This makes it easier to reason about inheritance rules. Note however that tick scopes are not guaranteed to form a tree, which requires us to "copy" ticks to not lose them. * This is also where we decide what source location we regard as representing a code block the "best". The heuristic is basically that we want the most specific source reference that comes from the same file we are currently compiling. This seems to be the most useful choice in my experience. * We are careful to not be too lazy so we don't end up breaking streaming. Debug data will be kept alive until the end of codegen, after all. * We change native assembler dumps to happen right away for every Cmm group. This simplifies the code somewhat and is consistent with how pretty much all of GHC handles dumps with respect to streamed code. (From Phabricator D169)
Diffstat (limited to 'compiler/main/CodeOutput.hs')
-rw-r--r--compiler/main/CodeOutput.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/main/CodeOutput.hs b/compiler/main/CodeOutput.hs
index cdb81b7f9e..f55a15a842 100644
--- a/compiler/main/CodeOutput.hs
+++ b/compiler/main/CodeOutput.hs
@@ -76,7 +76,8 @@ codeOutput dflags this_mod filenm location foreign_stubs pkg_deps cmm_stream
; stubs_exist <- outputForeignStubs dflags this_mod location foreign_stubs
; case hscTarget dflags of {
- HscAsm -> outputAsm dflags this_mod filenm linted_cmm_stream;
+ HscAsm -> outputAsm dflags this_mod location filenm
+ linted_cmm_stream;
HscC -> outputC dflags filenm linted_cmm_stream pkg_deps;
HscLlvm -> outputLlvm dflags filenm linted_cmm_stream;
HscInterpreted -> panic "codeOutput: HscInterpreted";
@@ -138,8 +139,10 @@ outputC dflags filenm cmm_stream packages
************************************************************************
-}
-outputAsm :: DynFlags -> Module -> FilePath -> Stream IO RawCmmGroup () -> IO ()
-outputAsm dflags this_mod filenm cmm_stream
+outputAsm :: DynFlags -> Module -> ModLocation -> FilePath
+ -> Stream IO RawCmmGroup ()
+ -> IO ()
+outputAsm dflags this_mod location filenm cmm_stream
| cGhcWithNativeCodeGen == "YES"
= do ncg_uniqs <- mkSplitUniqSupply 'n'
@@ -147,7 +150,7 @@ outputAsm dflags this_mod filenm cmm_stream
_ <- {-# SCC "OutputAsm" #-} doOutput filenm $
\h -> {-# SCC "NativeCodeGen" #-}
- nativeCodeGen dflags this_mod h ncg_uniqs cmm_stream
+ nativeCodeGen dflags this_mod location h ncg_uniqs cmm_stream
return ()
| otherwise