Overview of XL C/C++ features

Commonality with other XL compilers
Documentation, online help, and technical support
Hardware and operating system support
Highly configurable compiler
Language standards compliance
Compatibility with GNU
Source-code migration and conformance checking
Libraries
Standard C++ library
Mathematics Acceleration Subsystem libraries
Basic Linear Algebra Subprograms
Tools and utilities
Program optimization
64-bit object capability
Shared memory parallelization
OpenMP directives
Diagnostic listings
Symbolic debugger support

XL C/C++ Enterprise Edition V8.0 for AIX can be used for large, complex, computationally intensive programs, including interlanguage calls with Fortran programs. This section discusses the features of the XL C/C++ compiler at a high level. It is intended for people who are evaluating XL C/C++ and for new users who want to find out more about the product.

Commonality with other XL compilers

XL C/C++, together with XL C and XL Fortran, comprise the family of XL compilers.

The XL compilers are part of a larger family of IBM C, C++, and Fortran compilers that are derived from a common code base that shares compiler function and optimization technologies among a variety of platforms and programming languages, such as AIX, Linux distributions, OS/390, OS/400, z/OS, and z/VM operating systems. The common code base, along with compliance to international programming language standards, helps ensure consistent compiler performance and ease of program portability across multiple operating systems and hardware platforms.

The XL compilers are available for use on AIX and select Linux distributions.

Documentation, online help, and technical support

This guide provides an overview of XL C/C++ and its features. You can also find more extensive product documentation in the following formats:

Hardware and operating system support

XL C/C++ Enterprise Edition V8.0 for AIX supports AIX 5L for POWER V5.1, V5.2, and V5.3. See the README file and Installing XL C/C++ Enterprise Edition for a complete list of requirements.

The compiler, its libraries, and its generated object programs will run on all RS/6000(R) or pSeries(R) systems with the required software and disk space.

All supported processors other than POWER and POWER2 are considered part of the PowerPC family. Any reference to PowerPC includes all chips except POWER and POWER2

To take maximum advantage of different hardware configurations, the compiler provides a number of options for performance tuning based on the configuration of the machine used for executing an application.

Highly configurable compiler

XL C/C++ offers you a wealth of features to let you tailor the compiler to your own unique compilation requirements.

Compiler invocation commands
XL C/C++ provides several different commands that you can use to invoke the compiler, for example, xlC, xlc++, and xlc. Each invocation command is unique in that it instructs the compiler to tailor compilation output to meet a specific language level specification. Compiler invocation commands are provided to support all standardized C and C++ language levels, and many popular language extensions as well.

The compiler also provides corresponding "_r" versions of most invocation commands, for example, xlC_r and xlC_r7. These "_r" invocations instruct the compiler to link and bind object files to thread-safe components and libraries, and produce threadsafe object code for compiler-created data and procedures.

For more information about XL C/C++ compiler invocation commands, see Compiling with XL C/C++ or Invoking the compiler or a compiler component.

Compiler options
You can control the actions of the compiler through a large set of provided compiler options. Different categories of options help you to debug your applications, optimize and tune application performance, select language levels and extensions for compatibility with programs from other platforms, and do many other common tasks that would otherwise require changing the source code.

XL C/C++ lets you specify compiler options through a combination of environment variables, compiler configuration files, command line options, and compiler directive statements embedded in your C or C++ program source.

For more information about XL C/C++ compiler options, see Compiler options reference.

Custom compiler configuration files
The installation process creates a default plain text compiler configuration file at /etc/vac.cfg. This configuration file contains several stanzas that define compiler option default settings.

Your compilation needs may frequently call for specifying compiler option settings other than the defaults settings provided by XL C/C++. If so, you can create your own custom configuration files containing your own frequently-used compiler option settings, and call those configuration files when you compile your applications.

See Customizing the configuration file for more information on creating and using custom configuration files.

Language standards compliance

The compiler supports the following programming language specifications for C and C++:

In addition to the standardized language levels, XL C/C++ also supports language extensions, including:

See Supported language standards for more information about C and C++ language specifications and extensions.

Compatibility with GNU

XL C/C++ supports a subset of the GNU compiler command options to facilitate porting applications developed with gcc and g++.

This support is available when the gxlc or gxlc++ invocation command is used together with select GNU compiler options. The compiler maps these options to their XL C/C++ compiler option counterparts before invoking the compiler.

The gxlc and gxlc++ invocation commands use the /etc/gxlc.cfg plain text configuration file to control GNU-to-XL C/C++ option mappings and defaults. You can customize the /etc/gxlc.cfg file to better meet the needs of any unique compilation requirements you may have. See Reusing GNU C/C++ compiler options with gxlc and gxlc++ for more information.

Source-code migration and conformance checking

XL C/C++ helps protect your investment in your existing C and C++ source code by providing compiler invocation commands that instruct the compiler to compile your application to a specific language level. You can also use the -qlanglvl compiler option to specify a given language level, and the compiler will issue warnings if language elements in your program source do not conform to that language level.

See -qlanglvl for more information.

Libraries

XL C/C++ Enterprise Edition V8.0 for AIX ships with the following libraries.

Standard C++ library

XL C/C++ Enterprise Edition V8.0 for AIX ships a modified version of the Dinkum C++ Library, a conforming implementation of the Standard C++ Library. The Standard C++ Library consists of 51 headers, including 13 headers which constitute the Standard Template Library (STL). In addition, the Standard C++ Library works in conjunction with the 18 headers from the Standard C Library. The functions in these headers perform essential services such as input and output. They also provide efficient implementations of frequently used operations.

See the IBM C/C++ Standard Library Reference for more information.

Mathematics Acceleration Subsystem libraries

The IBM Mathematics Acceleration Subsystem (MASS) libraries consist of highly tuned scalar and vector mathematical intrinsic functions tuned specifically for optimum performance on PowerPC processor architectures. You can choose MASS libraries to support high-performance computing on a broad range of processors, or you can select libraries tuned to specific processor families.

The MASS libraries support both 32-bit and 64-bit compilation modes, are thread-safe, and offer improved performance over their corresponding libm routines. They are called automatically when you request specific levels of optimization for your application. You can also make explicit calls to MASS functions regardless of whether optimization options are in effect or not.

See Using the Mathematical Acceleration Subsystem for more information.

Basic Linear Algebra Subprograms

The BLAS set of high-performance algebraic functions are shipped in the libxlopt library. These functions let you:

For more information about using the BLAS functions, see Using the Basic Linear Algebra Subprograms.

Tools and utilities

IBM Debugger for AIX
The IBM Debugger for AIX can help you detect and diagnose errors in programs that are running locally or remotely. You can control the execution of your programs by setting compiled language-specific breakpoints, suspending execution, stepping through your code, and examining and changing the contents of variables.

The debugger contains views and functionality specific to a given programming language. With the compiled language views, you can monitor variables, expressions, registers, memory, and application modules of the application you are debugging.

CreateExportList Command
Creates a file containing a list of all the global symbols found in a given set of object files.
C++ c++filt Name Demangling Utility
When XL C/C++ Enterprise Edition V8.0 for AIX compiles a C++ program, it encodes all function names and certain other identifiers to include type and scoping information. This encoding process is called mangling. This utility converts the mangled names to their original source code names.
C++ linkxlC Command
Links C++ .o and .a files. This command is used for linking on systems without XL C/C++ Enterprise Edition V8.0 for AIX compiler installed.
C++ makeC++SharedLib Command
Permits the creation of C++ shared libraries on systems on which the XL C/C++ Enterprise Edition V8.0 for AIX compiler is not installed.
cleanpdf Command
A command related to profile-directed feedback, used for managing the PDFDIR directory. Removes all profiling information from the specified directory, the PDFDIR directory, or the current directory.
mergepdf Command
A command related to profile-directed feedback (PDF) that provides the ability to weight the importance of two or more PDF records when combining them into a single record. The PDF records must be derived from the same executable.
resetpdf Command
The current behavior of the resetpdf command is the same as the cleanpdf command and is retained for compatibility with earlier releases on other platforms.
showpdf Command
A command to display the call and block counts for all procedures executed in a profile-directed feedback training run (compilation under the options -qpdf1 and -qshowpdf).
gxlc and gxlc++ Utilities
Invocation methods that translate a GNU C or GNU C++ invocation command into a corresponding xlc or xlC command and invokes the XL C/C++ compiler. The purpose of these utilities is to minimize the number of changes to makefiles used for existing applications built with the GNU compilers and to facilitate the transition to XL C/C++.

Program optimization

XL C/C++ provides several compiler options that can help you control the optimization of your programs. With these options, you can:

Optimizing transformations can give your application better overall performance at run time. C and C++ provides a portfolio of optimizing transformations tailored to various supported hardware. These transformations can:

Significant performance improvements are possible with relatively little development effort because the compiler is capable of sophisticated program analysis and transformation. Moreover, XL C/C++ enables programming models, such as OpenMP, which allow you to write high-performance code.

If possible, you should test and debug your code without optimization before attempting to optimize it.

For more information about optimization techniques, see Optimizing your applications.

For a summary of optimization-related compiler options, see Options for performance optimization.

64-bit object capability

The XL C/C++ compiler's 64-bit object capability addresses increasing demand for larger storage requirements and greater processing power. The AIX operating system provides an environment that allows you to develop and execute programs that exploit 64-bit processors through the use of 64-bit address spaces.

To support larger executables that can be fit within a 64-bit address space, a separate, 64-bit object form is used to meet the requirements of 64-bit executables. The binder binds 64-bit objects to create 64-bit executables. Note that objects that are bound together must all be of the same object format. The following scenarios are not permitted and will fail to load, or execute, or both:

On both 64-bit and 32-bit platforms, 32-bit executables will continue to run as they currently do on a 32-bit platform.

XL C/C++ supports 64-bit mode mainly through the use of the -q64 and -qarch compiler options. This combination determines the bit mode and instruction set for the target architecture.

For more information, see Using 32-bit and 64-bit modes.

Shared memory parallelization

XL C/C++ Enterprise Edition V8.0 for AIX supports application development for multiprocessor system architectures. You can use any of the following methods to develop your parallelized applications with XL C/C++:

The parallel programming facilities of the AIX operating system are based on the concept of threads. Parallel programming exploits the advantages of multiprocessor systems, while maintaining a full binary compatibility with existing uniprocessor systems. This means that a multithreaded program that works on a uniprocessor system can take advantage of a multiprocessor system without recompiling.

For more information, see Parallelizing your programs.

OpenMP directives

OpenMP directives are a set of API-based commands supported by XL C/C++ and many other IBM and non-IBM C, C++, and Fortran compilers.

You can use OpenMP directives to instruct the compiler how to parallelize a particular loop. The existence of the directives in the source removes the need for the compiler to perform any parallel analysis on the parallel code. OpenMP directives requires the presence of Pthread libraries to provide the necessary infrastructure for parallelization.

OpenMP directives address three important issues of parallelizing an application:

  1. Clauses and directives are available for scoping variables. Frequently, variables should not be shared; that is, each processor should have its own copy of the variable.
  2. Work sharing directives specify how the work contained in a parallel region of code should be distributed across the SMP processors.
  3. Directives are available to control synchronization between the processors.

XL C/C++ supports the OpenMP API Version 2.5 specification. For more information, see www.openmp.org.

Diagnostic listings

The compiler output listing has optional sections that you can include or omit. For information about the applicable compiler options and the listing itself, refer to XL C/C++ compiler listings.

The -S option gives you a true assembler source file.

Symbolic debugger support

You can use dbx, the IBM Debugger for AIX, or any other symbolic debugger that supports the AIX XCOFF executable format when debugging your programs.

See also IBM Debugger for AIX.