3.4.174 –xregs=r
Specifies the usage of registers for the generated code.
r is a comma-separated list that consists of one or more of the
following suboptions: appl,
float,frameptr.
Prefixing a suboption with no% disables that suboption.
Note that —xregs suboptions are restricted to specific hardware
platforms.
Example: -xregs=appl,no%float
Table 3-20 The -xregs Suboptions
|
|
appl
|
(SPARC) Allow the compiler to generate code using the application registers as scratch
registers. The application registers are:
g2, g3, g4 (on 32–bit
platforms)
g2, g3 (on 64–bit platforms)
It is strongly recommended that all system software and libraries be compiled using
-xregs=no%appl. System software (including shared libraries) must preserve these
registers’ values for the application. Their use is intended to be controlled by the
compilation system and must be consistent throughout the application.
In the SPARC ABI, these registers are described as application registers.
Using these registers can improve performance because fewer load and store instructions are needed.
However, such use can conflict with some old library programs written in assembly code.
|
float
|
(SPARC) Allow the compiler to generate code by using the floating-point registers as scratch
registers for integer values. Use of floating-point values may use these registers regardless of
this option. If you want your code to be free of all references to floating point registers, you
need to use -xregs=no%float and also make sure your code does not in any way use
floating point types.
|
frameptr
|
(x86) Allow the compiler to use the frame-pointer register (%ebp on IA32,
%rbp on AMD64) as a general-purpose register.
The default is -xregs=no%frameptr
With -xregs=framptr the compiler is free to use the frame-pointer register
to improve program performance. However, some features of the debugger and performance measurement
tools may be limited as a result. Stack tracing, debuggers, and performance anayzers cannot report
on functions compiled with —xregs=frameptr
Mixed C, Fortran, and C++ code should not be compiled with
—xregs=frameptr if a C++ function, called directly or indirectly from a C
or Fortran function, can throw an exception. If compiling such mixed source code with
—fast, add —xregs=no%frameptr after the
—fast option on the command line.
With more available registers on 64–bit platforms, compiling with
—xregs=frameptr has a better chance of im proving 32–bit code
performance than 64–bit code.
The compiler ignores -xregs=frameptr and issues a warning if you also
specify -pg. Also, -xkeepframe overrides
-xregs=frameptr.
|
|
The SPARC default is -xregs=appl,float.
The x86 default is -xregs=no%frameptr. -xregs=frameptr
in included in the expansion of -fast.
It is strongly recommended that you compile code intended for shared libraries that will link
with applications, with -xregs=no%appl,float. At the very least, the shared
library should explicitly document how it uses the application registers so that applications
linking with those libraries are aware of these register assignments.
For example, an application using the registers in some global sense (such as using a register
to point to some critical data structure) would need to know exactly how a library with code
compiled without -xregs=no%appl is using the application registers in order to
safely link with that library.
On x86 systems, -pg is incompatible with
-xregs=frameptr, and these two options should not be used together. Note also
that -xregs=frameptr is included in -fast.