haddock documentation available for source code
Compiler optimizations
The sometimes exploding size of generated gfc and
gfr files has made it urgent to find optimizations
that reduce the size of the code. There are five
combinations optimizations that can be chosen, as the value of the
optimize flag:
- share: group tables so that common branch values are shared
by the use of disjunctive patterns.
- parametrize: if table branches differ at most at the
occurrence of the pattern, replace the expanded table by a one-branch
table with a variable. If this fails, perform share.
- values: only show the values of table branches, not the
patterns.
- all: try parametrize; if this fails, do values.
- none: don't do any optimizations
The share and parametrize optimizations are always
just good, whereas the values optimization may slow down the
use of the table. However, it is very good for grammars mostly consisting
of the inflection tables of lexical items: it can reduce the file size
by the factor of 4.
An optimization can be selected individually for each
resource and concrete module by including
the judgement
flags optimize=(share|parametrize|values|all|none) ;
in the module body. These flags can be overridden by a flag given
in the i command, e.g.
i -src -optimize=none Foo.gf
Notice that the option -src is needed if there already are
generated files created with other optimization flags.