Activating the Optimizer Compiler

To activate the Natural Optimizer Compiler, use one of the methods described in the following sections, where the first alternative is the most static one and the last alternative the most dynamic one.

All alternatives use the Optimizer options as described in the section Optimizer Options. Using these options you can control how and when machine code is generated, what tracing options are to be used and what the target architecture will be. The Optimizer options are the only control mechanism for the Natural Optimizer Compiler.


Macro NTOPT

With the macro NTOPT in the Natural parameter module, you can activate the Natural Optimizer Compiler statically for a linked Natural nucleus. Every time this Natural nucleus is started, the same Optimizer options are used again.

Example 1:

         NTOPT 'INDX,OVFLW,ZD=OFF'

Example 2:

         NTOPT 'INDX,OVFLW,ZD=OFF,TRGPT',                              *
               'TRSTMT,OPTLEV03'

Note the continuation character "*" in column 72.

See the section Optimizer Options for an explanation of the options setting used.

Dynamic Profile Parameter OPT

When starting a Natural session, you can dynamically activate the Optimizer Compiler by specifying the Natural profile parameter OPT. As a synonym for OPT, you can use MCG. The specification of the parameter module is overwritten. The options are only valid for the current session.

Example:

OPT=(INDX,OVFLW,ZD=OFF)

or

MCG=(INDX,OVFLW,ZD=OFF)

See the section Optimizer Options for an explanation of the option setting used.

System Command NOCOPT

When you have started a Natural session, you can invoke the Optimizer command screen with the Natural system command NOCOPT. The screen monitors the current setting of the Natural Optimizer Compiler options as they were specified during Natural startup. You can now modify the setting online.

The updated parameter setting is only valid for the current session.

Natural Statement OPTIONS

The MCG parameter of the Natural compiler statement OPTIONS provides the most flexible and powerful control over machine code generation, since different options can be set for individual statements in a program. So, within one Natural program, the Natural Optimizer Compiler can be activated and deactivated several times to enclose ranges of statements with different options settings.

Example

OPTIONS MCG=(OVFLW,INDX,ZD=OFF)

or

OPTIONS MCG=OVFLW,INDX,ZD=OFF

The options string of the MCG parameter may start with a plus (+) or minus (-) sign, indicating that the values of options not mentioned should be left unaltered, and only the options present should be set (+) or reset (-), for example:

Example:

    OPTIONS MCG=+PGEN         /* turns tracing on
  
   (statements to be traced)
  
  OPTIONS MCG=-PGEN         /* turns tracing off

If the string starts with anything other than "+" or "-", all options are reset before the string is parsed.

Anmerkung:
The Natural statement OPTIONS also provides other Natural compiler parameters than MCG.

See the section Optimizer Options for an explanation of the options setting used.