Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a spec for loop unroll #263

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions specs/language/statements.tex
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
\Ch{Statements}{Stmt}
farzonl marked this conversation as resolved.
Show resolved Hide resolved
\begin{grammar}
\define{statement}\br
labeled-statement\br
\opt{attribute-specifier-sequence} expression-statement\br
\opt{attribute-specifier-sequence} compound-statement\br
\opt{attribute-specifier-sequence} iteration-statement\br
\opt{attribute-specifier-sequence} selection-statement\br
declaration-statement
\end{grammar}
\Sec{Label Statements}{Stmt.Label}
\p The optional \textit{attribute-specifier-sequence} applies to the statement
that immediately follows it.
\Sec{Attributes}{Stmt.Attr}
farzonl marked this conversation as resolved.
Show resolved Hide resolved
farzonl marked this conversation as resolved.
Show resolved Hide resolved
\Sub{Unroll Attribute}{Stmt.Attr.Unroll}
\p The \textit{[unroll]} attribute is only valid when applied to
\textit{iteration-statements}. It is used to indicate that
\textit{iteration-statements} like \texttt{for}, \texttt{while} and
\texttt{do while} can be unrolled. This attribute qualifier can be used to
specify full unrolling or partial unrolling by a specified amount. This is a
compiler hint and the compiler may ignore this directive.

\p The unroll attribute may optionally have an unroll factor represented as a
single argument \texttt{n} that is an integer constant expression value
greater than zero. If n is not specified, the compiler determines the
unrolling factor for the loop. The \textit{[unroll]} attribute can not be
applied to the same \textit{iteration-statement} as the \texttt{[loop]}
attribute.

\Sub{Loop Attribute}{Stmt.Attr.Loop}
\p The Attribute \texttt{[loop]} tells the compiler to execute each iteration
of the loop. In other words, its a hint to indicate a loop should not be
unrolled. Therefore it is not compatible with the \texttt{[unroll]} attribute.
Loading