docs/imcc/README.pod - Readme file for IMCC.
This README sets out the Intermediate Code Compiler (IMCC) for Parrot. The language it compiles is currently termed Parrot Intermediate Language (PIR).
Why? Writing a compiler is a significant undertaking, and we are trying to elevate some of the burden on potential language designers, including the designers of the Perl6 compiler. We can provide a common back-end for Parrot that does the following:
This way, language designers can get right to work on
They, then, can simply feed PIR to IMCC which will compile directly to Parrot bytecode.[*]
The allocator uses graph-coloring and du-chains to assign registers to lexicals and symbolic temporaries. One weakness of the allocator is the lack of branch analysis. A brute force method is used in the du-chain computation where we assume any symbol is live from the time it was first used until either the last time it was used or the last branch instruction. This is being replaced with directed graphs of basic blocks and flow analysis.
We break the instructions into a directed graph of basic blocks. The plan is to translate to SSA form to make optimizations easier.
Until Perl6 compiles itself (and does it fast), a Bison parser is the easiest to maintain. An additional, important benefit, is C-based parsers are pretty darn fast. Currently assembling Parrot on the fly is still relatively slow.
Instructions not known to IMCC are looked up in parrot's op_info_table and must have the proper amount and types of arguments.
Please email firstname.lastname@example.org with any bug-reports or patches.
Melvin Smith <email@example.com>, <firstname.lastname@example.org>
[*] So far, all the compiler does is register allocation and spilling. I like Steve Muchnick's MIR language, and I'm taking a few things from it.
I expect the IR compiler to be FAST, simple, and maintainable, and never to develop featuritis; however I want it to be adequate for all languages targeting parrot. Did I mention it needs to be FAST?
Copyright (C) 2001-2012, Parrot Foundation.