Changes between Version 18 and Version 19 of Commentary/Pipeline


Ignore:
Timestamp:
Oct 4, 2006 8:53:12 PM (8 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Pipeline

    v18 v19  
    1 [ Up: [wiki:Commentary] ] 
     1 
    22 
    33= The compilation pipeline = 
     
    1212 * Run the '''C preprocessor''', `cpp`, (if {{{-cpp}}} is specified), generating {{{Foo.cpp}}} or {{{Foo.hspp}}} respectively. 
    1313 
    14  * 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 '''interface file''' {{{Foo.hi}}}, and depending on what flags you give, it also generates a compiled file: 
     14 * 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: 
    1515   * Assembly code: flag {{{-S}}}, file {{{Foo.s}}} 
    1616   * C code: flag {{{-fviaC}}}, file {{{Foo.hc}}} 
     
    2323  * Run the assembler on `Foo.s` or, if `-fsplit-objs` in in force, on each individual assembly file. 
    2424 
    25 == Interface files == 
    26  
    27 An '''interface file''' supports separate compilation by recording the information gained by compiling {{{M.hs}}} in its interface file {{{M.hi}}}.  Morally speaking, the interface file {{{M.hi}}} is part of the object file {{{M.o}}}; it's like a super symbol-table for {{{M.o}}}. 
    28  
    29 Interface files are kept in binary, GHC-specific format.  The format of these files changes with each GHC release, but not with patch-level releases.  The contents of the interface file is, however, completely independent of the back end you are using (`-fviaC`, `-fasm`, `-fcmm` etc). 
    30  
    31 Although interface files are kept in binary format, you can print them in human-readable form using the command: 
    32 {{{ 
    33   ghc --show-iface M.hi 
    34 }}} 
    35 This textual format is not particularly designed for machine parsing.  Doing so might be possible, but if you want to read GHC interface files you are almost certainly better off using the [wiki:Commentary/Compiler/API GHC API] to do so. 
    36  
    37 Here are some of the things stored in an interface file {{{M.hi}}} 
    38  * A list of what {{{M}}} exports. 
    39  * The types of exported functions, definition of exported types, and so on. 
    40  * Version information, used to drive the smart recompilation checker. 
    41  * The strictness, arity, and unfolding of exported functions.  This is crucial for cross-module optimisation; but it is only included when you compile with {{{-O}}}. 
    42  
    43 The contents of an interface file is the result of serialising the '''{{{IfaceSyn}}}''' family of data types.  The data types are in [[GhcFile(compiler/iface/IfaceSyn)]] and [[GhcFile(compiler/iface/IfaceType)]]; the binary serialisation code is in [[GhcFile(compiler/iface/BinIface)]].