This is an archive of the discontinued LLVM Phabricator instance.

[AIX] Port power alignment rules to clang
AbandonedPublic

Authored by Xiangling_L on Apr 21 2020, 7:08 AM.

Details

Summary

Address the following aspects of power alignment rules:

  • Implemented double/long double alignment when not first struct member
  • A double member in union is always treated as the first member, and should not use special alignment rule
  • Fixed the alignment issue caused by virtual function
  • Applied AIX Alignment rule when layout base class
  • Fixed AIX layout for zero sized bitfield followed by double

Diff Detail

Event Timeline

Xiangling_L created this revision.Apr 21 2020, 7:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2020, 7:08 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jasonliu added inline comments.Apr 21 2020, 2:37 PM
clang/test/Layout/aix-double-struct-member.cpp
136
  1. I think we also want to test empty base class with a derived class contains double as first. And also a non-empty base class with derived contains double as first to show that it has effect on basic inheritance as well.
  2. We need one more test for seeing how pack align interact with AIX alignment.
jasonliu added inline comments.Apr 21 2020, 2:39 PM
clang/include/clang/AST/RecordLayout.h
177

Not sure if aixOffset is a thing? Might be better to just say "aix offset alignment"?

jasonliu added inline comments.Apr 21 2020, 2:43 PM
clang/include/clang/AST/RecordLayout.h
81

AIX Alignment -> AIX alignment

clang/lib/AST/RecordLayoutBuilder.cpp
1013

Consistent spelling as: AIX-abi?

1853

Consistent spelling as AIX-abi?

clang/test/Layout/aix-double-struct-member.cpp
136

We also want to test if MaxFieldAlignment could override the AIX alignment.

Xiangling_L marked 5 inline comments as done.

Adjust some comments style;
Add more testcases;

Xiangling_L abandoned this revision.Apr 27 2020, 2:39 PM

Current implementation conflicts with __AlignOf behavior as we discussed in [RFC] Adding AIX power alignment rule in clang front end (http://lists.llvm.org/pipermail/cfe-dev/2020-April/065324.html) . Drop this revision and a new implementation will be put on Phabricator when it's ready.