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
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++ Advanced Edition V8.0 for Linux 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 selected 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++ Advanced Edition V8.0 for Linux supports several Linux distributions. See the README file and System prerequisites for a complete list of supported distributions and requirements.

The compiler, its libraries, and its generated object programs will run on all POWER3(TM), POWER4(TM), POWER5(TM), POWER5+(TM), PowerPC(R), and PowerPC 970 systems with the required software and disk space.

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. 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 compiler configuration file at /etc/opt/ibmcmp/vac/8.0/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, XL C/C++ provides the vac_configure utility that you can use to create additional configuration files. You can then modify these files with any text editor to contain your own frequently-used compiler option settings.

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/opt/ibmcmp/vac/8.0/gxlc.cfg plain text configuration file to control GNU-to-XL C/C++ option mappings and defaults. You can customize the /etc/opt/ibmcmp/vac/8.0/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.

XL C/C++ uses GNU C and GNU C++ header files together with the GNU C and C++ runtime libraries to produce code that is binary-compatible with that produced with the GNU compiler, GCC Version 3.3. Portions of an application can be built with XL C/C++ and combined with portions built with GCC to produce an application that behaves as if it had been built solely with GCC.

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, errors and severe error messages if language or language extension elements in your program source do not conform to that language level.

See -qlanglvl for more information.

Libraries

XL C/C++ Advanced Edition V8.0 for Linux ships with the following libraries:

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

xlc_install
This interactive utility helps you install XL C/C++ on your system.
new_install
After you install XL C/C++, running this utility will configure the compiler for use on your system.
vac_configure
Use this utility to create additional compiler configuration files that you can then modify to contain your own custom sets of compiler option default settings.
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 Linux 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 linker 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++ Advanced Edition V8.0 for Linux supports application development for multiprocessor system architectures. You can use any of the following methods to develop your parallelized applications with XL C/C++:

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 require 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 more information about the applicable compiler options and the listing itself, refer to XL C/C++ compiler listings.

Symbolic debugger support

You can use gdb or any other symbolic debugger when debugging your programs.