This is an LLVM transformation pass that instruments LLVM IR to collect branch coverage data.
Follow these steps to use this tool:
- Build the BranchCovPass shared library.
- Compile the program you want to instrument with the Pass. Make sure to use the -g option - it's essential for this process.
- Compile the instrumented function.
- Link the object files to create the executable.
The branch coverage data will be saved in a file named coverage. The data format is as follows:
For conditional branches: lineNo.predicateIndex -> true_count, false_count
For switch statements: lineNo.predicateIndex -> true_count
Please note that the predicateIndex is not globally unique, but it is unique within the same line number.