[PATCH] D107497: [PowerPC][AIX] Limit attribute aligned to 4096.

Sean Fertile via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 4 12:53:53 PDT 2021


sfertile created this revision.
sfertile added reviewers: Jake-Egan, stevewan.
sfertile added a project: PowerPC.
Herald added subscribers: shchenz, nemanjai.
Herald added a reviewer: aaron.ballman.
sfertile requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Limit the maximum alignment for attribute aligned to 4096 to match the limit of the .align pseudo op in the system assembler.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107497

Files:
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Sema/aix-attr-aligned-limit.c


Index: clang/test/Sema/aix-attr-aligned-limit.c
===================================================================
--- /dev/null
+++ clang/test/Sema/aix-attr-aligned-limit.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -fsyntax-only -verify %s
+//
+int a __attribute__((aligned(8192))); // expected-error {{requested alignment must be 4096 bytes or smaller}}
Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -4054,6 +4054,9 @@
   unsigned MaximumAlignment = Sema::MaximumAlignment;
   if (Context.getTargetInfo().getTriple().isOSBinFormatCOFF())
     MaximumAlignment = std::min(MaximumAlignment, 8192u);
+  else if(Context.getTargetInfo().getTriple().isOSAIX())
+    MaximumAlignment = std::min(MaximumAlignment, 4096u);
+
   if (AlignVal > MaximumAlignment) {
     Diag(AttrLoc, diag::err_attribute_aligned_too_great)
         << MaximumAlignment << E->getSourceRange();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107497.364225.patch
Type: text/x-patch
Size: 1101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210804/2a20ff84/attachment-0001.bin>


More information about the cfe-commits mailing list