| | 404 | Now you know the basic working and purpose of the register optimizer, let's look at the implementation. Following the design principle of PIRC to be as modular as possible, the register optimizer's state is stored in a struct. A new [source:/trunk/compiler/pirc/src/pirregalloc.h#L66 lsr_allocator] object (lsr stands for Linear Scan Register) can be created in the function [source:/trunk/compilers/pirc/src/pirregalloc.c#L85 new_linear_scan_register_allocator]. This constructor takes a pointer to the PIRC compiler struct instance. Yes, this does mean it is somewhat dependent on this other object, but it made the implementation somewhat easier. |