[PATCH] Add loop unroll pragma support
Reid Kleckner
rnk at google.com
Tue Jun 10 14:33:22 PDT 2014
As far as the clang side goes, this all looks good.
As a separate chagne, we should have documentation for '#pragma clang loop ...' that explains the difference between 'vectorize', 'interleave', and 'unroll'. This should be in clang/docs/LanguageExtensions.html after '#pragma optnone'. The loop_hint attribute should point at it as the main documentation.
================
Comment at: lib/Sema/SemaStmtAttr.cpp:126-136
@@ -117,1 +125,13 @@
+ // Accumulated state of enable|disable hints for each hint category.
+ bool EnabledIsSet[3] = {false, false, false};
+ int EnabledValue[3];
+ // Accumulated state of numeric hints for each hint category.
+ bool NumericValueIsSet[3] = {false, false, false};
+ int NumericValue[3];
+ int EnableOptionId[3] = {LoopHintAttr::Vectorize, LoopHintAttr::Interleave,
+ LoopHintAttr::Unroll};
+ int NumericOptionId[3] = {LoopHintAttr::VectorizeWidth,
+ LoopHintAttr::InterleaveCount,
+ LoopHintAttr::UnrollCount};
+
----------------
Rather than having 6 parallel arrays, maybe this would be better as an array of a struct:
struct {
int EnableOptionId;
int NumericOptionId;
bool EnabledIsSet;
bool ValueIsSet;
bool Enabled;
int Value;
} Options[] = {
{LoopHintAttr::Vectorize, LoopHintAttr::VectorizeWidth},
{LoopHintAttr::Interleave, LoopHintAttr::InterleaveCount},
{LoopHintAttr::Unroll, LoopHintAttr::UnrollCount}
};
http://reviews.llvm.org/D4089
More information about the cfe-commits
mailing list