The command line options to enable IPO for compilations targeted for both the IA-32 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* |
ifort -ipo -c a.f b.f c.f |
Windows* |
ifort /Qipo /c a.f b.f c.f |
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.
You must 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.
You can now 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 |
ifort -oapp a.o b.o c.o |
Windows |
ifort /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 ifort 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 |
ifort -ipo -oapp a.f b.f c.f |
Windows |
ifort /Qipo /Feapp a.f b.f c.f |
The ifort 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.