Hi. Is the alignment of a struct be computed in the constructor of StructLayout class? I wonder that the position of a member in the struct has been considered in llvm? Because the alignment of a member is dependent to the position in the struct in AIX platform according to the table in http://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/proguide/alignment.html (`power` alignment setting) 1. In aggregates, the first member of this data type is aligned according to its natural alignment value; subsequent members of the aggregate are aligned on 4-byte boundaries. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160505/cb0a2fc8/attachment.html>
For C code, record layout decisions are made here: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?view=markup LLVM's struct layout rules are only important if you aren't using clang. On Wed, May 4, 2016 at 8:06 PM, Zeson Wu via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi. > > Is the alignment of a struct be computed in the constructor of > StructLayout class? I wonder that the position of a member in the struct > has been considered in llvm? Because the alignment of a member is dependent > to the position in the struct in AIX platform according to the table in > http://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/proguide/alignment.html > (`power` alignment setting) > > > 1. In aggregates, the first member of this data type is aligned > according to its natural alignment value; subsequent members of the > aggregate are aligned on 4-byte boundaries. > > > Thanks > > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160505/bfac4651/attachment.html>
Dallman, John via llvm-dev
2016-May-06 09:20 UTC
[llvm-dev] [cfe-dev] struct layout in AIX
> Because the alignment of a member is dependent to the position in the struct in AIX platform according to the table in http://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/proguide/alignment.htmlAnd on the -qalign and #pragma options, which do get used. The commercial product I work on needs to be compiled -qalign=natural on AIX, or it doesn’t work (I can explain the reasons if anyone's interested, but they're complex, boring, and hard to work around). -- John Dallman ----------------- Siemens Industry Software Limited is a limited company registered in England and Wales. Registered number: 3476850. Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160506/0e3d6f2d/attachment.html>