[llvm-dev] option similar to -finstrument-functions but for code blocks

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 24 21:26:00 PST 2019



> On 25 Jan 2019, at 03:27, Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> On Thu, Jan 24, 2019 at 10:19 AM David Greene <dag at cray.com> wrote:
>> 
>> Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> writes:
>> 
>>> I'd like to track not just at the function level, but also at the code
>>> block level. For example, for a if-else statement, I want to know when
>>> the if-branch or else-branch is enter/exit.
>>> 
>>> Is there a clang option similar to -finstrument-functions for code blocks?
>> 
>> Are you looking for code coverage or profile information (block
>> execution counts)?  Dean already replied with the code coverage
>> information.
> 
> Not really. I don't care really the number of times an instruction is
> called. I care about the control flow and I'd like to visualize it as
> a graph. cfg is static. I'd like something dynamic which only shows
> what is run.
> 
> Of course, having the additional information about the count should be
> fine. But it is secondary.
> 

As far as I can tell, what you want is a subset of the data that the coverage tooling provides.

Is there something else you’re looking for? Do you need temporal information as well, to see when a particular basic block is run? I don’t know if the coverage infrastructure gives that information, but I’m positive you can hook something up through the gcov infrastructure which David mentioned to install your own runtime handler when functions (and code blocks?) get executed.

>> LLVM has a profile instrumentation pass which is run with
>> opt -profile-generate.  This is gprof-style profiling.  I don't know
>> offhand which (if any) clang option is hooked up to -profile-generate.
>> 
>>                           -David
> 
> -- 
> Regards,
> Peng
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-- Dean



More information about the llvm-dev mailing list