Ways to add source annotations to a loop
Alexey Kravets
mr.kayrick@gmail.com
Mon Dec 3 10:05:00 GMT 2012
Hello,
I am looking for a way to implement source annotation (or something
similar) for a for loops. Basically, I need some mechanism to mark
certain for loops in the source code for the GIMPLE optimization
passes (for C/C++ only currently).
For example something like this:
int i;
__attribute__((marked)) // Not compilable by GCC.
for (i =0; i < 100; i++) {
foo (i);
}
or
int i;
#pragma marked // Can be compiled, but require additional GIMPLE tree nodes.
for (i =0; i < 100; i++) {
foo (i);
}
As far as I know, for loops are lowered to jumps by C front-end and
natural loops are detected later, so there is no strait way of passing
such information.
OpenMP pragmas provides such functionality, but require additional
GIMPLE nodes to be defined and carried through all optimization
passes,
which I would prefer to avoid (if possible). So, is there any strait
way to implement this?
Best regards,
Alexey
More information about the Gcc
mailing list