[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 04:37:01 PST 2019
> On 24 Jan 2019, at 04:13, Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 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?
> Alternatively, I could manually insert the code to the IR .ll file.
> I see the generated .ll use the following function when
> -finstrument-functions is enabled. Is there an equivalent function for
> code blocks?
> %1 = call i8* @llvm.returnaddress(i32 0), !dbg !10
You’re probably looking for the “coverage” builds of clang which add instrumentation in the IR:
(Details of the data you can get is at https://llvm.org/docs/CoverageMappingFormat.html).
I’m not sure there’s something built into LLVM that makes that happen, but I suggest looking into what the coverage-instrumented .ll files look like when clang does it.
More information about the llvm-dev