Enable high-performing z/OS XL C/C++ programs for optimized business software solutions
IBM® z/OS® V1.11 XL C/C++
Highlights
Deliversperformance
improvementsoverz/OSV1.10XL
C/C++byexploitingthelatest
advancementsinoptimization
andhardwaretechnology
Leveragessystemprogramming
capabilitieswithnewsub-options
totheMETALCPROLOGand
EPILOGcompileroptions
Exploitstheflexibilityandpower
ofmodule-leveldebuggingwith
thenewdebugutilityCDADBGLD
andsource-leveldebuggingwith
thenewdbgld–coption
Reducesapplicationeffortand
improvesproductivitythrough
newcompileroptions
software
The IBM z/OS XL C/C++ compiler
is designed to help you create and
maintain critical business applications
written in C or C++, maximize
application performance, and
improve developer productivity. The
IBM z/OS XL C/C++ compiler can
transform C or C++ source code to
fully exploit IBM System z® hardware.
Enhanced features help you leverage
hardware advancements through
built-in functions, performance-tuned
libraries, and language constructs
that simplify system programming
and boost application run time
performance.
IBM works constantly to improve
compiler components, including front-
ends, high-level optimizers, and low-
level optimizers. By upgrading your
compiler, you can keep up with new
language standards and extensions,
advancements in hardware
technology, usability features,
and advances in optimization with
minimal or no source code changes.
Compilers offer a cost-effective way
to get more out of existing technology
and stay ahead of competitors on the
technology curve.
.
Delivers application perform-ance improvements by exploiting System z hardware The z/OS V1.11 XL C/C++ compiler
exploits System z10 hardware through
the PREFETCH option. This option
enables heuristics to automatically
generate System z10 prefetch data
instructions as appropriate. This can
help reduce effects of memory latency
by beginning to fetch data before it is
needed. Additional optimization and
tuning improvements have been made
for the compiler including inlining of
additional destructors to avoid over-
head of function calls. These changes
can improve the performance of
generated code without the need for
changes to the source code. A
performance improvement of over 8%
was observed using code generated
using the z/OS V1.11 XL C/C++ com-
piler with high optimization compared
to code generated using the z/OS V1.10
XL C/C++ compiler1.
Large page (1 MB) support in both
Java™ and Language Environment®
means applications using JVM and XL
C/C++ (in AMODE64) can benefit from
improved memory management.
The new REPORT option makes it
easier to know what types of optimiza-
tion were performed. This option pro-
duces pseudo-C code listings which
show how sections of code have been
optimized in both the IPA-compile and
IPA-bind step, to help you understand
compiler optimizations and tune appli-
cation code for better performance.
Exploits flexibility and power of
module-level debugging and source-
level debugging
In z/OS V1.11 XL C/C++, you now gain
the flexibility and power of module-level
debugging in batch mode through the
new CDADBGLD MVS utility instead of
using z/OS UNIX® System Services.
In addition, the dbgld z/OS UNIX
System Services utility has been
enhanced with a new –c option that
includes the source code of the pro-
gram within the debug information in a
debug side file. This makes it possible
to step through the program even
when the original source code is not
available at debugging time, as might
occur on a production system when
the source code resides on a different
system used for development.
These two utilities enable IBM Debug
Tool and z/OS dbx to exploit deferred
loading of debug information, greatly
improving debugger load time.
Reduces application effort and
improves productivity with new
compiler options
z/OS XL C/C++ continually strives to
improve usability to make it easier for
you to work with the compiler, and thus
be more productive.
The MAKEDEP option reduces the
complexity of builds and streamlines the
build process by analyzing source files
and determining source dependencies.
The SHOWMACROS compiler option
controls how macro definitions are
emitted within preprocessor output
(PPONLY option or –E), to make it
easier for you to debug complex macro
expansions and to determine which
feature test macros are in effect.
The RTCHECK compiler option
instructs the compiler to exploit com-
pare-and-trap instructions for specific
run time checks. Valid sub-options are:
• BOUNDS, to trap when subscript-
ing past the boundaries of objects of
known size
• DIVZERO, to trap on integer divide-
by-zeros
• NULLPTR, to trap on an attempt to
dereference a null pointer
• ALL, all of the above
1. This is based on internal IBM lab measurements using the ILP32, XPLINK, ARCH(8), TUNE(8), HGPR, O3, HOT, and IPA(LEVEL(2)) with PDF compiler options. Performance results for specific applications will vary; some factors affecting performance are the source code and the compiler options specified.
2
The SKIPSRC compiler option improves
the readability of the source listing by
excluding non-compiled statements
from compiler listings, for example,
code which is “#ifdef’ed out”. SKIPSRC
makes it easier to look at the listings
and understand them, which can be
very beneficial when working with
header files and source files with large
segments of non-compiled code.
Enables system programming using
Metal C
System programming allows for devel-
opment of freestanding programs that
do not depend on any supplied run
time environment, such as Language
Environment. These programs obtain
the system services that they need by
calling assembler services directly.
You can use the Metal C feature of z/OS
XL C in place of assembler for devel-
opment of system programs. Metal C
includes the following capabilities:
• The __asm keyword allows you to
specify assembly instructions in
C code.
• The METAL compiler option allows
you to use the MVS system linkage
conventions.
• The PROLOG and EPILOG compiler
options and the #pragma prolog()
and #pragma epilog() preprocessor
directives allow you to specify
custom HLASM prolog and epilog
code, to implement custom function
linkage conventions if required.
System programs (written in C) exploit
the same advancements in hardware
and advances in performance optimi-
zation realized by application programs
coded in C.
z/OS V1.11 XL C/C++ delivers new
sub-options to the existing METAL
C PROLOG and EPILOG compiler
options:
• The EXTERN sub option indicates
that the PROLOG/EPILOG code is to
apply only to functions with
external linkage.
• The ALL sub option indicates that the
PROLOG/EPILOG code is to apply to
both external linkage and static link-
age functions.
Leverages the decimal floating-
point unit
It is estimated that 55 percent of
numeric data in commercial databases
is decimal data. Traditional floating-
point arithmetic is not sufficient for
commercial software. It often leads to
unexpected results for values that are
inherently decimal, such as monetary
values and percentages. Currently,
many decimal arithmetic calculations
are carried out in software, which is
typically estimated to be 10 to 100
times slower than hardware.
IBM z10 processors now leverage a
decimal floating-point (DFP) unit. This
is designed to bring significant per-
formance and accuracy improvements
to commercial software that operates
on decimal data. The z/OS XL C/C++
compiler exploits the DFP unit.
Enables easier porting of C/C++ appli-
cations to z/OS
To facilitate porting to z/OS XL C/C++,
our latest z/OS V1.11 XL C/C++ compiler
supports code that exploits Unicode
literals and character types, and also
adds two new features enhancing GCC
compatibility: GCC statement expres-
sion constructs and zero-extent
array members.
z/OS V1.11 XL C/C++ enhances the
Standard C++ Library with selected
features of the Technical Report on C++
Library Extensions (TR1).
In addition, this release of the compiler
introduces support for a number of
selected features of the emerging C++0x
standard including extended friend dec-
larations, external templates and name
lookup in template base class.
3
Figure1: z10 processor.
Get more return on your IT investment
The IBM z/OS XL C/C++ compiler
bridges your applications with the
hardware architectures, doing the
heavy lifting for you, hiding the increas-
ing complexities of processor architec-
ture, and greatly improving developer
productivity. By relying on the compiler,
you can concentrate on high value
tasks, creating better quality and better
performing applications.
State-of-the-art compilation technology
enables you to exploit new features
found in the latest hardware with
minimal source code changes. The
compiler determines the best way to
transform and optimize code genera-
tion for the systems your applications
will run on.
Standards compliance
The IBM z/OS XL C/C++ compiler con-
forms to ISO C89 and C99 standards.
The compiler also supports C++98
with the 2003 Technical Corrigendum
1 updates. To handle applications with
mixed C and C++ code and to include
header files that contain C99 language
constructs, XL C++ also supports a
subset of C99.
Augmenting the standardized lan-
guage levels, the IBM z/OS XL C/C++
compiler has implemented selected
GNU C and C++ language extensions.
The z/OS XL C/C++ compiler has also
introduced a subset of C++0x, the
working draft of the next C++ pro-
gramming standard, by implementing
features frequently requested by users.
Provides powerful, no hassle applica-
tion programming
Well written and thoroughly debugged
code, fully conformant to its language
standard, can take maximum advan-
tage of the optimizing technology in
IBM z/OS XL C/C++ for a potential
dramatic increase in performance.
The optimization and hardware feature
support in IBM z/OS XL C/C++ can
improve your productivity as the com-
piler can generate code that exploits
the leading-edge performance in new
hardware, often with minimal source
code changes.
IBM z/OS XL C/C++ supports several
levels of increasingly aggressive code
transformations. Advanced optimization
techniques, such as inter-procedural
analysis (IPA) and profile-directed
feedback (PDF), are available at high
levels of optimization that can result
in significant performance improve-
ments. IPA analyzes and optimizes
your application as a whole, rather than
on a file-by-file basis. PDF generates
information that instructs the optimizer
to focus on trade-offs that favor code
that executes more frequently.
Flexible compiler architecture
The following series of component
diagrams illustrate how compiling at
various optimization levels affects the
compiler transformation of source code
into executables. Compile-time options
allow you to inform the compiler of your
preferences for balancing the trade-
offs for high application performance:
precision, code size, compilation time,
and system resources.
What happens at NOOPT
Compiling at NOOPT, the default opti-
mization level, the compiler checks the
application source code for algorithmic
correctness, exposes problems such
as uninitialized variables and improper
casting, and saves all debug informa-
tion. The intermediate code generated
from the compiler front-end passes
directly to the back-end, where basic
optimizations such as redundant code
elimination and constant folding are
performed before binding. Specifying
-qarch with –qnoopt sets the target
architecture for the application and
can result in better performance as
the compiler exploits features of the
target architecture. A clean compi-
lation at NOOPT signifies that the
compiler has structured the source
code to take advantage of -qarch and
-qtune settings at higher -O levels. The
–qarch and –qtune options instruct the
compiler to generate code for optimal
execution on a given microprocessor
or architectural family.
4
What happens at -O2
Recompiling at –O2 exposes the
source code to comprehensive low-
level transformations that apply to the
subprogram or compilation unit scope.
At –O2, the compiler back-end per-
forms, for example, more optimizations
on loops, and identifies and removes
unnecessary code constructs and
redundant computations. The compiler
strives to balance improved perform-
ance while limiting the impact on com-
pilation time and system resources. The
target architecture, indicated by –qarch
and –qtune, is more important at –O2,
as the compiler optimizes to exploit the
features of the hardware.
What happens at -O3
Recompiling at –O3 provides more
intense low-level transformations
that removes many of the limitations
present at –O2. Optimizations at –O3
encompass larger program regions
and attempt more in-depth analysis,
while balancing the trade-offs in com-
pilation time and memory resources.
While not all applications contain
opportunities for the optimizer to pro-
vide a measurable increase in perform-
ance, most applications can benefit
from this kind of analysis.
5
Figure2: Compiling at –noopt or –O2.
Generates
C front-end C++ front-end
Back-end Optimizedobjects Other objects
Output
Intermediate language
Intermediatelanguage
Binder
Module and DLL
What happens at -O4
Optimization at –O4 builds on that
of –O3 by triggering inter-procedural
analysis (IPA), which strives to optimize
the entire application as a unit. With IPA
specified on both the compile and bind
steps, the compiler performs multiple
iterations through the optimizer and the
back-end, with trade-offs in compile
time, especially on the bind step. Appli-
cations that contain many frequently
used routines are most likely to benefit
from IPA. Profile-directed feedback
(PDF), which iteratively refines a profile
of how often branches are taken
and blocks of code are executed in
the application, requires IPA. PDF is
designed to tune an application for a
particular usage scenario.
What happens at -O5
The highest optimization level cur-
rently available to the z/OS XL C/C++
compiler is -O5. This initiates aggres-
sive optimization and the highest level
of inter-procedural analysis currently
available. The -O5 optimization proc-
ess begins with the front-end emitting
an intermediate language which IPA
6
Figure3: Compiling at –O3.
Generates
Back-end Optimizedobjects Other objects
Output
Binder
Module and DLL
Optimizer
C front-end C++ front-end
Intermediate languageIntermediate
language
1
Yes
No
Compile step
Legend
Bind step
Optimizer Libraries PDF information(instrumented runs)
Partitions
Back-end Optimizedobjects Other objects
Output
IPA objects
2
Optimizedobjects Other objects
Output
Program isbound with-O4 or -O5?
Binder
Module and DLL
Generates
C front-end C++ front-end
Intermediate languageIntermediate
language
Intermediatelanguage
Intermediatelanguage
Intermediatelanguage
Intermediate language
Intermediate language
Figure4: Compiling at –O4 and –O5.
7
analyzes and transforms. The opti-
mized intermediate language is then
processed by the low-level optimizing
back-end for further optimization and
object code creation.
Compilation at –O5 builds on the
optimizations at –O4, adding deeper
whole-program analysis. Most aggres-
sive transformations are available at
-O5, and the compiler makes full use
of loop optimizations and the assump-
tions resulting from IPA.
License options
To help you optimize software licensing
costs, IBM can assist in identifying the
licenses that best suits your organization.
For additional information on the types of
licenses available for z/OS, see:
http://www-03.ibm.com/systems/z/
resources/swprice/index.html
Ordering Information:
IBM z/OS XL C/C++ is an optional
priced feature of z/OS. z/OS XL C/
C++ is available through the Shopz-
Series web site:
https://www14.software.ibm.com/
webapp/ShopzSeries/ShopzSeries.jsp
where it is listed as “z/OS V1 C/C++
without Debug”.
For more information:To learn more about z/OS V1.11 XL
C/C++, contact your IBM representa-
© Copyright IBM Corporation 2009
IBM Corporation Software Group Route 100 Somers, NY 10589 U.S.A.
Produced in the United States of America 10-09
All Rights Reserved
IBM, the IBM logo, ibm.com, Language Environment,
System z, z/Architecture and z/OS are trademarks
or registered trademarks of International Business
Machines Corporation in the United States,
other countries, or both. If these and other IBM
trademarked terms are marked on their first
occurrence in this information with a trademark
symbol (® or ™), these symbols indicate U.S.
registered or common law trademarks owned by
IBM at the time this information was published. Such
trademarks may also be registered or common law
trademarks in other countries. A current list of IBM
trademarks is available on the Web at “Copyright
and trademark information” at
www.ibm.com/legal/copytrade.shtml
UNIX is a registered trademark of The Open Group
in the United States and other countries.
Java and all Java-based trademarks are trademarks
of Sun Microsystems, Inc. in the United States, other
countries, or both.
Other company, product or service names may be
trademarks or service marks of others.
The information contained in this publication is
provided for informational purposes only. While
efforts were made to verify the completeness
and accuracy of the information contained in this
publication, it is provided AS IS without warranty
of any kind, express or implied. In addition, this
information is based on IBM’s current product plans
and strategy, which are subject to change by IBM
without notice. IBM shall not be responsible for any
damages arising out of the use of, or otherwise
related to, this publication or any other materials.
Nothing contained in this publication is intended to,
nor shall have the effect of, creating any warranties
or representations from IBM or its suppliers or
licensors, or altering the terms and conditions of the
applicable license agreement governing the use of
IBM software.
References in this publication to IBM products,
programs, or services do not imply that they will
be available in all countries in which IBM operates.
Product release dates and/or capabilities referenced
in this presentation may change at any time at
IBM’s sole discretion based on market opportunities
or other factors, and are not intended to be a
commitment to future product or feature availability
in any way. Nothing contained in these materials is
intended to, nor shall have the effect of, stating or
implying that any activities undertaken by you will
result in any specific sales, revenue growth, savings
or other results.
Feature Benefit
• Exploitsz/Architecture®
Industry language standards compliance
• Facilitatesportingfromoneplatformtoanother.•�ro�i�es compiler �iagnostics to help�ro�i�escompiler�iagnosticstohelpyouachie�ethele�elofconformanceyouwanttoaparticularprogramminglan-guagestan�ar�.•�upports commonly use� ���� an� non-�upportscommonlyuse�����an�non-����languageextensions.
Industry-leading optimizers •Usestechnologyfromthein�ustry-lea�-ing����XLC/C++familyofcompilers,z/O�XLC/C++is�esigne�tooffersu-periorapplicationperformanceonz/O�.
Improved debug information & debug APIs
•Enablestoolpro�i�ers(inclu�ing����DebugTool,Application�erformanceAnalyzer,z/O��bx,aswellasthir�-partytools)tobuil�a��itionalcapabilityan�impro�e�performanceintheirtools.
Improved low-level programming support
•�ro�i�essystemprogrammingcapabilitiesthrough��etalC.With��etalCyoucaninsertHLA���instructionsintoCsource,specifycustomfunctionprologsan�epilogs,an�generateHLA���source,makingiteasiertointegratenewco�ewithexistingHLA���programs.
Exploits hardware support for IEEE 754 decimal floating-point data
•�mpro�estheaccuracyan�performanceof�ecimalfloating-pointcalculationsforcommercialapplications.
Built-in functions •�ro�i�esaccesstothenewestan�mostefficienthar�wareoperationsatthesourcele�el.•�implifiesthe�e�elopmenteffortforcreatingan�maintaininghigh-perfor-manceapplications.
SC23-8617-00
*sc23-8617-00*
tive or IBM Business Partner, or visit the
z/OS XL C/C++ Web site at www.ibm.
com/software/awdtools/czos
IBM Service and SupportThe IBM Service and Support
organization is dedicated to providing
responsive platform and cross-plat-
form software support that meets or
exceeds customer expectations. For
complex or code-related problems,
specialized service teams work with
subject matter experts in compiler
development to provide a level of
support excellence that benefits IBM,
a longstanding leader in information
technology. To learn more about sup-
port, visit the z/OS XL C/C++ support
Web site at www.ibm.com/software/
awdtools/czos/support
Designed for IBM platforms
Figure5: Summary of z/OS XL C/C++ compiler features and benefits.