COMPACT | NOCOMPACT

Category

Optimization and tuning

Pragma equivalent

#pragma option_override(subprogram_name, "OPT(COMPACT)")

Purpose

Avoids optimizations that increase object file size.

When the COMPACT option is in effect, the compiler favors those optimizations that tend to limit object file size.

When the NOCOMPACT option is in effect, the compiler might use optimizations that result in an increased object file size.

Syntax

Read syntax diagramSkip visual syntax diagramNOCOMPACTCOMPACT

Defaults

NOCOMPACT

Usage

During optimizations that are performed as part of code generation, for both NOIPA and IPA, choices must be made between those optimizations that tend to result in faster but larger code and those that tend to result in smaller but slower code. The COMPACT option influences these choices.

Because of the interaction between various optimizations, code that is compiled with the COMPACT option might not always generate smaller code and data.

When COMPACT is specified, as examples, it has the following effects:
  • Not all subprograms are inlined. To determine the final status of inlining, generate and check the inline report.
  • The compiler might not generate inline code for some built-in versions of the C library and the Metal C runtime library functions.
To evaluate the use of the COMPACT option for your application:
  • Compare the size of the objects generated with COMPACT and NOCOMPACT
  • Compare the size of the modules generated with COMPACT and NOCOMPACT
  • Compare the execution time of a representative workload with COMPACT and NOCOMPACT
If the objects and modules are smaller with an acceptable change in execution time, then you can consider the benefit of using COMPACT.

As new optimizations are added to the compiler, the behavior of the COMPACT option might change. You should reevaluate the use of this option for each new release of the compiler and when you change the application code.

The usage status of this option is inserted in the object file to aid you in diagnosing a problem with your program.

IPA effects

During a compilation with IPA Compile-time optimizations active, any subprogram-specific COMPACT option that is specified by #pragma option_override(subprogram_name, "OPT(COMPACT)") directives will be retained.

The IPA compile step generates information for the IPA link step. This option also affects the regular object module if you request one by specifying the IPA(OBJECT) option.

If you specify the COMPACT option for the IPA link step, it sets the compilation unit values of the COMPACT option that you specify. The IPA link step Prolog listing section will display the value of this option.

If you do not specify COMPACT option in the IPA link step, the setting from the IPA compile step for each compilation unit will be used.

In either case, subprogram-specific COMPACT options will be retained.

The IPA link step merges and optimizes your application code, and then divides it into sections for code generation. Each of these sections is a partition. The IPA link step uses information from the IPA compile step to determine if a subprogram can be placed in a particular partition. Only compatible subprograms are included in a given partition. Compatible subprograms have the same COMPACT setting.

The COMPACT setting for a partition is set to the specification of the first subprogram that is placed in the partition. Subprograms that follow are placed in partitions that have the same COMPACT setting. A NOCOMPACT subprogram is placed in a NOCOMPACT partition, and a COMPACT subprogram is placed in a COMPACT partition.

The option value that you specified for each IPA object file on the IPA compile step appears in the IPA link step Compiler Options Map listing section.

The Partition Map sections of the IPA link step listing and the object module END information section display the value of the COMPACT option. The Partition Map also displays any subprogram-specific COMPACT values.

Predefined macros

None.