[cfe-dev] aligned 'new'

alex_rosenberg at playstation.sony.com alex_rosenberg at playstation.sony.com
Thu Sep 8 14:57:01 PDT 2011


On Fri, Sep 2, 2011 at 6:26 PM, John McCall <rjmccall at apple.com> wrote:
> On Sep 2, 2011, at 9:47 AM, Anton Yartsev wrote:
>>> Now, the meta-level point: this is a significant extension to Clang, so it needs proper documentation, a specification, a test suite, etc., as described in
>>>
>>>      http://clang.llvm.org/get_involved.html
>>>
>>> You mentioned that this is a pre-existing feature for ppu-lv2-gcc from the Sony Cell SDK, which likely means that the design of the feature is already fairly constrained. That said, we need to understand the design of the feature before we can evaluate the implementation, and I still don't have a good sense of how the feature is supposed to work. More documentation and examples would help a lot.
>> added the test.
>>
>> That is how the feature is designed in ppu-lv2-gcc:
>> giving -fstrict-align option to ppu-lv2-gcc does the following:
>
> This is a terrible choice of name for this command-line option.  If I had to come up with a list of ten things that "strict-align" means, I don't think "make operator new take an alignment argument" would be on it at all.  Since this feature has been implemented in precisely one previous vendor-specific frontend, I think it's worthwhile to establish a better precedent.
>
> I would suggest something like -foperator-new-alignment.

FWIW, I agree, but I don't have a lot of choice about this legacy feature.

Some background:

<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15795>
<http://gcc.gnu.org/ml/gcc/2006-10/msg00166.html>
<http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01151.html>

While the examples shown speak freely of 16-byte aligned vectors which is the most common case where this issue comes up, it is also very frequently used for cache-aligned structures, and occasionally larger.

This feature was shipped in GCC 4.0.2 and 4.1.1 as part of the publicly available Sony-Toshiba-IBM Cell SDK. GCC 4.0.2, 4.1.1, and 4.3 in the Sony Computer Entertainment PS3 SDK also implement this feature. SN Systems SNC Compiler for PS3 has this feature to match GCC, and SNC for the forthcoming PlayStation Vita platform also carries this feature. I would not be surprised if other developer tools such as those from CodePlay, Metrowerks, Coverity, Klocwork, etc. have implemented this feature for parity as well -- I can't say offhand.

We're committed to cleaning this up and supporting it as necessary.

-----------------------------------------
Alex Rosenberg
Manager, Platform Architecture
Sony Computer Entertainment America, Inc.





More information about the cfe-dev mailing list