Changes between Version 32 and Version 33 of Commentary/Pipeline


Ignore:
Timestamp:
Jan 16, 2013 11:53:44 AM (3 years ago)
Author:
jstolarek
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Pipeline

    v32 v33  
    4949}}}
    5050
    51 = The compilation pipeline =
     51= The driver pipeline =
    5252
    53 When GHC compiles a module, it calls other programs, and generates a series of intermediate files.  Here's a summary of the process.
    54 (source reference: [[GhcFile(compiler/main/DriverPipeline.hs)]])
     53The driver pipeline consist of a couple of phases that call other programs and generate a series of intermediate files. Code responsible for managing the order of phases is in [[GhcFile(compiler/main/DriverPhases.hs)]], while managing the driver pipeline as a whole is coded in [[GhcFile(compiler/main/DriverPipeline.hs)]]. Note that driver pipeline is not the same thing as compilation pipeline: the latter is part of the former.
    5554
    56 We start with {{{Foo.hs}}} or {{{Foo.lhs}}}, the "l" specifing whether literate style is being used.
     55Let's take a look at the overall structure of the driver pipeline. When we compile {{{Foo.hs}}} or {{{Foo.lhs}}} ("lhs" extension means that Literate Haskell is being used) the following phases are being called (some of them depending on additional conditions like file extensions or enabled flags):
    5756
    5857 * Run the '''unlit pre-processor''', {{{unlit}}}, to remove the literate markup, generating {{{Foo.lpp}}}.  The {{{unlit}}} processor is a C program kept in [[GhcFile(utils/unlit)]].
     
    6059 * Run the '''C preprocessor''', `cpp`, (if {{{-cpp}}} is specified), generating {{{Foo.hspp}}}.
    6160
    62  * Run '''the compiler itself'''. This does not start a separate process; it's just a call to a Haskell function.  This step always generates an [wiki:Commentary/Compiler/IfaceFiles '''interface file'''] {{{Foo.hi}}}, and depending on what flags you give, it also generates a compiled file. As GHC supports three backend code generators currently (a native code generator, a c code generator and an llvm code generator) the possible range of outputs depends on the backend used. All three support assembly output:
     61 * Run '''the compiler itself'''. This does not start a separate process; it's just a call to a Haskell function.  This step always generates an [wiki:Commentary/Compiler/IfaceFiles '''interface file'''] {{{Foo.hi}}}, and depending on what flags you give, it also generates a compiled file. As GHC supports three backend code generators currently (a native code generator, a C code generator and an llvm code generator) the possible range of outputs depends on the backend used. All three support assembly output:
    6362   * Object code: no flags required, file {{{Foo.o}}} (supported by all three backends)
    6463   * Assembly code: flag {{{-S}}}, file {{{Foo.s}}} (supported by all three backends)