Building Metal C programs with IPA

Starting with z/OS® V1R13 XL C compiler, the IPA option can be used with the METAL option. IPA is an optimization option that enables the compiler to find more optimization opportunities to improve your application performance. For more information about IPA, see the Using the IPA option section in z/OS XL C/C++ Programming Guide and the IPA considerations section in z/OS XL C/C++ User's Guide.
Figure 1. The process of building Metal C programs with IPA
The process of building Metal C programs with IPA flow diagram is shown.
You need to be aware of the following adjustments when invoking IPA for METAL.
The following compiler options are not supported by METAL with IPA:
The following IPA suboptions are not supported with the METAL option:
The following IPA control file directives are not supported with the METAL option:

Example

The following example shows how to compile a Metal C program with IPA.
IPA compile phase:
xlc -qmetal -qipa -c x.c
xlc -qmetal -qipa -c y.c
The above commands produce x.o and y.o.
Notes:
  1. The -c option indicates compile.
  2. No HLASM output is generated.
  3. The objects are IPA objects, which can only be used for IPA link.
  4. LONGNAME is implicitly turned on.
IPA link phase:
xlc -qmetal -qipa -S x.o y.o
This command produces a.s.
Note: The structure of the compiler-generated HLASM source program is similar to that described in Structure of a compiler-generated HLASM source program, except that at IPA link there could be multiple structures in the HLASM source program, one for each partition.

The rest of the build process is similar to building Metal C programs without IPA. You need to add the assembly step to produce the object file from the IPA link generated HLASM source file. You also need to supply the object file produced by the assembler along with all other library data sets to the binder for producing the final executable program.

Assembly phase:
as -mgoff a.s
This command produces a.o.
Note: The HLASM GOFF option must be specified because of the LONGNAME compiler option requirement with IPA.
Bind/Link phase:
ld -b case=mixed -e main a.o
This command produces a.out.
Note: Because of the LONGNAME compiler option requirement with IPA, you should use the -b case=mixed ld utility option and the -e option with the entry point in its original case.