Hi everyone,
I've been looking at the internals of gcc for a while now, trying to
figure out the best way to get some information out of it at the
assembly code level, but still can't work out what's best. I'm wondering
if anyone can help.
Background: I'm a postdoc at Edinburgh university looking to use gcc for
some cache optimisation research. I'm using gcc 4.2.0 cross-compiled for
a PowerPC 405.
The grand scheme is to be able to mark certain memory accesses and later
use the information in a simulator where I'll implement some sort of
cache optimisation scheme. For now I'm interested in arrays. For
example, a piece of C code like this:
for (i = 0; i < RANDOM_CHUNKS; i++) {
random_text[i] = RANDOM_TEXT;
}
I'm interested in capturing the access pattern of the stores to
'random_text', and I've already created a pass based on prefetch
insertion in 'tree-ssa-loop-prefetch.c', since this seems to get the
information I want.
Now, the main problem is that I want to tie this information to the
assembly code store that performs this operation. So, it seems to me
that I have to pass the information through the tree structures, down
into RTL and the out when the assembly code is printed.
I've been considering how to do this, but can't see what's best. I've
thought about creating a new tree annotation, but then I'll have to
modify any passes that might alter the tree and not copy it across
(because they don't know about it). In the RTL, I'm thinking of using
notes too.
I have several questions about this:
1) Is the tree SSA format the best place to gather this information?
2) Are annotations the best way to keep the information in the trees?
3) Are notes the best way to keep the information in the RTL?
4) Are there any pitfalls I might not be aware of just at the moment
that could trip me up later?
Thanks very much for your time.
Cheers
Tim
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.