[cfe-dev] aligned 'new'
Anton Yartsev
anton.yartsev at gmail.com
Sun May 29 20:49:28 PDT 2011
Hi all,
I am thinking of the ability of operator new to return memory aligned
according to the alignment of the type passed to it (at least of AltiVec
vector types whose proper alignment is essential).
The proposed implementation is:
1) clang: add -fstrict-aligned option. When the option is set it cause
clang to define the built-in macro "__STRICT_ALIGNED"
2) libcxx: add additional placement new declarations to
libcxx\include\new with the additional argument - alignment. Make this
declarations conditionalized on the "__STRICT_ALIGNED". Add new
definitions to libcxx\src\new.cpp.
3) clang: if -fstrict-aligned option is set, when clang sees a new of a
type which either has an inherent alignment, or has an explicit
alignment specified by __attribute__((__aligned__(x))), it will
transform the standard new call to a call to the aligned version of new.
Am i on the right way? Any thoughts?
--
Anton
More information about the cfe-dev
mailing list