Optimizing C code at optimization level 2

VERSION 3 Published

Created on: Jul 15, 2009 2:42 PM by johnpm - Last Modified:  Sep 28, 2009 8:59 AM by johnpm

This paper describes coding techniques that may improve optimization of your programs at level 2 and recommends using compiler options to help you get the best performance from your application code.

Average User Rating
(1 rating)




Jul 17, 2009 1:56 PM Click to view timhahn's profile timhahn says:

Hi,

I found this to be a very good document describing the optimization features of the IBM xlC/C++ compiler.

It would be nice if the document contained a summary table of the compiler options and their possible values along with a short description of their effect. This could then be used as a quick-reference by those people who are using the optimization capabilities.

I had one question:

The article mentions several times the importance of making sure that the source code is "compliant ... with the language standard". Is there a compile option that can be used to point out areas of the code that are NOT compliant with the language standard?

Thanks,
Tim Hahn

Jul 17, 2009 2:19 PM Click to view jrheath's profile jrheath says: in response to: timhahn

Hi Tim,

In order to get some assurance that your code is language standards compliant, you could compile with -qinfo=lan:por option. This should generate informational messages that your code complies with the language level specified (lan) and that you are not using non-portable constructs (por).

However, in order to conclusively determine that your code is standards compliant, you can compile with:
* -qlanglvl=stdc89 for C89 standard compliance (C only)
* -qlanglvl=stdc99 for C99 standard compliance (C only)
* -qlanglvl=strict98 for C++ standard compliance (C++ only)

This will generate warnings and/or errors in the case where language standards compliance is broken. If your code compiles clean, you can be assured that it is standards compliant.

Jul 17, 2009 2:40 PM Click to view timhahn's profile timhahn says: in response to: jrheath

J.R.

Thanks - this is great information to augment the document's useful information.

Tim Hahn

Bottom Banner