The gtune Utility Program

The Green Hills gtune Utility Program can tune your program automatically. It generates compiler options to inline functions that are only called once and to delete functions that are never called.

gtune uses cross reference information produced by the compiler and stored in .dbg and .sym files. In order for the compiler to produce this information, you must either compile your source code with the -G options on the compiler command line. gtune requires debugging to be turned on.

Usage

To use gtune, enter:

gtune executable[.sym] [-help] [-a] [-k func] ... [tune.opt]

where

executable.sym Executable file name and suffix for the .sym file associated with it.

-help

Display information about all options.

-a

Considers all functions in tuning output, regardless of whether the call graph information exists for each function.

-k func

Does not include func in tuning the output.

tune.opt

Writes tuning output to file tune.opt, or to stdout if tune.opt is not specified.

-t

Do not inline functions.

The gtune output file has lines of the form:

-OI=func1 (inline function func1)
-OD=func1 (deletes the out-of-line copy of function func1)
-OD=func2 (deletes function func2)

The output file is in a format suitable to be used as input to the compiler driver, as @tune.opt. The @ character tells the compiler driver to expand tune.opt as if the contents of the file had been explicitly entered on the compiler command line.

Example

File test.c

void unused() { printf ("nobody calls me\n"); }
void unused_also() { printf ("nobody calls me either\n"); }
int inline_me_too() { return 7; }
int inline_me() { return 6 + inline_me_too(); }
main() { printf ("%d\n", inline_me()); }

First, compile the program with call graph information, by entering:

% gcc -G test.c

Then, run gtune to produce the options for the compiler optimizer, by entering:

% gtune a.out tune.opt

The contents of tune.opt will be:

-OI=inline_me_too
-OD=inline_me_too
-OD=unused_also
-OD=unused
-OI=inline_me
-OD=inline_me

Now compile the program using the information generated by gtune, by entering:

% gcc test.c @tune.opt

As a result, the functions unused and unused_also are deleted from the program, since they are never referenced. The functions inline_me and inline_me_too are compiled inline, that is, no call is made, since only one call is made to each of these functions. The out-of-line copy of each of these functions is deleted.


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.