OT: Code Examples

Erik de Castro Lopo erikd at mega-nerd.com
Wed Mar 9 19:51:26 EST 2011


Erik de Castro Lopo wrote:

> Paul Rubin wrote:
>
> > Anyway, try googling "evil mangler"
> 
> I know what the "evil mangler" is. It was called that because it
> threw away all the principles of good software design in favour
> of expediency. GHC now has a new LLVM backend which does not
> depend on the evil mangler and I strongly suspect that the backend
> which uses the evil mangler will be dumped in the next year or
> two.

I have some more information about the replacement of the Evil
Mangler. According to this paper:

   http://llvm.org/pubs/2010-09-HASKELLSYM-LLVM-GHC.pdf

the new LLVM backend for the GHC compiler still has a mangler
phase, but the new LLVM Mangler is 180 lines of heavily
commented Haskell code which replaces a 2000 lines of poorly 
commented Perl script.

Full disclosure: the Perl mangler needs to parse the GNU assembler
code while the Haskell mangler only needs to operate on data
structures already defined elesewhere. However, the Evil Mangler
only handled a small subset of CPU architectures, while the new
LLM Mangler works on the architecture independent LLVM intermediate
representation.

> > and ask why it wasn't done in Haskell.  Same idea.
> 
> Expediency over common sense?

Ignoring the parsing issue, this shows that Haskell was
certainly up to the task of doing everything the Evil 
Mangler was doing.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the Python-list mailing list