Julien Peeters
2013-Apr-20 06:43 UTC
[LLVMdev] Adding custom pragma's for generating particular LLVM IR
Hi ML readers, I would first apology if this was already addressed on this ML, but I didn't find information on this topic. I would like to add custom pragma's that generate particular LLVM IR. Here is an example: int a, b; /* ... */ #pragma mypragma shared(a, b) { a = b; b++; } would result in this (pseudo) LLVM IR: %1 alloca i32 %2 alloca i32 ... call void @start_callback () %3 call i32 @check_callback ( i32 %1 ) %4 call i32 @check_callback ( i32 %2 ) ... call void @end_callback () ... Note: All *_callback functions are implemented in a third party library. I guess that is it quite close to what was implemented for the OpenMP support, but I need something simpler. Basically, how can I - Add a pragma that identifies a block (i.e. scope) of code ? - Add an action that flag some variables as __shared__ in the annotated block ? - Generate LLVM IR that add specific call-backs at the start and end of the block and on shared variables ? I hope my explanation is sufficiently clear. Feel free to ask questions if it's not. Best regards, Julien.
Duncan Sands
2013-Apr-22 09:55 UTC
[LLVMdev] Adding custom pragma's for generating particular LLVM IR
Hi Julien, as this would all presumably be done in the clang front-end I suggest you ask on the clang mailing list. Ciao, Duncan. On 20/04/13 08:43, Julien Peeters wrote:> Hi ML readers, > > I would first apology if this was already addressed on this ML, but I didn't > find information on this topic. > > I would like to add custom pragma's that generate particular LLVM IR. Here is an > example: > > > int a, b; > > /* ... */ > > #pragma mypragma shared(a, b) > { > a = b; > b++; > } > > > would result in this (pseudo) LLVM IR: > > %1 alloca i32 > %2 alloca i32 > > ... > > call void @start_callback () > %3 call i32 @check_callback ( i32 %1 ) > %4 call i32 @check_callback ( i32 %2 ) > ... > call void @end_callback () > > ... > > Note: All *_callback functions are implemented in a third party library. > > I guess that is it quite close to what was implemented for the OpenMP support, > but I need something simpler. > > Basically, how can I > - Add a pragma that identifies a block (i.e. scope) of code ? > - Add an action that flag some variables as __shared__ in the annotated block ? > - Generate LLVM IR that add specific call-backs at the start and end of the > block and on shared variables ? > > I hope my explanation is sufficiently clear. Feel free to ask questions if it's > not. > > Best regards, > Julien. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Possibly Parallel Threads
- [PATCH 1/3] libxenlight: Clean up logging arrangements
- [LLVMdev] UNREACHABLE executed! error while trying to generate PTX
- NVPTX - Reordering load instructions
- NVPTX - Reordering load instructions
- [LLVMdev] UNREACHABLE executed! error while trying to generate PTX