-O
compiler option is used to enable global optimization. The following options alter the
behavior of the global optimizer. TABLE 12. Global Optimizer Options
----------------------------------------------------------------------------------- | Option | Description | =================================================================================== | -Gfn or -Kfreg=n | specifies the maximum number of | | | floating-point registers (n = 0 through 2). | ----------------------------------------------------------------------------------- | -Gvn or -Kgreg=n | specifies the maximum number of registers the | | | optimizer can assign to register variables (n = 0 | | | through 6). | ----------------------------------------------------------------------------------- | -Oa or -Kalias | specifies that the global optimizer should | | | assume worst-case aliasing. | ----------------------------------------------------------------------------------- | -Oic=n or -Kcomplexity=n | specifies the maximum complexity that a | | | function can have and remain eligible for | | | default inlining. | ----------------------------------------------------------------------------------- | -Oid=n or -Kdepth=n | specifies the maximum depth of functions to be | | | inlined. | ----------------------------------------------------------------------------------- | -Oil or -Kinlocal | inlines single-call, static functions. | ----------------------------------------------------------------------------------- | -Oin or -Kinline | enables inlining during the optimization phase. | ----------------------------------------------------------------------------------- | -Oir=n or -Krdepth=n | specifies the maximum level of recursion to be | | | inlined. | ----------------------------------------------------------------------------------- | -Ol or -Kloop | specifies that loop optimizations should be | | | performed. | -----------------------------------------------------------------------------------
Each of these options is described in Chapter 3, "Compiling C and C++ Programs" on page 23.
-g
option is used. To utilize
all the capabilities of the SAS/C Debugger, there must be an accurate correspondence between
object code and source line numbers, and optimizations can alter this correspondence. Also, the -g
option causes the compiler to suppress allocation of variables to registers, so the resulting code is
not completely optimal.
You can, however, use the -Kdbhook
option along with the -O
option to generate optimized
object code that can be used with the debugger. The -Kdbhook
option generates hooks in the
object code that enable the debugger to gain control of an executing program.
When using the debugger with optimized object code that has been compiled with the
-Kdbhook
option, the source code is not displayed in the debugger's Source window and you
cannot access variables. Therefore, the debugger's print
command, and other commands, which
are normally used with variables, are not used when debugging optimized code. However, source
code line numbers are displayed in the Source window, providing an indication of your location in
the code. You also have the capability of viewing register values in the debugger's Register
window, and you can use commands such as step
, goto
, and runto
to control the execution of
your program. However, due to optimizations that affect register contents, the goto
command may
fail when debugging optimized code.
See Chapter 9, "Cross-Debugging" on page 71 for more information about using the SAS/C Debugger with the SAS/C Cross-Platform Compiler.
omd
, is a useful debugging tool that provides a copy of the
assembler code generated for a C or C++ program. If the object module is created with a line
number-offset table (that is, if the compiler option -l
is in effect), then the source code is merged
with the assembler instructions.
sascc370
or
sasCC370
compiler driver.
omd
directly:
The object-filename argument specifies the name of a compiled object file, and the source-filename argument specifies the name of the source file used to compile the object. Theomd [-v]
object-filename source-filename
-v
option is specified to generate a verbose listing.
The output from the object module disassembler is directed to standard output when omd
is
invoked directly. A copy of the source code is merged with the disassembler listing to enable you to
associate the assembler instructions with the source. If you specify the -v
option, the listing will
include a relocation dictionary, a line number offset table, and an extended name mapping table.
-S
option is used to invoke omd
from the compiler driver. For example, the following
command could be entered to compile the file named myfile.c and generate a .omd
listing file:
sascc370 -S myfile.c
or
sasCC370 -S myfile.cxx
In these cases, the object module disassembler listing would be written to myfile.omd
.