The command line options to enable IPO for compilations targeted for IA-32, Intel® EM64T, and Itanium® architectures are identical.
To produce mock object files containing IR, compile your source files with -ipo (Linux*) or /Qipo (Windows*) as demonstrated below:
Platform |
Example Command |
---|---|
Linux* |
icpc -ipo -c a.cpp b.cpp c.cpp |
Windows* |
icl /Qipo /c a.cpp b.cpp c.cpp |
The output of the above example command differs according to platform:
Linux: The commands produce a.o, b.o, and c.o object files.
Windows: The commands produce a.obj, b.obj, and c.obj object files.
Use -c (Linux) or /c (Windows) to stop compilation after generating .o (Linux) or .obj (Windows) files. The output files contain Intel® compiler intermediate representation (IR) corresponding to the compiled source files.
Optimize interprocedurally by linking with the Intel® compiler or with the Intel linkers: xild (Linux) or xilink (Windows). The following examples produce an executable named app:
Platform |
Example Command |
---|---|
Linux |
icpc -oapp a.o b.o c.o |
Windows |
icl /Feapp a.obj b.obj c.obj |
This command invokes the compiler on the objects containing IR and creates a new list of objects to be linked. Alternately, you can use the xild (Linux) or xilink (Windows) tool instead of icpc (Linux) or icl (Windows) with the appropriate linker options.
The separate commands demonstrated above can be combined into a single command, as shown in the following examples:
Platform |
Example Command |
---|---|
Linux |
icpc -ipo -oapp a.f b.f c.f |
Windows |
icl /Qipo /Feapp a.cpp b.cpp c.cpp |
The icl/icpc command, shown in the examples above, calls GCC ld (Linux only) or Microsoft* link.exe (Windows only) to link the specified object files and produce the executable application, which is specified by the -o (Linux) or /Fe (Windows) option. Multifile IPO is applied only to the source files that have an IR; otherwise, the object file passes to link stage.