C/C++ and Fortran

C/C++ and Fortran

Connect, learn, share, and engage with IBM Power.

 View Only

Should I use the new xlclang++ or xlC compiler invocation?

By Archive User posted Sun March 10, 2019 10:24 PM

  

Originally posted by: jrheath


IBM XL C/C++ for AIX's latest release (V16.1), made available in Dec 2018, has been enhanced to offer 2 families of invocation commands to call the compiler - the classic xlc, xlC and their equivalents, and the new xlclang and xlclang++.

 

What is xlclang/xlclang++ ?
The xlclang and xlclang++ compiler invocations adopt a new Clang-based compiler front-end with the same advanced optimization technology in the IBM compiler back end as xlc/xlC.  The optimization technology that is used in both invocations has been enhanced to provide maximum performance on the new POWER9 hardware. This adoption of Clang infrastructure has allowed IBM to accelerate the delivery of C/C++ language standard support, among other things. For some history about IBM's adoption of Clang technology, read "The Evolution of XL C/C++ Compilers".

 

Should I use xlclang/xlclang++ instead of xlc/xlC?
xlclang/xlclang++ is ideal for clients who are migrating from the Linux platform or migrating open source projects to AIX, especially for projects previously compiled with the gcc compiler. Migration efforts to xlclang/xlclang++ are greatly reduced compared to xlc/xlC. 
 
xlclang/xlclang++ is also suitable for those clients currently using xlc/xlC who want to use C11, C++11, and C++14 language standard features that are not supported by xlc/xlC, and are willing to spend some extra migration effort for that functionality. 

 

Migration considerations
If current xlC clients are looking to adopt xlclang for the modern language features, there are a few things to keep in mind. With the introduction of C++11, there is a binary compatibility breakage at the language level with C++03 and earlier (note: C is binary compatible). Due to this C++ binary compatibility breakage, clients cannot mix objects compiled with xlC and xlclang++. You are encouraged to compile source code and link the generated object files with a consistent invocation command
 
Also, there are some differences in xlc/xlC and xlclang/xlclang++ compiler options and pragmas that you may need to consider. XL compiler options, such as the -qoption_keyword options, are selectively supported by xlclang/xlclang++. For those options that aren't supported, you may have to change your compiler options to an equivalent Clang option. Learn more at Comparison between the XL-based and Clang-based front ends.
 
When you are reading the documentation, you will see icons that indicate which parts of document are applicable to xlc/xlC and which parts are applicable to xlclang/xlclang++. Learn more here.

 

Should I continue to use xlc/xlC?
Continue to use the xlc/xlC invocations if you:
  • Do not have new source code or development requirements to leverage C11, C++11, and C++14 language standard features.
  • Want to maintain 100% binary compatibility with legacy programs that were compiled by versions of IBM XL C/C++ for AIX prior to V16.1.
  • Compile code containing pragma directives compliant to the OpenMP Application Program Interface specification for explicit parallelization of C and C++ program code .

 

Do the XL Linux compilers use Clang infrastructure too?
Yes. Both XL C/C++ for AIX 16.1 and XL C/C++ for Linux (little endian) offer compiler invocations which combine the Clang front end infrastructure with the advanced optimization technology in the IBM compiler back end. 
 
XL C/C++ for AIX 16.1 offers 2 sets of invocations (one using Clang infrastructure and the other not) meanwhile XL C/C++ for Linux (little endian) offers only one invocation that uses the Clang infrastructure.  A non-Clang invocation was never offered for the Linux little endian edition. A non-Clang XL C/C++ for Linux was offered in XL C/C++ for Linux (big endian), and when the new little endian compilers came out, it was a good opportunity to start fresh with the new Clang infrastructure.

 

Try it out today!
To try out the new XL C/C++ for AIX compilers, simply download the fully functional, 60 day evaluation available at IBM Marketplace.
0 comments
6 views

Permalink