Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - the watcom code generator performs such optimizations as common http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The Watcom Code Generator performs such optimizations as common
subexpression elimination, global flow analysis, and so on.

In some cases, the code generator can do a better job of optimizing code if
it could utilize more memory.  This is indicated when a


     Not enough memory to optimize procedure 'xxxx'

message appears on the screen as the source program is compiled.  In such an
event, you may wish to make more memory available to the code generator.

A special environment variable may be used to obtain memory usage
information or set memory usage limits on the code generator.  The WCGMEMORY
environment variable may be used to request a report of the amount of memory
used by the compiler's code generator for its work area.

Example:

     C>set WCGMEMORY=?

When the memory amount is "?" then the code generator will report how much
memory was used to generate the code.

It may also be used to instruct the compiler's code generator to allocate a
fixed amount of memory for a work area.

Example:

     C>set WCGMEMORY=128

When the memory amount is "nnn" then exactly "nnnK" bytes will be used.  In
the above example, 128K bytes is requested.  If less than "nnnK" is
available then the compiler will quit with a fatal error message.  If more
than "nnnK" is available then only "nnnK" will be used.

There are two reasons why this second feature may be quite useful.  In
general, the more memory available to the code generator, the more optimal
code it will generate.  Thus, for two personal computers with different
amounts of memory, the code generator may produce different (although
correct) object code.  If you have a software quality assurance requirement
that the same results (i.e., code) be produced on two different machines
then you should use this feature.  To generate identical code on two
personal computers with different memory configurations, you must ensure
that the WCGMEMORY environment variable is set identically on both machines.

The second reason where this feature is useful is on virtual memory paging
systems (e.g., OS/2) where an unlimited amount of memory can be used by the
code generator.  If a very large module is being compiled, it may take a
very long time to compile it.  The code generator will continue to allocate
more and more memory and cause an excessive amount of paging.  By
restricting the amount of memory that the code generator can use, you can
reduce the amount of time required to compile a routine.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson