Changes between Version 1 and Version 2 of Commentary/EvilMangler


Ignore:
Timestamp:
Oct 4, 2006 8:28:43 PM (9 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/EvilMangler

    v1 v2  
    11
    22
    3 = The Evil Mangler =
     3= HC files and the Evil Mangler =
     4
     5
     6GHC uses {{{gcc}}} as a code generator, in a very stylised way:
     7 * Generate {{{Foo.hc}}}
     8 * Compile it with {{{gcc}}}, using {{{register}}} declarations to nail a bunch of things into registers (e.g. the allocation pointer)
     9 * Post-process the generated assembler code with the Evil Mangler
    410
    511The Evil Mangler (EM) is a Perl script invoked by GHC after the C compiler (gcc) has translated the GHC-produced C code into assembly. Consequently, it is only of interest if {{{-fvia-C}}} is in effect (either explicitly or implicitly).
     12
     13== What the Evil Mangler does ==
    614
    715The EM reads the assembly produced by gcc and re-arranges code blocks as well as nukes instructions that it considers non-essential. It derives it evilness from its utterly ad hoc, machine, compiler, and whatnot dependent design and implementation. More precisely, the EM performs the following tasks: