"Annotate" INSN in gcc

wuxi wu.andrew.xi@gmail.com
Sat Nov 1 09:19:00 GMT 2008


Hi,

I am working on IA64 and gcc4.1.1. My primary work is to use control 
speculation on IA64 to implement efficient taint tracking. We have 
already had a paper on ISCA'08.

For this purpose, I add a pass (before the 2nd instruction scheduling) 
to instrument loads, stores, and compares. During the pass, I identify 
each INSN by "manually" matching their patterns (since at that time, 
INSNs in gcc have not bee fully recognized, I have to write my own 
recognizers for instructions).

However, the downside of this approach is that I may miss some 
instructions (though most of the instructions have been instrumented), 
and these uninstrumented ones (though rare) will bring bizarre bugs into 
the instrumented program. (recently I find one such bug in my 
instrumented program, missing to instrument one instruction in about 
30,0000 instructions...)

So now, I want to add some checking in final to see if my 
instrumentation is complete. The basic thing I want to do is to 
associate some attributes to the INSN I want to instrument, and also my 
instrumentation INSNs, in the added pass. Later in final, I could use 
GCC's INSN_CODE (or perhaps INSN template) to match all INSNs and see 
whether I have done all things right.

NOW my problem is: could GCC do this work easily, or I should add my own 
data structure to record instrumented INSN? I have read some doc about 
insn attributes, but it seems that they do not fit into my needs...

NOTE: the attributes should be bundled with the INSN, they should go 
along with INSN in other passes, e.g. scheduling, and should not be 
deleted by other passes.

Any help is truly appreciated :-)

Thanks !

yours sincerely

Andrew



More information about the Gcc mailing list