On 2011-03-03, at 12:13 AM, Erick Lavoie wrote:
Thanks Marc, this information is really useful. I would be interested in knowing the time spent and memory allocated for the following phases in the machine code generation parts:
Register allocation (file: backend/linearscan.js) Block ordering (allocator.orderBlocks) Instruction numbering (allocator.numberInstrs) Interval construction (allocator.liveIntervals) Fixed interval construction (allocator.fixedIntervals) Linear Scan (allocator.linearScan) Operand assignation (allocator.assign) Resolution (allocator.resolution)
Machine code generation Translation (translator.prototype.genFunc) Assembly (asm.CodeBlock.prototype.assemble)
Those functions are all called in sequence in 'backend/backend.js' in function backend.compileIRToCB.
Erick
Here's what I get for the compilation of one of the bigger functions in parser/scanner.js:
===== Order blocks (0.001 s, 0.263 MB allocated) ===== Number instructions (0.021 s, 3.487 MB allocated) ===== Computing live intervals (0.141 s, 8.648 MB allocated) ===== Computing fixed intervals (0.016 s, 1.613 MB allocated) ===== Linear scan (4.633 s, 11.355 MB allocated) ===== Operand assignment (0.134 s, 2.246 MB allocated) ===== Resolution (4.626 s, 5.383 MB allocated) ===== IR to ASM translation (0.289 s, 29.091 MB allocated)
So "IR to ASM" takes the most space, followed by "linear scan" (about 1/3 of "IR to ASM").
The assembly also takes considerable time and space, but because it is done once for the whole file, it is hard to compare with the other times (which are per function).
Marc