How Pragma Unroll works in clang and llvm

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How Pragma Unroll works in clang and llvm

Sumner, Brian via cfe-dev
Hi,
I am trying to understand how Pragma Unroll is implemented in clang and llvm.

According to my understanding, this pragma is processed and new token
is generated in clang/lib/Parse/ParsePragma.cpp
PragmaUnrollHintHandler::HandlePragma function.
Then the token is processed in *handleLoopHintAttr in
clang/lib/Sema/SemaStmtAttr.cpp file.

But its not clear to me how this information is parsed to LLVM and processed.
1. Can someone explain this procedure?
2. Are their any other materials I can follow except the source code
to understand this better?

Thanks
Nisal
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How Pragma Unroll works in clang and llvm

Sumner, Brian via cfe-dev
On 8/10/2017 10:48 AM, Nisal Menuka via cfe-dev wrote:

> Hi,
> I am trying to understand how Pragma Unroll is implemented in clang and llvm.
>
> According to my understanding, this pragma is processed and new token
> is generated in clang/lib/Parse/ParsePragma.cpp
> PragmaUnrollHintHandler::HandlePragma function.
> Then the token is processed in *handleLoopHintAttr in
> clang/lib/Sema/SemaStmtAttr.cpp file.
>
> But its not clear to me how this information is parsed to LLVM and processed.

clang annotates the IR for the loop with metadata, then the loop unroll
pass uses that metadata to unroll the loop as requested.  See
http://llvm.org/docs/LangRef.html#llvm-loop-unroll for a description of
the metadata.  If you want to read the related code, grep for
"llvm.loop.unroll".

-Eli

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...