[cfe-dev] [PROPOSAL] per-function optimization level control
richard at metafoo.co.uk
Wed Apr 24 07:50:59 PDT 2013
On Wed, Apr 24, 2013 at 6:00 AM, <Andrea_DiBiagio at sn.scee.net> wrote:
> We've had a high priority feature request from a number of our customers
> provide per-function optimization in our Clang/LLVM compiler.
> I would be interested in working with the community to implement this.
> The idea is to allow the optimization level to be overridden
> for specific functions.
> The rest of this proposal is organized as follows:
> - Section 1. describes this new feature and explains why and when
> per-function optimization options are useful;
> - Sections 2. and 3. describe how the optimizer could be adapted/changed
> to allow the definition of per-function optimizations;
> - Section 4. tries to outline a possible workflow for implementing this
> new feature.
> I am looking for any feedback or suggestions etc.
> Andrea Di Biagio
> SN Systems Ltd.
> 1. Description
> The idea is to add pragmas to control the optimization level on functions.
> A similar approach has been implemented by GCC as well.
> Since GCC 4.4, new function specific option pragmas have been added to
> users to set the optimization level on a per function basis.
> describes the pragmas as
> #pragma GCC optimize ("string")
> #pragma GCC push_options
> #pragma GCC pop_options
> #pragma GCC reset_options
> Instead of imitating GCC's syntax, I think it would be better to use a
> consistent with existing pragma clang diagnostics:
> #pragma clang optimize push
> #pragma clang optimize "string"
> #pragma clang optimize pop
Since the intent is to provide overrides on a per-function basis, have you
considered using a function attribute instead of a pragma?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev