I want to know which all llvm IR statements correspond to the code inside a particular pragma in clang. My pragma is having the following structure.
#pragma markme
{
stmt1;
stmt2;
}
I need to know which all stmts were present between the opening braces and closing braces of mark me pragma.
Can we attach some metadata to these stmts? If yes could anyone point me to some reference.
I have searched on Google and found this
Add a pragma handler, which has a callback on the actions interface. Add a sema implementation of the callback, which sets some internal bit in the Sema object. Add a new bit to the 'for' statement, to specify whether this it had #pragma optimize set. Modify codegin to emit the metadata based on that bit.
Could any one give more details on this.
I am using the latest llvm (llvm 3.4)
Note: Any help in any direction is appreciated. I know llvm may do optimizations that moves the statements around. But this is fine with me