From a05fb8f439db27fe7d5a254f3f5ce2640b9092c7 Mon Sep 17 00:00:00 2001 From: Tyler Nowicki Date: Thu, 31 Jul 2014 20:15:14 +0000 Subject: [PATCH] Add a state variable to the loop hint attribute. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Resubmit with changes to try to fix the build-bot issue. Reviewed by Aaron Ballman git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214432 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Attr.td | 25 +++-- include/clang/Basic/DiagnosticParseKinds.td | 6 ++ include/clang/Basic/DiagnosticSemaKinds.td | 2 - include/clang/Parse/Parser.h | 2 +- include/clang/Sema/LoopHint.h | 10 +- lib/CodeGen/CGStmt.cpp | 7 +- lib/Parse/ParsePragma.cpp | 112 ++++++++++++-------- lib/Parse/ParseStmt.cpp | 7 +- lib/Sema/SemaStmtAttr.cpp | 104 ++++++++---------- test/Parser/pragma-loop.cpp | 3 + 10 files changed, 158 insertions(+), 120 deletions(-) diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index b914faf6b1..309f00aa26 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -1784,12 +1784,18 @@ def Unaligned : IgnoredAttr { } def LoopHint : Attr { - /// vectorize: vectorizes loop operations if 'value != 0'. - /// vectorize_width: vectorize loop operations with width 'value'. - /// interleave: interleave multiple loop iterations if 'value != 0'. - /// interleave_count: interleaves 'value' loop interations. - /// unroll: fully unroll loop if 'value != 0'. - /// unroll_count: unrolls loop 'value' times. + /// #pragma clang loop