[flang-commits] [compiler-rt] [clang] [flang] [clang-tools-extra] [llvm] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)
Erich Keane via flang-commits
flang-commits at lists.llvm.org
Mon Nov 13 11:56:04 PST 2023
================
@@ -322,6 +322,66 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A,
return ::new (S.Context) UnlikelyAttr(S.Context, A);
}
+CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI,
+ Expr *E) {
+ if (!E->isValueDependent()) {
+ llvm::APSInt ArgVal;
+ ExprResult Res = VerifyIntegerConstantExpression(E, &ArgVal);
+ if (Res.isInvalid())
+ return nullptr;
+ E = Res.get();
+
+ // This attribute requires an integer argument which is a constant power of
+ // two between 1 and 4096 inclusive.
+ int AlignValue = ArgVal.getSExtValue();
----------------
erichkeane wrote:
this should be int64. Also, we probably need a test for 'larger than 64 bit' I think? Else this is going to give weird behavior.
https://github.com/llvm/llvm-project/pull/70762
More information about the flang-commits
mailing list