Sun Studio 12: C++ User's Guide

A.2.117 -xcrossfile[=n]

SPARC: Enables optimization and inlining across source files. -xcrossfile works at compile time and involves only the files that appear on the compilation command. Consider the following command-line example:


example% CC -xcrossfile -xO4 -c f1.cc f2.cc
example% CC -xcrossfile -xO4 -c f3.cc f4.cc

Cross-module optimizations occur between files f1.cc and f2.cc, and between f3.cc and f4.cc. No optimizations occur between f1.cc and f3.cc or f4.cc.

A.2.117.1 Values

n must be one of the following values.

Table A–30 The -xcrossfile Values

Value 

Meaning  

0

Do not perform cross-file optimizations or cross-file inlining. 

1

Perform optimization and inlining across source files. 

Normally the scope of the compiler’s analysis is limited to each separate file on the command line. For example, when the -xO4 option is passed, automatic inlining is limited to subprograms defined and referenced within the same source file.

With -xcrossfile or -xcrossfile=1, the compiler analyzes all the files named on the command line as if they had been concatenated into a single source file.

Defaults

If -xcrossfile is not specified, -xcrossfile=0 is assumed and no cross-file optimizations or inlining are performed.

-xcrossfile is the same as -xcrossfile=1.

Interactions

The -xcrossfile option is effective only when it is used with -xO4 or -xO5.

Warnings

The files produced from this compilation are interdependent due to possible inlining, and must be used as a unit when they are linked into a program. If any one routine is changed and the files recompiled, they must all be recompiled. As a result, using this option affects the construction of makefiles.

See Also

-xldscope