Man Page binopt.1




NAME

     binopt - Solaris Binary Optimizer


SYNOPSIS

     binopt [-binstrument[=on|off]] [-bdata=datafile]
     [-o filename] [-V]	[-flags] [-Q[y|n]]
     [-xinline=[[,v...]]]   binfile

     binopt [-buse[=on|off]] [-blevel=0|1|2]
     [-bdata=datafile] [-bfinal[=on|off]] [-o filename]
     [-V] [-flags] [-Q[y|n]]
     [-xinline=[[,v...]]]   binfile


DESCRIPTION

     The binopt	command	is used	to optimize (SPARC and x86/x64)
     Solaris binaries (executables or shared objects). It can
     optimize binaries irrespective of the source language used.
     It	can also optimize mixed	source language	binaries. To be
     able to effectively optimize, binaries must be built with
     some explicit level of optimization (-xOn)	and on a newer
     Solaris 10	system with patch 127111-07 installed.

     The Binary	Optimizer may also be used to instrument a binary
     for profile collection. The instrumented binary must then be
     run with an input data training set representing a	typical
     user's data. This training	run will create	a binary file
     with profile data.	This file must then be fed back	to the
     Binary Optimizer to create	a profile optimized binary.

     The binopt	command	performs several levels	of optimizations.
     At	higher levels of optimization, more optimizations are
     performed,	leading	to a potentially more optimal binary. A
     possible side-effect is increased build time.

     By	default, if no output file name	is specified, the input
     file is overwritten with the optimized binary. Unless the
     -bfinal option is given, binaries created by the binopt com-
     mand may be optimized by a	future invocation of the Binary
     Optimizer.

     binopt is available only on Solaris platforms.


OPTIONS

     -binstrument[=on|off]
	  Instrument the binary	for profile collection.	All
	  optimizations	are automatically turned off. The -bdata
	  option may be	used to	modify the default file	used to
	  store	the profile data. This cannot be used with the
	  -buse	flag.

     -buse[=on|off]
	  Perform profile guided optimizations using profile
	  data.	Again, the -bdata flag may be used to modify the
	  default file location. This cannot be	used with the
	  -binstrument flag.

     -blevel=0|1|2
	  Perform different levels of optimizations.
	  At level 0, no optimizations are performed.
	  At level 1, do code reordering optimizations (this is
	  the default behavior).
	  At level 2, data-flow	information is constructed and
	  more aggressive optimizations	like inlining and address
	  related optimizations	are performed.

     -bdata=datafile
	  Specifies the	file where the profile data will be
	  stored. This option is used only with	-binstrument or
	  -buse	and is ignored otherwise. If this option is not
	  used,	the default file name is binfile.instrdata.

     -bfinal[=on|off]
	  Finalize the output binary so	that no	future binary
	  optimizations	may be performed.  This	option is useful
	  in the final build step after	which no further
	  transformations are planned. For example, this may be
	  used with the	-buse option when generating the final
	  optimal binary.  The default is -bfinal=off.

     -o	filename
	  Names	the output file	filename, instead of overwriting
	  the input binfile file by default.

     -V	  Print	the version number of the tool on the standard
	  error	output.

     -flags
	  Prints a one-line summary of available options.

     -Q[y|n]
	  Emits	or does	not emit the Binary Optimizer version
	  identification information the output	file. If -Qy is
	  used,	identification information will	be added to the
	  output files (the default behavior). -Qn suppresses
	  this information.

     -xinline=[[,v...]]
	  v can	be %auto func_name no%func_name
	  -xinline tries to inline only	those functions	specified
	  in the list. The list	is comprised of	either a comma-
	  separated list of function names, or a comma-separated
	  list of no%func_name values, or the value %auto. If you
	  specify %nofunc_name,	the compiler is	not to inline the
	  named	function. If you specify %auto,	binopt will
	  attempt to automatically inline functions.
	  By default automatic inlining	is enabled at optimiza-
	  tion level 2.



OPERAND

     binfile
	  Binary file to be optimized.


EXAMPLES

     Example 1:	Prepare	and optimize a binary

     The following entry prepares the created binary for optimi-
     zations and then optimizes	it with	the binopt command,
     overwriting the binary file in place.

     % cc -O -xbinopt=prepare *.c -o a.out
     % binopt a.out

     Example 2:	Instrument, run, and perform profile guided
     optimizations.

     The following example instruments a binary, performs a
     training run and then uses	the profile data to perform pro-
     file guided optimizations.

     % binopt -binstrument -bdata=a.out.data -o	a.out.instr a.out
     % ./a.out.instr
     % binopt -buse -bdata=a.out.data -o a.out.opt a.out

     Example 3:	Perform	level 2	optimizations and finalize.

     The following example performs binary optimizations at level
     2 and then	finalizes the binary so	that the binary	may not
     be	optimized in the future.

     % binopt -blevel=2	-bfinal	a.out




SEE ALSO

     cc(1), CC(1), f95(1).