Identifying hotspot blocks

Hi Everyone,

I am working on a project where I am profiling source code(using gcov) line by line, so as to identify hot spots in the code, and identify the assembly code corresponding to that particular hotspot(I have to later get an unique signature for this assembly code).

This is the approach I am following. I have inserted a dummy function say foo(), and am using a function call to foo(); before and after the hot spots in the code to act as a marker for me in the assembly code. I then would like to use the SCC call graph pass in the code and only extract the signature features for blocks which come between two foo_start() and foo_end() function calls.

Can anyone please comment on how I can implement this, I am relatively new to llvm, but Im guessing if I need generate a pass which can show me the whole CFG in a stack and then do analysis of different blocks. Maybe inherit a pass from SCCCallgraphPass and BlockGraphPass?