[PATCH] Add loop unroll pragma support

Tyler Nowicki tnowicki at apple.com
Tue Jun 10 15:39:40 PDT 2014


Hi Reid,

I’ll put a documentation patch up on the list shortly.

Tyler


On Jun 10, 2014, at 2:33 PM, Reid Kleckner <rnk at google.com> wrote:

> 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