This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Ways to add source annotations to a loop
- From: Alexey Kravets <mr dot kayrick at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 3 Dec 2012 10:05:29 +0000
- Subject: Ways to add source annotations to a loop
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