| C User's Guide |
ccCompiler OptionsThis chapter describes the C compiler options and is organized into the following sections:
If you are porting a K&R C program to ANSI/ISO C, make special note of the section on compatibility flags, -X[a|c|s|t]. Using them makes the transition to ANSI/ISO C easier. Also refer to the discussion on the transition in Transitioning to ANSI/ISO C.
Option Syntax
The syntax of the
cccommand is:
%cc[options]filenames[libraries]...
- options represents one or more of the options described in The cc Options
- filenames represents one or more files used in building the executable program
ccaccepts a list of C source files and object files contained in the list of files specified by filenames. The resulting executable code is placed ina.out, unless the-ooption is used. In this case, the code is placed in the file named by the-ooption.- Use
ccto compile and link any combination of the following:
- C source files, with a
.csuffix- Inline template files, with a
.ilsuffix (only when specified with.cfiles)- C preprocessed source files, with a
.isuffix- Object-code files, with
.osuffixes- Assembler source files, with
.ssuffixes- libraries represents any of a number of standard or user-provided libraries containing functions, macros, and definitions of constants.
See option
-YP, dir to change the default directories used for finding libraries. dir is a colon-separated path list. The default library search order forccis:
ccusesgetoptto parse command-line options. Options are treated as a single letter or a single letter followed by an argument. Seegetopt(3c).Options Summary
In this section, the compiler options are grouped by function to provide an easy reference. The details are in the sections of the following pages. The following table summarizes the cc compiler options by functionality. Some flags serve more than one purpose and appear more than once.
The
ccOptionsThis section describes the
ccoptions, arranged alphabetically. These descriptions are also available in the man page,cc(1). Use thecc-flagsoption for a one-line summary of these descriptions.Options noted as being unique to one or more platforms are accepted without error and ignored on all other platforms. For an explanation of the typographic notations used with the options and arguments, refer to Typographic Conventions.
-#Turns on verbose mode, showing each component as it is invoked.
-###Shows each component as it would be invoked, but does not actually execute it.
-Aname[(tokens)]Associates name as a predicate with the specified tokens as if by a
#assertpreprocessing directive. Preassertions:
system(unix)machine(sparc)(SPARC)machine(i386)(x86)cpu(sparc)(SPARC)cpu(i386)(x86)These preassertions are not valid in
-Xcmode.
-B[static|dynamic]Specifies whether bindings of libraries for linking are
staticordynamic, indicating whether libraries are non-shared or shared, respectively.
-Bdynamiccauses the link editor to look for files namedlibx.soand then for files namedlibx.awhen given the-lx option.
-Bstaticcauses the link editor to look only for files namedlibx.a. This option may be specified multiple times on the command line as a toggle. This option and its argument are passed told.
Note Many system libraries, such aslibc, are only available as dynamic libraries in the Solaris 64-bit compilation environment. Therefore, do not use-Bstaticas the last toggle on the command line.
-CPrevents the C preprocessor from removing comments, except those on the preprocessing directive lines.
-cDirects
ccto suppress linking withld(1) and to produce a.ofile for each source file. You can explicitly name a single object file using the-ooption. When the compiler produces object code for each.ior.cinput file, it always creates an object (.o) file in the current working directory. If you suppress the linking step, you also suppress the removal of the object files.
-Dname[=tokens]Associates name with the specified tokens as if by a
#definepreprocessing directive. If no=tokens is specified, the token1is supplied.Predefinitions (not valid in
-Xcmode):
sununixsparc(SPARC)i386(x86)The following predefinitions are valid in all modes.
__sparcv9(-Xarch=v9,v9a)
__sun __unix __SUNPRO_C=0x510__`uname -s`_`uname -r` (example:__SunOS_5_7)__sparc(SPARC)__i386(x86)__BUILTIN_VA_ARG_INCR__SVR4The following is predefined in
-Xaand-Xtmodes only:__RESTRICT
The compiler also predefines the object-like macro
__PRAGMA_REDEFINE_EXTNAME,to indicate the pragma will be recognized.
-d[y|n]
-dyspecifies dynamic linking, which is the default, in the link editor.
-dnspecifies static linking in the link editor.This option and its arguments are passed to
ld(1).
Note Many system libraries are only available as dynamic libraries in the Solaris 7 64-bit compilation environment. As a result, this option causes fatal errors if you use it in combination with-Xarch=v9.
-dalign
-dalignis equivalent to-xmemalign=8s. See -xmemalign=ab.
-ERuns the source file through the preprocessor only and sends the output to
stdout. The preprocessor is built directly into the compiler, except in-Xsmode, where/usr/ccs/lib/cppis invoked. Includes the preprocessor line numbering information. See also the-Poption.
-erroff=tSuppresses
ccwarning messages. Has no effect on error messages.t is a comma-separated list that consists of one or more of the following: tag,
no%tag,%all,%none. Order is important; for example,%all,no%tag suppresses all warning messages except tag. The following table lists the-erroffvalues:
The default is
-erroff=%none. Specifying-erroffis equivalent to specifying-erroff=%all.You can achieve finer control over error message suppression. See #pragma error_messages (on|off|default,tag... tag).
-errtags=aDisplays the message tag for each warning message.
a can be either
yesorno. The default is-errtags=no. Specifying-errtagsis equivalent to specifying-errtags=yes.
-errwarn=tIf the indicated warning message is issued, cc exits with a failure status. t is a comma-separated list that consists of one or more of the following: tag,
no%tag,%all,%none. Order is important; for example%all,no%tag causesccto exit with a fatal status if any warning except tag is issued. The following table list the-errwarnvalues:
The default is
-errwarn=%none. If you specify-errwarnalone, it is equivalent to-errwarn=%all.
-fastSelects the optimum combination of compilation options for speed. This should provide close to the maximum performance for most realistic applications. Modules compiled with
-fastmust also be linked with-fast.The
-fastoption is unsuitable for programs intended to run on a different target than the compilation machine. In such cases, follow-fastwith the appropriate xtarget option. For example:
cc -fast -xtarget=ultra ...
For C modules that depend on exception handling specified by SVID, follow
-fastby-xnolibmil:
% cc -fast -xnolibmil
With
-xlibmil, exceptions cannot be noted by settingerrnoor callingmatherr(3m).The
-fastoption is unsuitable for programs that require strict conformance to the IEEE 754 Standard.The following table lists the set of options selected by
-fastacross platforms.
-dalignX - -fnsX X -fsimple=2X - -ftrap=%noneX X -xlibmilX X -xtarget=nativeX X -nofstore- X -xO5X X -fsingleX X
-fastacts like a macro expansion on the command line. Therefore, you can override the optimization level and code generation option aspects by following-fastwith the desired optimization level or code generation option. Compiling with the-fast -xO4pair is like compiling with the-xO2 -xO4pair. The latter specification takes precedence.In previous releases, the
-fastmacro option included-fnonstd; now it includes-fnsinstead.You can usually improve performance for most programs with this option.
Do not use this option for programs that depend on IEEE standard exception handling; you can get different numerical results, premature program termination, or unexpected
SIGFPEsignals.
-fdReports K&R-style function definitions and declarations.
-flagsPrints a brief summary of each available compiler option.
-fnonstdCauses nonstandard initialization of floating-point arithmetic hardware. In addition, the
-fnonstdoption causes hardware traps to be enabled for floating-point overflow, division by zero, and invalid operations exceptions. These are converted intoSIGFPEsignals; if the program has noSIGFPEhandler, it terminates with a memory dump.By default, IEEE 754 floating-point arithmetic is nonstop, and underflows are gradual. (See Nonstandard Floating Point for a further explanation.)
(SPARC) Synonym for
-fns -ftrap=common.
-fns[={no,yes}](SPARC) Turns on the SPARC nonstandard floating-point mode.
The default is
-fns=no, the SPARC standard floating-point mode.-fnsis the same as-fns=yes.Optional use of
=yesor=noprovides a way of toggling the-fnsflag following some other macro flag that includes-fns, such as-fast. This flag enables the nonstandard floating point mode when a program begins execution. By default, the non-standard floating point mode will not be enabled automatically.On some SPARC systems, the nonstandard floating point mode disables "gradual underflow," causing tiny results to be flushed to zero rather than producing subnormal numbers. It also causes subnormal operands to be replaced silently by zero. On those SPARC systems that do not support gradual underflow and subnormal numbers in hardware, use of this option can significantly improve the performance of some programs.
When nonstandard mode is enabled, floating point arithmetic may produce results that do not conform to the requirements of the IEEE 754 standard. See the Numerical Computation Guide for more information.
This option is effective only on SPARC systems and only if used when compiling the main program. On x86 systems, the option is ignored.
-fprecision=p(x86)
-fprecision={single,double,extended}Initializes the rounding-precision mode bits in the Floating-point Control Word to single (24 bits), double (53 bits), or extended (64 bits), respectively. The default floating-point rounding-precision mode is extended.
Note that on Intel, only the precision, not exponent, range is affected by the setting of floating-point rounding precision mode.
-fround=rSets the IEEE 754 rounding mode that is established at runtime during the program initialization.
r must be one of:
nearest,tozero,negative,positive.The default is
-fround=nearest.The meanings are the same as those for the
ieee_flagssubroutine.When r is
tozero,negative, orpositive, this flag sets the rounding direction mode to round-to-zero, round-to-negative-infinity, or round-to-positive-infinity respectively when a program begins execution. When r isnearestor the-froundflag is not used, the rounding direction mode is not altered from its initial value (round-to-nearest by default).This option is effective only if used when compiling the main program.
-fsimple[=n]Allows the optimizer to make simplifying assumptions concerning floating-point arithmetic.
If n is present, it must be
0,1, or2. The defaults are:
- With no
-fsimple[=n], the compiler uses-fsimple=0- With only
-fsimple, no=n, the compiler uses-fsimple=1
-fsimple=0Permits no simplifying assumptions. Preserve strict IEEE 754 conformance.
-fsimple=1Allows conservative simplifications. The resulting code does not strictly conform to IEEE 754, but numeric results of most programs are unchanged.
With
-fsimple=1, the optimizer can assume the following:
- IEEE 754 default rounding/trapping modes do not change after process initialization.
- Computations producing no visible result other than potential floating point exceptions may be deleted.
- Computations with Infinity or NaNs as operands need not propagate NaNs to their results; for example,
x*0may be replaced by0.- Computations do not depend on sign of zero.
With
-fsimple=1, the optimizer is not allowed to optimize completely without regard to roundoff or exceptions. In particular, a floating-point computation cannot be replaced by one that produces different results with rounding modes held constant at runtime. The-fastmacroflag includes-fsimple=1.
-fsimple=2Permits aggressive floating point optimizations that may cause many programs to produce different numeric results due to changes in rounding. For example,
-fsimple=2permits the optimizer to replace all computations ofx/yin a given loop withx*z, wherex/yis guaranteed to be evaluated at least once in the loop,z=1/y, and the values ofyandzare known to have constant values during execution of the loop.Even with
-fsimple=2, the optimizer is not permitted to introduce a floating point exception in a program that otherwise produces none.
-fsingle(
-Xtand-Xsmodes only) Causes the compiler to evaluatefloatexpressions as single precision rather than double precision. This option has no effect if the compiler is used in either-Xaor-Xcmodes, asfloatexpressions are already evaluated as single precision.
-fstore(x86) Causes the compiler to convert the value of a floating-point expression or function to the type on the left-hand side of an assignment, when that expression or function is assigned to a variable, or when the expression is cast to a shorter floating-point type, rather than leaving the value in a register. Due to rounding and truncation, the results may be different from those that are generated from the register value. This is the default mode.
To turn off this option, use the
-nofstoreoption.
-ftrap=tSets the IEEE 754 trapping mode in effect at startup.
t is a comma-separated list that consists of one or more of the following:
%all,%none,common, [no%]invalid, [no%]overflow, [no%]underflow, [no%]division, [no%]inexact.This option sets the IEEE 754 trapping modes that are established at program initialization. Processing is left-to-right. The
commonexceptions, by definition, are invalid, division by zero, and overflow.Example:
-ftrap=%all,no%inexactmeans set all traps, exceptinexact.The meanings are the same as for the
ieee_flagssubroutine, except that:
%allturns on all the trapping modes.%none, the default, turns off all trapping modes.- A
no%prefix turns off that specific trapping mode.If you compile one routine with
-ftrap=t, compile all routines of the program with the same-ftrap=t option; otherwise, you can get unexpected results.
-GPasses the option to the link editor to produce a shared object rather than a dynamically linked executable. This option is passed to
ld(1), and cannot be used with the-dnoption.
-gProduces additional symbol table information for the debugger.
This option invokes the incremental linker; see -xildoff and -xildon. Invoke
ildinstead ofldunless you are using the-Gor-xildoffoptions, or you are naming source files on the command line.If you issue
-g, and the optimization level is-xO3or lower, the compiler provides best-effort symbolic information with almost full optimization. Tail-call optimization and back-end inlining are disabled.If you issue
-gand the optimization level is-xO4, the compiler provides best-effort symbolic information with full optimization.
-HPrints to standard error, one per line, the path name of each file included during the current compilation. The display is indented so as to show which files are included by other files.
Here, the program
sample.cincludes the files,stdio.handmath.h;math.hincludes the file,floatingpoint.h, which itself includes functions that usesys/ieeefp.h:
%cc -H sample.c/usr/include/stdio.h/usr/include/math.h/usr/include/floatingpoint.h/usr/include/sys/ieeefp.h
-hnameAssigns a name to a shared dynamic library as a way to have different versions of a library. In general, the name after
-hshould be the same as the file name given after the-ooption. The space between-hand name is optional.The linker assigns the specified name to the library and records the name in the library file as the intrinsic name of the library. If there is no
-hname option, then no intrinsic name is recorded in the library file.When the runtime linker loads the library into an executable file, it copies the intrinsic name from the library file into the executable, into a list of needed shared library files. Every executable has such a list. If there is no intrinsic name of a shared library, then the linker copies the path of the shared library file instead.
-IdirAdds dir to the list of directories that are searched for
#includefiles with relative file names, that is, those not beginning with a/(slash). See Include Files for a discussion of the search order used to find the include files.
-iPasses the option to the linker to ignore any
LD_LIBRARY_PATHorLD_LIBRARY_PATH_64setting.
-KPIC
-KPICis equivalent to-xcode=pic32, see -xcode=v.(x86)
-KPICis identical to-Kpic.
-Kpic
-Kpicis equivalent to-xcode=pic13, see -xcode=v.
-keeptmpRetains temporary files created during compilation instead of deleting them automatically.
-LdirAdds dir to the list of directories searched for libraries by
ld(1). This option and its arguments are passed told.
-lnameLinks with object library
libname.so, orlibname.a.The order of libraries in the command-line is important, as symbols are resolved from left to right.This option must follow the sourcefile arguments.
-mcRemoves duplicate strings from the
.commentsection of the object file. When you use the-mcflag,mcs-cis invoked.
-misalign(SPARC)
-misalignis equivalent to-xmemalign=1i. See -xmemalign=ab.
-misalign2(SPARC)
-misalign2is equivalent to-xmemalign=2i. See -xmemalign=ab.
-mrRemoves all strings from the
.commentsection. When you use this flag,mcs-d -ais invoked.
-mr,stringRemoves all strings from the
.commentsection and inserts string in that section of the object file. If string contains embedded blanks, it must be enclosed in quotation marks. A null string results in an empty.commentsection. This option is passed as-dastring tomcs.
-mtMacro option that expands to
-D_REENTRANT-lthread. If you are doing your own multithread coding, you must use this option in the compile and link steps. To obtain faster execution, this option requires a multiprocessor system. On a single-processor system, the resulting executable usually runs more slowly with this option.
-nativeThis option is a synonym for
-xtarget=native.
-nofstore(x86) Does not convert the value of a floating-point expression or function to the type on the left-hand side of an assignment, when that expression or function is assigned to a variable or is cast to a shorter floating-point type; rather, it leaves the value in a register. See also -fstore.
-noqueueInstructs the compiler not to queue this compile request if a license is not available. Under normal circumstances, if no license is available, the compiler waits until one becomes available. With this option, the compiler returns immediately.
-O
-ofilenameNames the output file filename (as opposed to the default,
a.out). filename cannot be the same as sourcefile, sinceccdoes not overwrite the source file. This option and its arguments are passed told(1).
-PRuns the source file through the C preprocessor only. It then puts the output in a file with a
.isuffix. Unlike-E, this option does not include preprocessor-type line number information in the output. See also the-Eoption.
-pPrepares the object code to collect data for profiling with
prof(1). This option invokes a runtime recording mechanism that produces amon.outfile at normal termination.
-Q[y|n]Emits or does not emit identification information to the output file.
-Qyis the default.If
-Qyis used, identification information about each invoked compilation tool is added to the.commentsection of output files, which is accessible withmcs. This option can be useful for software administration.
-Qn suppresses this information.
-qp
-Rdir[:dir]Passes a colon-separated list of directories used to specify library search directories to the runtime linker. If present and not null, it is recorded in the output object file and passed to the runtime linker.
If both
LD_RUN_PATHand the-Roption are specified, the-Roption takes precedence.
-SDirects
ccto produce an assembly source file but not to assemble the program.
-sRemoves all symbolic debugging information from the output object file. This option cannot be specified with
-g.
-UnameRemoves any initial definition of the preprocessor symbol name. This option is the inverse of the
-Doption. You can give multiple-Uoptions.
-VDirects
ccto print the name and version ID of each component as the compiler executes.
-vDirects the compiler to perform stricter semantic checks and to enable other
lint-like checks. For example, the code:
#include <stdio.h>main(void){printf("Hello World.\n");}
compiles and executes without problem. With
-v, it still compiles; however, the compiler displays this warning:
"hello.c", line 5: warning: function has no return statement: main
-vdoes not give all the warnings thatlint(1) does. Try running the above example throughlint.
-Wc,argPasses the argument arg to a specified component c. Each argument must be separated from the preceding only by a comma. All
-Warguments are passed after the regular command-line arguments. A comma can be part of an argument by escaping it by an immediately preceding\(backslash) character.See Components of the C Compilation System for a list of components. c can be one of the following:
aAssembler ( fbe); (gas)cC code generator ( cg) (SPARC)dcc driver1 hIntermediate code translator ( ir2hf)(Intel)iInter-procedure analysis ( ube_ipa)(Intel)lLink editor ( ld)mmcs pPreprocessor ( cpp)uC code generator ( ube) (Intel)0Compiler ( acomp) (ssbd, SPARC)2Optimizer ( iropt) (SPARC)
1 You cannot use -Wdto pass the cc options listed in this chapter to the C compiler.
-wSuppresses compiler warning messages.
This option overrides the
error_messagespragma.
-X[a|c|s|t]The
See K&R Sun C Incompatibilities with Sun ANSI/ISO C for a discussion of differences between ANSI/ISO C and K&R C.-X(note uppercaseX) options specify varying degrees of compliance to the ANSI/ISO C standard.-Xais the default mode.
-Xa(
a= ANSI) This is the default compiler mode. ANSI C plus K&R C compatibility extensions, with semantic changes required by ANSI C. Where K&R C and ANSI C specify different semantics for the same construct, the compiler uses the ANSI C interpretation. If the-Xaoption is used in conjunction with the-xtransitionoption, the compiler issues warning about the conflict. The predefined macro _ _STDC_ _ has a value of0with the-Xaoption.
-Xc(
c= conformance) Issues errors and warnings for programs that use non-ANSI/ISO C constructs. This option is strictly conformant ANSI/ISO C, without K&R C compatibility extensions. The predefined macro _ _STDC_ _ has a value of1with the -Xa option.
-Xs(
s= K&R C) Attempts to warn about all language constructs that have differing behavior between ANSI/ISO C and K&R C. The compiler language includes all features compatible with K&R C. This option invokescppfor preprocessing._ _STDC_ _is not defined in this mode. For more information regarding the effects of compiling with the-Xsoption, see The Difference Between Sun C and ANSI/ISO C As Set By -Xs.
-Xt(
t= transition) This option uses ANSI/ISO C plus K&R C compatibility extensions without semantic changes required by ANSI/ISO C. Where K&R C and ANSI/ISO C specify different semantics for the same construct, the compiler uses the K&R C interpretation. If you use the -Xt option in conjunction with the -xtransition option, the compiler issues warnings about the conflict. The predefined macro _ _STDC_ _ has a value of0with the -Xa option.
-x386(x86) Optimizes for the 80386 processor.
-x486(x86) Optimizes for the 80486 processor.
-xaInserts code to count how many times each basic block is executed. This option is the old style of basic block profiling for
tcov. See -xprofile=p for information on the new style of profiling and thetcov(1) man page for more details. See also Analyzing Program Performance With Sun Workshop.
-xainvokes a runtime recording mechanism that creates a.dfile for every.cfile at normal termination. The.dfile accumulates execution data for the corresponding source file. tcov(1) can then be run on the source file to generate statistics about the program. Since this option entails some optimization, it is incompatible with-g.If set at compile-time, the
TCOVDIRenvironment variable specifies the directory where the.dfiles are located. If this variable is not set, the.dfiles remain in the same directory as the.cfiles.The
-xprofile=tcovand the-xaoptions are compatible in a single executable. That is, you can link a program that contains some files which have been compiled with-xprofile=tcov, and others with-xa. You cannot compile a single file with both options.
-xarch=isaSpecify instruction set architecture (ISA).
Architectures that are accepted by
-xarchkeyword isa are shown in TABLE 2-4:
TABLE 2-4 -xarchISA KeywordsSPARC generic,native,v7,v8a,v8,v8plus,v8plusa,v8plusb,v9,v9a,v9bx86 generic,386,pentium_pro
Note that although
-xarchcan be used alone, it is part of the expansion of the-xtargetoption and may be used to override the-xarchvalue that is set by a specific-xtargetoption. For example:
% cc -xtarget=ultra2 -xarch=v8plusb ...overrides the
-xarch=v8set by-xtarget=ultra2If you use this option with optimization, the appropriate choice can provide good performance of the executable on the specified architecture. An inappropriate choice results in a binary program that is not executable on the intended target platform.
SPARC Only
The following table details the performance of an executable that is compiled with a given
-xarchoption and then executed by various SPARC processors. The purpose of this table is to help you identify the best-xarchoption for your executable given a particular target machine. Start by identifying the range of machines that are of interest to you and then consider the cost of maintaining multiple binaries versus the benefit of extracting the last iota of performance from newer machines.
- N reflects Nominal performance. The program executes and takes full advantage of the processor's instruction set.
- S reflects Satisfactory performance. The program executes but may not exploit all available processor instructions.
- PD reflects Performance Degradation. The program executes, but depending on the instructions used, may experience slight to significant performance degradation. The degradation occurs when instructions that are not implemented by the processor are emulated by the kernel.
- NE means Not Executable. The program will not execute because the kernel does not emulate the instructions that are not implemented by the processor.
If you are going to compile your executable with the
v8plusorv8plusainstruction set, consider compiling your executable withv9orv9ainstead. Thev8plusandv8plusaoptions were provided so that programs could take advantage of some SPARC V9 and UltraSPARC features prior to the availability of Solaris 7 with its support for 64-bit programs. Programs compiled with thev8plusorv8plusaoption are not portable to SPARC V8 or older machines. Such programs can be re-compiled withv9orv9a, respectively, to take full advantage of all the features of SPARC V9 and UltraSPARC. The V8+ Technical Specification white paper, part number 802-7447-10, is available through your Sun representative and explains the limitations ofv8plusandv8plusa.
- SPARC instruction set architectures V7, V8, and V8a are all binary compatible.
- Object binary files (.o) compiled with
v8plusandv8plusacan be linked and can execute together, but only on a SPARC V8plusa compatible platform.- Object binary files (.o) compiled with
v8plus,v8plusa, andv8plusbcan be linked and can execute together, but only on a SPARC V8plusb compatible platform.-xarchvaluesv9,v9a, andv9bare only available on UltraSPARC 64-bit Solaris environments.- Object binary files (.o) compiled with
v9andv9acan be linked and can execute together, but will run only on a SPARC V9a compatible platform.- Object binary files (.o) compiled with
v9,v9a, andv9bcan be linked and can execute together, but will run only on a SPARC V9b compatible platform.For any particular choice, the generated executable may run much more slowly on earlier architectures. Also, although quad-precision (
REAL*16andlongdouble) floating-point instructions are available in many of these instruction set architectures, the compiler does not use these instructions in the code it generates.The following table gives details for each of the
-xarchkeywords on SPARC platforms.
x86 Only
-xautopar(SPARC) Turns on automatic parallelization for multiple processors. Does dependence analysis (analyze loops for inter-iteration data dependence) and loop restructuring. If optimization is not at
-xO3or higher, optimization is raised to-xO3and a warning is emitted.Avoid
-xautoparif you do your own thread management.The Sun Workshop includes the license required to use multiprocessor C. To get faster execution, this option requires a multiple processor system. On a single-processor system, the resulting binary usually runs slower.
To determine how many processors you have, use the
psrinfocommand:
%psrinfo0 on-line since 01/12/95 10:41:541 on-line since 01/12/95 10:41:543 on-line since 01/12/95 10:41:544 on-line since 01/12/95 10:41:54
To request a number of processors, set the
PARALLELenvironment variable. The default is 1.
- Do not request more processors than are available.
- If
Nis the number of processors on the machine, then for a one-user, multiprocessor system, tryPARALLEL=N-1.If you use
-xautoparand compile and link in one step, then linking automatically includes the microtasking library and the threads-safe C runtime library. If you use-xautoparand compile and link in separate steps, then you must also link with-xautopar.
-xCCAccepts the C++-style comments. In particular,
//can be used to indicate the start of a comment.
-xcache=cDefines the cache properties for use by the optimizer. c must be one of the following:
generic (SPARC,x86)- s1
/l1/a1- s1
/l1/a1:s2/l2/a2- s1
/l1/a1:s2/l2/a2:s3/l3/a3The si
/li/ai are defined as follows:
si The size of the data cache at level i, in kilobytes li The line size of the data cache at level i, in bytes ai The associativity of the data cache at level i
Although this option can be used alone, it is part of the expansion of the
-xtargetoption; its primary use is to override a value supplied by the-xtargetoption.This option specifies the cache properties that the optimizer can use. It does not guarantee that any particular cache property is used. The following table lists the
-xcachevalues.
Example:
-xcache=16/32/4:1024/32/1specifies the following:
Level 1 cache has: 16K bytes 32 bytes line size 4-way associativity Level 2 cache has: 1024K bytes 32 bytes line size Direct mapping associativity
-xcg[89|92]
-xcg89is a macro for:-xarch=v7 -xchip=old -xcache=64/32/1.
-xcg92is a macro for:-xarch=v8 -xchip=super
-xchar_byte_order=oProduce an integer constant by placing the characters of a multi-character character-constant in the specified byte order. You can substitute one of the following values for o:
low: place the characters of a multi-character character-constant in low-to-high byte order.high: place the characters of a multi-character character-constant in high-to-low byte order.default: place the characters of a multi-character character-constant in an order determined by the compilation mode -X[a|c|s|t]. For more information, see Character Constants.
-xchip=cSpecifies the target processor for use by the optimizer.
c must be one of the following:
generic,old,super,super2,micro,micro2,hyper,hyper2,powerup,ultra, ultra2, ultra2i, 386,486, pentium, pentium_pro,603,604.Although this option can be used alone, it is part of the expansion of the
-xtargetoption; its primary use is to override a value supplied by the-xtargetoption.This option specifies timing properties by specifying the target processor.
- The ordering of instructions, that is, scheduling
- The way the compiler uses branches
- The instructions to use in cases where semantically equivalent alternatives are available
-xcode=v(SPARC) Specify code address space. v must be one of:
The default is
-xcode=abs32for SPARC V7 and V8, and-xcode=abs64for SPARC and UltraSPARC V9 (with-xarch=v9|v9a).When building shared dynamic libraries with
-xarch=v9orv9aon 64-bit Solaris 7, you must specify-xcode=pic13or-xcode=pic32.There are two nominal performance costs with
-xcode=pic13and-xcode=pic32:
- A routine compiled with either
-xcode=pic13or-xcode=pic32executes a few extra instructions upon entry to set a register to point at a table (_GLOBAL_OFFSET_TABLE_) used for accessing a shared library's global or static variables.- Each access to a global or static variable involves an extra indirect memory reference through
_GLOBAL_OFFSET_TABLE_. If the compile is done with-xcode=pic32, there are two additional instructions per global and static memory reference.When considering the above costs, remember that the use of
-xcode=pic13and-xcode=pic32can significantly reduce system memory requirements, due to the effect of library code sharing. Every page of code in a shared library compiled-xcode=pic13or-xcode=pic32can be shared by every process that uses the library. If a page of code in a shared library contains even a single non-pic(that is, absolute) memory reference, the page becomes nonsharable, and a copy of the page must be created each time a program using the library is executed.The easiest way to tell whether or not a .o file has been compiled with
-xcode=pic13or-xcode=pic32is with thenmcommand:
%nmfile.o | grep _GLOBAL_OFFSET_TABLE_U _GLOBAL_OFFSET_TABLE_
A
.ofile containing position-independent code contains an unresolved external reference to _GLOBAL_OFFSET_TABLE_, as indicated by the letterU.To determine whether to use
-xcode=pic13or-xcode=pic32, usenmto identify the number of distinct global and static variables used or defined in the library. If the size of_GLOBAL_OFFSET_TABLE_is under 8,192 bytes, you can use-Kpic. Otherwise, you must use-xcode=pic32.
-xcrossfile=[n](SPARC) Enables optimization and inlining across source files. If specified, n can be
0or1.Normally the scope of the compiler's analysis is limited to each separate file on the command line. For example,
-xO4's automatic inlining is limited to subprograms defined and referenced within the same source file.With -xcrossfile, the compiler analyzes all the files named on the command line as if they had been concatenated into a single source file.
-xcrossfileis only effective when used with-xO4or-xO5.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.
The default is
-xcrossfile=0, and no cross-file optimizations are performed.-xcrossfileis equivalent to-xcrossfile=1.
-xdepend(SPARC) Analyzes loops for inter-iteration data dependencies and does loop restructuring. Loop restructuring includes loop interchange, loop fusion, scalar replacement, and elimination of "dead" array assignments. If optimization is not at
-xO3or higher, optimization is raised to-xO3and a warning is issued.Dependency analysis is also included with
-xautoparor-xparallel. The dependency analysis is done at compile time.Dependency analysis may help on single-processor systems. However, if you try
-xdependon single-processor systems, you should not use either-xautoparor-xexplicitpar. If either of them is on, then the-xdependoptimization is done for multiple-processor systems.
-xePerforms only syntax and semantic checking on the source file, but does not produce any object or executable code.
-xexplicitpar(SPARC) Generates parallelized code based on specification of
#pragmaMPdirectives. You do the dependency analysis: analyze and specify loops for inter-iteration data dependencies. The software parallelizes the specified loops. If optimization is not at-xO3or higher, optimization is raised to-xO3and a warning is issued. Avoid-xexplicitparif you do your own thread management.The Sun Workshop includes the license required to use multiprocessor C. To get faster code, this option requires a multiprocessor system. On a single-processor system, the generated code usually runs slower.
If you identify a loop for parallelization, and the loop has dependencies, you can get incorrect results, possibly different ones with each run, and with no warnings. Do not apply an explicit parallel pragma to a reduction loop. The explicit parallelization is done, but the reduction aspect of the loop is not done, and the results can be incorrect.
In summary, to parallelize explicitly:
- Analyze the loops to find those that are safe to parallelize.
- Insert
#pragma MPto parallelize a loop. See the Explicit Parallelization and Pragmas" for more information.- Use the
-xexplicitparoption.An example of inserting a parallel pragma immediately before the loop is:
#pragma MP taskloopfor (j=0; j<1000; j++){...}
If you use
-xexplicitparand compile and link in one step, then linking automatically includes the microtasking library and the threads-safe C runtime library. If you use-xexplicitparand compile and link in separate steps, then you must also link with-xexplicitpar.
-xFEnables performance analysis of the executable using the Analyzer. (See the
analyzer(1) man pages.) Produces code that can be reordered at the function level. Each function in the file is placed in a separate section; for example, functionsfoo()andbar()are placed in the sections.text%fooand.text%bar, respectively. Function ordering in the executable can be controlled by using-xFin conjunction with the-Moption told(seeld(1)). This option also causes the assembler to generate some debugging information in the object file, necessary for data collection.
-xhelp=fDisplays on-line help information.
f must be one of:
flags,readme, orerrors.
-xhelp=flagsdisplays a summary of the compiler options.
-xhelp=readmedisplays theREADMEfile.
-xhelp=errorsdisplays the Error and Warning Messages file.
-xildoffTurns off the incremental linker and forces the use of
ld. This option is the default if you do not use the-goption, or you do use the-Goption, or any source files are present on the command line. Override this default by using the-xildonoption.
-xildonTurns on the incremental linker and forces the use of
ildin incremental mode. This option is the default if you use the-goption, and you do not use the-Goption, and there are no source files present on the command line. Override this default by using the-xildoffoption.
-xinline=[{%auto,func_name,no%func_name}[,{%auto,func_name,no%func_name}]...]Tries to inline only those functions specified in the list. The list is comprised of either a comma-separated list of functions names, or a comma separated list of
no%func_ name values, or the value%auto. If you issueno%func_ name, the compiler is not to inline the named function. If you issue%auto, the compiler is to attempt to automatically inline all functions in the source files.If you are compiling with
-xO3, you can use-xinlineto increase optimization by inlining some or all functions. The-xO3level of optimization does not include inlining.If you are compiling with
-xO4,-xinlinecan decrease optimization by restricting inlining to only those routines in the list. With-xO4, the compiler normally tries to inline all references to functions defined in the source file. When you specify-xinline=but do not name any functions or%auto, this indicates that none of the routines in the source file are to be inlined.A function is not inlined if any of the following conditions apply (no warning is issued):
- Optimization is less than
-xO3.- The routine cannot be found.
- Inlining the routine does not look practicable to the optimizer.
- The source for the routine is not in the file being compiled (however, see
-xcrossfile).
-xlibmieeeForces IEEE 754 style return values for math routines in exceptional cases. In such cases, no exception message is printed, and you should not rely on
errno.
-xlibmilInlines some library routines for faster execution. This option selects the appropriate assembly language inline templates for the floating-point option and platform for your system.
-xlic_lib=sunperf(SPARC) Links in the Sun-supplied performance libraries.
-xlicinfoReturns information about the licensing system. In particular, this option returns the name of the license server and the IDs of users who have checked out licenses. This option does not request compilation or check out a license.
-xloopinfo(SPARC) Shows which loops are parallelized and which are not. Gives a short reason for not parallelizing a loop. The
-xloopinfooption is valid only if-xautopar, or-xparallel, or-xexplicitparis specified; otherwise, the compiler issues a warning.The Sun WorkShop includes the license required to use multiprocessor C options. To get faster code, this option requires a multiprocessor system. On a single-processor system, the generated code usually runs slower.
-xMRuns only the preprocessor on the named C programs, requesting that it generate makefile dependencies and send the result to the standard output (see
make(1) for details about makefiles and dependencies).For example:
#include <unistd.h>void main(void){}generates this output:
-xM1Collects dependencies like
-xM, but excludes/usr/includefiles. For example:
more hello.c#include<stdio.h>main(){(void)printf("hello\n");}cc -xM hello.c
hello.o: hello.chello.o: /usr/include/stdio.h
Compiling with
-xM1does not report header file dependencies:
cc -xM1 hello.c
hello.o: hello.c
-xMergeMerges data segments into text segments. Data initialized in the object file produced by this compilation is read-only and (unless linked with
ld-N) is shared between processes.
-xmaxopt=off,1,2,3,4,5This command limits the level of
pragmaoptto the level specified. The default value is-xmaxopt=offwhich causespragmaoptto be ignored. If you specify-xmaxoptwithout supplying an argument, that is the equivalent of specifying-xmaxopt=5.
-xmemalign=abSpecify maximum assumed memory alignment and behavior of misaligned data accesses. There must be a value for both a (alignment) and b (behavior). a specifies the maximum assumed memory alignment and b specifies the behavior for misaligned memory accesses. The following table lists the alignment and behavior values for
-xmemalign
.For memory accesses where the alignment is determinable at compile time, the compiler will generate the appropriate load/store instruction sequence for that alignment of data.
For memory accesses where the alignment cannot be determined at compile time, the compiler must assume an alignment to generate the needed load/store sequence.
The -xmemalign flag allows the user to specify the maximum memory alignment of data to be assumed by the compiler in these indeterminable situations. It also specifies the error behavior to be followed at run time when a misaligned memory access does take place.
Here are the default values for
-xmemalign. The following default values only apply when no-xmemalignflag is present:
-xmemalgin=4swhen-xarchhas the valuegeneric,v7,v8,v8a,v8plus,v8plusa, ILP32.-xmemalign=8swhen -xarch has the valuev9,v9a.Here is the default when
-xmemalignflag is present but no value is given:
-xmemalign=1ifor all-xarchvalues.The following table shows how you can use -xmemalign to handle different alignment situations.
-xnolibDoes not link any libraries by default; that is, no
-loptions are passed told. Normally, theccdriver passes-lctold.When you use
-xnolib, you have to pass all the-loptions yourself. For example:
%cc test.c -xnolib -Bstatic -lm -Bdynamic -lc
links
libmstatically and the other libraries dynamically.
-xnolibmilDoes not inline math library routines. Use it after the
-fastoption. For example:
%cc -fast -xnolibmil....
-xO[1|2|3|4|5]Optimizes the object code; note the upper-case letter O. When
-xOis used with the-goption, a limited amount of debugging is available. For more information, see "Debugging Optimized Code" in Chapter 1 of Debugging a Program With dbx.The levels (
1,2,3,4, or5) you can use with-xOdiffer according to the platform you are using.SPARC
-xO1
Does basic local optimization (peephole).
-xO2
Does basic local and global optimization. This is induction variable elimination, local and global common subexpression elimination, algebraic simplification, copy propagation, constant propagation, loop-invariant optimization, register allocation, basic block merging, tail recursion elimination, dead code elimination, tail call elimination, and complex expression expansion.
The
-xO2level does not assign global, external, or indirect references or definitions to registers. It treats these references and definitions as if they were declaredvolatile. In general, the-xO2level results in minimum code size.-xO3
Performs like
-xO2, but also optimizes references or definitions for external variables. Loop unrolling and software pipelining are also performed. This level does not trace the effects of pointer assignments. When compiling either device drivers, or programs that modify external variables from within signal handlers, you may need to use thevolatiletype qualifier to protect the object from optimization. In general, the-xO3level results in increased code size.-xO4
Performs like
-xO3, but also automatically inlines functions contained in the same file; this usually improves execution speed. If you want to control which functions are inlined, see -xinline=[{%auto,func_name,no%func_name}[,{%auto,func_name,no%func_name}]...].This level traces the effects of pointer assignments, and usually results in increased code size.
-xO5
Attempts to generate the highest level of optimization. Uses optimization algorithms that take more compilation time or that do not have as high a certainty of improving execution time. Optimization at this level is more likely to improve performance if it is done with profile feedback. See -xprofile=p.
x86
-xO1
Preloads arguments from memory, cross-jumping (tail-merging), as well as the single pass of the default optimization.
-xO2
Schedules both high- and low-level instructions and performs improved spill analysis, loop memory-reference elimination, register lifetime analysis, enhanced register allocation, and elimination of global common subexpressions.
-xO3
Performs loop strength reduction, induction variable elimination, as well as the optimization done by level
2.-xO4
Performs loop unrolling, avoids creating stack frames when possible, and automatically inlines functions contained in the same file, as well as the optimization done by levels
2and3. Note that this optimization level can cause stack traces fromadbanddbxto be incorrect.-xO5
Generates the highest level of optimization. Uses optimization algorithms that take more compilation time or that do not have as high a certainty of improving execution time. Some of these include generating local calling convention entry points for exported functions, further optimizing spill code and adding analysis to improve instruction scheduling.
If the optimizer runs out of memory, it tries to recover by retrying the current procedure at a lower level of optimization and resumes subsequent procedures at the original level specified in the command-line option.
If you optimize at
-xO3or-xO4with very large procedures (thousands of lines of code in the same procedure), the optimizer may require a large amount of virtual memory. In such cases, machine performance may degrade.
-xPPrints prototypes for all K&R C functions defined in this module.
f(){}main(argc,argv)int argc;char *argv[];{}
produces this output:
int f(void);int main(int, char **);
-xparallel(SPARC) Parallelizes loops both automatically by the compiler and explicitly specified by the programmer. The
-xparalleloption is a macro, and is equivalent to specifying all three of-xautopar,-xdepend, and-xexplicitpar. With explicit parallelization of loops, there is a risk of producing incorrect results. If optimization is not at-xO3or higher, optimization is raised to-xO3and a warning is issued.Avoid
-xparallelif you do your own thread management.The Sun WorkShop includes the license required to use the multiprocessor C options. To get faster code, this option requires a multiprocessor system. On a single-processor system, the generated code usually runs slower.
If you compile and link in one step,
-xparallellinks with the microtasking library and the threads-safe C runtime library. If you compile and link in separate steps, and you compile with-xparallel, then link with-xparallel
-xpentium(x86) Optimizes for the Pentium processor.
-xpgPrepares the object code to collect data for profiling with
gprof(1). It invokes a runtime recording mechanism that produces agmon.outfile at normal termination.
-xprefetch=[val],val
(SPARC) Enable prefetch instructions on those architectures that support prefetch, such as UltraSPARC II. (-xarch=v8plus,v9plusa,v9, orv9a)Explicit prefetching should only be used under special circumstances that are supported by measurements.
val must be one of the following:
If you do not specify
-xprefetch, the default is-xprefetch=no%auto,explicit. If you specify-xprefetchwithout a value, that is equivalent to-xprefetch=auto,explicit.The
sun_prefetch.hheader file provides the macros that you can use to specify explicit prefetch instructions. The prefetches are approximately at the place in the executable that corresponds to where the macros appear.
-xprofile=pCollects data for a profile or uses a profile to optimize.
(SPARC) p must be
collect[:name],use[:name], ortcov.This option causes execution frequency data to be collected and saved during execution, then the data can be used in subsequent runs to improve performance. This option is only valid when you specify a level of optimization.
collect[:name]Collects and saves execution frequency data for later use by the optimizer with
-xprofile=use. The compiler generates code to measure statement execution frequency.The name is the name of the program that is being analyzed. This name is optional. If name is not specified,
a.outis assumed to be the name of the executable.At runtime a program compiled with
-xprofile=collect:name will create the subdirectory name.profileto hold the runtime feedback information. Data is written to the filefeedbackin this subdirectory. If you run the program several times, the execution frequency data accumulates in thefeedbackfile; that is, output from prior runs is not lost.
use[:name]Uses execution frequency data to optimize strategically.
As with
collect:name, the name is optional and may be used to specify the name of the program.The program is optimized by using the execution frequency data previously generated and saved in the
feedbackfiles written by a previous execution of the program compiled with-xprofile=collect.The source files and other compiler options must be exactly the same as those used for the compilation that created the compiled program that generated the
feedbackfile. If compiled with-xprofile=collect:name, the same program name name must appear in the optimizing compilation:-xprofile=use:name.
tcovBasic block coverage analysis using "new" style
tcov.The
-xprofile=tcovoption is the new style of basic block profiling fortcov. It has similar functionality to the-xaoption, but correctly collects data for programs that have source code in header files. See -xa for information on the old style of profiling, thetcov(1) man page, and Analyzing Program Performance With Sun WorkShop for more details.Code instrumentation is performed similarly to that of the
-xaoption, but.dfiles are no longer generated. Instead, a single file is generated, the name of which is based on the final executable. For example, if the program is run out of/foo/bar/myprog.profile, the data file is stored in/foo/bar/myprog.profile/myprog.tcovd.The
-xprofile=tcovand the-xaoptions are compatible in a single executable. That is, you can link a program that contains some files that have been compiled with-xprofile=tcov, and others with-xa. You cannot compile a single file with both options.When running
tcov, you must pass it the-xoption to make it use the new style of data. If not,tcovuses the old.dfiles, if any, by default for data, and produces unexpected output.Unlike the
-xaoption, theTCOVDIRenvironment variable has no effect at compile-time. However, its value is used at program runtime. Seetcov(1) and Analyzing Program Performance With Sun WorkShop for more details.
Note tcov's code coverage report can be unreliable if there is inlining of routines due to-xO4or-xinline.
-xreduction(SPARC) Turns on reduction recognition during automatic parallelization.
-xreductionmust be specified with-xautopar, or-xparallel.Parallelization options require a WorkShop license.
When reduction recognition is enabled, the compiler parallelizes reductions such as dot products, maximum and minimum finding. These reductions yield different roundoffs than obtained by unparallelized code.
-xregs=r(SPARC) Specifies the usage of registers for the generated code.
r is a comma-separated list that consists of one or more of the following: [
no%]appl, [no%]float.Example:
-xregs=appl,no%float
TABLE 2-12 The -xregsValuesapplAllows the use of the following registers:g2, g3, g4 (v8a, v8, v8plus, v8plusa, v8plusb) g2, g3 (v9, v9a, v9b) For more information on SPARC instruction sets, see -xarch=isa. In the SPARC ABI, these registers are described as application registers. Using these registers can increase performance because fewer load and store instructions are needed. However, such use can conflict with some old library programs written in assembly code. no%applDoes not use the applregisters.floatAllows using the floating-point registers as specified in the SPARC ABI. You can use these registers even if the program contains no floating-point code. no%floatDoes not use the floating-point registers.
With this option, a source program cannot contain any floating-point code.
The default is
-xregs=appl,float.
-xrestrict=f(SPARC) Treats pointer-valued function parameters as restricted pointers. f is a comma-separated list that consists of one or more function parameters,
%all, or%none.If a function list is specified with this option, pointer parameters in the specified functions are treated as restricted; if
-xrestrict=%allis specified, all pointer parameters in the entire C file are treated as restricted. Refer to _Restrict Keyword, for more information.This command-line option can be used on its own, but it is best used with optimization. For example, the command:
%cc -xO3 -xrestrict=%all prog.c
treats all pointer parameters in the file
%prog.cas restricted pointers. The command:cc -xO3 -xrestrict=agc prog.c
treats all pointer parameters in the function
agcin the fileprog.cas restricted pointers.The default is
%none; specifying-xrestrictis equivalent to specifying-xrestrict=%all.
-xsDisables Auto-Read for
dbx. Use this option in case you cannot keep the.ofiles around. It passes the-soption to the assembler.No Auto-Read is the older way of loading symbol tables. It places all symbol tables for
dbxin the executable file. The linker links more slowly anddbxinitializes more slowly.Auto-Read is the newer and default way of loading symbol tables. With Auto-Read, the information is distributed in the
.ofiles, so thatdbxloads the symbol table information only if and when it is needed. Hence, the linker links faster, anddbxinitializes faster.With
-xs, if you move the executables to another directory, then to usedbx, you can ignore the object (.o) files.Without
-xs, if you move the executables, you must move both the source files and the object (.o) files, or set the path with thedbxpathmaporusecommand.
-xsafe=mem(SPARC) Allows the compiler to assume no memory-based traps occur.
This option grants permission to use the speculative load instruction on V9 machines. It is only effective when you specify
-xO5optimization and-xarch=v8plus|v8plusa|v9|v9a.
-xsbGenerates extra symbol table information for the Source Browser. This option is not valid with the
-Xsmode of the compiler.
-xsbfastCreates the database for the Source Browser. Does not compile source into an object file. This option is not valid with the
-Xsmode of the compiler.
-xsfpconstRepresents unsuffixed floating-point constants as single precision, instead of the default mode of double precision. Not valid with
-Xc.
-xspaceDoes no optimizations or parallelization of loops that increase code size.
Example: The compiler will not unroll loops or parallelize loops if it increases code size.
-xstrconstInserts string literals into the read-only data section of the text segment instead of the default data segment.
-xtarget=tSpecifies the target system for instruction set and optimization.
The value of t must be one of the following:
native,generic, system-name (SPARC, x86).The
-fastmacro option includes-xtarget=nativein its expansion.The
-xtargetoption is a macro that permits a quick and easy specification of the-xarch,-xchip, and-xcachecombinations that occur on real systems. The only meaning of-xtargetis in its expansion.
TABLE 2-13 The -xtargetValuesnativeGets the best performance on the host system.
The compiler generates code for the best performance on the host system. It determines the available architecture, chip, and cache properties of the machine on which the compiler is running.genericGets the best performance for generic architecture, chip, and cache.
The compiler expands-xtarget=genericto:-xarch=generic -xchip=generic -xcache=generic
This is the default value.system-name
Gets the best performance for the specified system.
You select a system name from TABLE 2-14 that lists the mnemonic encodings of the actual system name and numbers.
The performance of some programs may benefit by providing the compiler with an accurate description of the target computer hardware. When program performance is critical, the proper specification of the target hardware could be very important. This is especially true when running on the newer SPARC processors. However, for most programs and older SPARC processors, the performance gain is negligible and a generic specification is sufficient.
Each specific value for
-xtargetexpands into a specific set of values for the-xarch,-xchip, and-xcacheoptions. See TABLE 2-14 for the values. For example:
-xtarget=sun4/15is equivalent to:-xarch=v8a -xchip=micro
-xcache=2/16/1
genericornative386(equivalent to -386option) or486(equivalent to -486option)pentium(equivalent to -pentiumoption) orpentium_pro
-xtemp=dirSets the directory for temporary files used by
ccto dir. No space is allowed within this option string. Without this option, temporary files go into/tmp.-xtemphas precedence over theTMPDIRenvironment variable.
-xtimeReports the time and resources used by each compilation component.
-xtransitionIssues warnings for the differences between K&R C and Sun ANSI/ISO C. The
-xtransitionoption issues warnings in conjunction with the-Xaand-Xtoptions. You can eliminate all warning messages about differing behavior through appropriate coding. The following warnings no longer appear unless the-xtransitionoption is used:
\a is ANSI C "alert" character\x is ANSI C hex escapebad octal digitbase type is reallytype tag: namecomment is replaced by"##"comment does not concatenate tokensdeclaration introduces new type in ANSI C:type tagmacro replacement within a character constantmacro replacement within a string literalno macro replacement within a character constantno macro replacement within a string literaloperand treated as unsignedtrigraph sequence replacedANSI C treats constant as unsigned:operatorsemantics ofoperatorchange in ANSI C; use explicit cast
-xunroll=nSuggests to the optimizer to unroll loops n times. n is a positive integer. When n is 1, it is a command, and the compiler unrolls no loops. When n is greater than 1, the
-xunroll=n merely suggests to the compiler that it unroll loops n times.
-xvector[={yes|no}Enable automatic generation of calls to the vector library functions.
-xvector=yespermits the compiler to transform math library calls within loops into single calls to the equivalent vector math routines when such transformations are possible. Such transformations could result in a performance improvement for loops with large loop counts.If you do not issue
-xvector, the default is-xvector=no. If you specify-xvectorbut do not supply a value, the default is-xvector=yes.If you use
-xvectoron the command line without previously specifying-xdepend,-xvectortriggers-xdepend. The-xvectoroption also raises the optimization level to -x03 if optimization is not specified or optimization is set lower than-x03.The compiler includes the
libmveclibraries in the load step. If you compile and link with separate commands, be sure to use-xvectorin the linkingcccommand.
-xvpara(SPARC) Warns about loops that have
#pragmaMPdirectives specified when the loop may not be properly specified for parallelization. For example, when the optimizer detects data dependencies between loop iterations, it issues a warning.The Sun WorkShop includes the license required to use multiprocessor C options.
Use
-xvparawith the-xexplicitparoption or the-xparalleloption and the#pragma MP. See Explicit Parallelization and Pragmas for more information.
-Yc,dirSpecifies a new directory dir for the location of component c. c can consist of any of the characters representing components that are listed under the
-Woption.If the location of a component is specified, then the new path name for the tool is dir/tool. If more than one
-Yoption is applied to any one item, then the last occurrence holds.
-YA,dirChanges the default directory searched for components.
-YI,dirChanges the default directory searched for
includefiles.
-YP,dirChanges the default directory for finding library files.
-YS,dirChanges the default directory for startup object files.
-Zll(SPARC) Creates the program database for
lock_lint, but does not actually compile. Refer to thelock_lint(1) man page for more details.
-Zlp(SPARC) Prepares object files for the loop profiler,
looptool. Thelooptool(1) utility can then be run to generate loop statistics about the program. Use this option with-xdepend; if-xdependis not explicitly or implicitly specified, turns on-xdependand issues a warning. If optimization is not at-xO3or higher, optimization is raised to-xO3and a warning is issued. Generally, this option is used with one of the loop parallelization options:-xexplicitpar,-xautopar, or-xparallel.The Sun WorkShop includes the license required to use the MPC options. To get faster code, this option requires a multiprocessor system. On a single-processor system, the generated code usually runs slower.
If you compile and link in separate steps, and you compile with
-Zlp, then be sure to link with-Zlp.If you compile one subprogram with
-Zlp, you need not compile all subprograms of that program with-Zlp. However, you get loop information only for the files compiled with-Zlp, and no indication that the program includes other files.Options Passed to the Linker
ccrecognizes-a,-e,-r,-t,-u, and-zand passes these options and their arguments told.ccpasses any unrecognized options toldwith a warning.
|
Sun Microsystems, Inc. Copyright information. All rights reserved. Feedback |
Library | Contents | Previous | Next | Index |