summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/GCOV.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r196358: "llvm-cov: Added support for function checksums."Daniel Jasper2013-12-041-9/+3
| | | | | | | This currently breaks clang/test/CodeGen/code-coverage.c. The root cause is that the newly introduced access to Funcs[j] is out of bounds. llvm-svn: 196365
* llvm-cov: Added support for function checksums.Yuchen Wu2013-12-041-3/+9
| | | | | | | The function checksums are hashed from the concatenation of the function name and line number. llvm-svn: 196358
* llvm-cov: Added checks for ident, checksum, name.Yuchen Wu2013-12-041-15/+45
| | | | | | | Added additional checks for the Identifier, CfgChecksum and Name for each GCOVFunction. Also added function names in error messages. llvm-svn: 196356
* llvm-cov: Capitalized GCNO and GCDA for consistency.Yuchen Wu2013-12-041-5/+5
| | | | llvm-svn: 196354
* llvm-cov: Split GCOVFile's read into GCNO and GCDA.Yuchen Wu2013-12-041-52/+55
| | | | | | | | This splits the file-scope read() function into readGCNO() and readGCDA(). Also broke file format read into functions that first read the file type, then check the version. llvm-svn: 196353
* llvm-cov: Cleaned up print() function slightly.Yuchen Wu2013-12-031-9/+7
| | | | | | Changed while to for loop. Removed unnecessary if statement. llvm-svn: 196194
* llvm-cov: Removed output to STDOUT/specified file.Yuchen Wu2013-12-031-2/+7
| | | | | | | | | | | | Instead of asking the user to specify a single file to output coverage info and defaulting to STDOUT, llvm-cov now creates files for each source file with a naming system of: <source filename> + ".llcov". This is what gcov does and although it can clutter the working directory with numerous coverage files, it will be easier to hook the llvm-cov output to tools which operate on this assumption (such as lcov). llvm-svn: 196184
* llvm-cov: Store blocks rather than counts per line.Yuchen Wu2013-12-031-7/+13
| | | | | | | | | Each line stores all the blocks that execute on that line, instead of only storing the line counts previously accumulated. This provides more information for each line, and will be useful for options in enabling block and branch information. llvm-svn: 196177
* llvm-cov: Added edge struct for traversal in block.Yuchen Wu2013-12-031-12/+39
| | | | | | | | | | | | | Added GCOVEdge which are simple structs owned by the GCOVFunction that stores the source and destination GCOVBlocks, as well as the counts. Changed GCOVBlocks so that it stores a vector of source GCOVEdges and a vector of destination GCOVEdges, rather than just the block number. Storing the block number was only useful for knowing the number of edges and for debug info. Using a struct is useful for traversing the edges, especially back edges which may be needed later. llvm-svn: 196175
* llvm-cov: Split up reading of GCNO and GCDA files.Yuchen Wu2013-12-031-41/+49
| | | | | | There are now two functions: readGCNO() and readGCDA(). llvm-svn: 196173
* llvm-cov: Formatting change.Yuchen Wu2013-11-211-2/+1
| | | | llvm-svn: 195310
* llvm-cov: Added file checksum to gcno and gcda files.Yuchen Wu2013-11-201-0/+7
| | | | | | | | | | | | Instead of permanently outputting "MVLL" as the file checksum, clang will create gcno and gcda checksums by hashing the destination block numbers of every arc. This allows for llvm-cov to check if the two gcov files are synchronized. Regenerated the test files so they contain the checksum. Also added negative test to ensure error when the checksums don't match. llvm-svn: 195191
* llvm-cov: Moved printing after error checks.Yuchen Wu2013-11-191-6/+8
| | | | llvm-svn: 195153
* llvm-cov: Added constness property to methods.Yuchen Wu2013-11-191-14/+15
| | | | | | | Added constness to methods that shouldn't modify objects. Replaced operator[] lookup in maps with find() instead. llvm-svn: 195151
* llvm-cov: Clean up memory leaks.Benjamin Kramer2013-11-151-1/+1
| | | | llvm-svn: 194799
* IR/GCOV.cpp: Use PRIu64 as format string with uint64_t.NAKAMURA Takumi2013-11-141-1/+1
| | | | llvm-svn: 194693
* Whitespace.NAKAMURA Takumi2013-11-141-3/+2
| | | | llvm-svn: 194692
* llvm-cov: Slightly improved error checking.Yuchen Wu2013-11-141-0/+4
| | | | | | | | - readInt() should check all 4 bytes can be read, not just 1. - In the event of false data in the gcno file, it was possible to index into a non-existent index of SmallVector, causing assertion error. llvm-svn: 194639
* llvm-cov: Removed StringMap holding GCOVLines.Yuchen Wu2013-11-141-39/+15
| | | | | | | | | | | | | | | | | According to the hazy gcov documentation, it appeared to be technically possible for lines within a block to belong to different source files. However, upon further investigation, gcov does not actually support multiple source files for a single block. This change removes a level of separation between blocks and lines by replacing the StringMap of GCOVLines with a SmallVector of ints representing line numbers. This also means that the GCOVLines class is no longer needed. This paves the way for supporting the "-a" option, which will output block information. llvm-svn: 194637
* llvm-cov: Replaced asserts with proper error handling.Yuchen Wu2013-11-141-44/+79
| | | | | | | | | | | | | | Unified the interface for read functions. They all return a boolean indicating if the read from file succeeded. Functions that previously returned the read value now store it into a variable that is passed in by reference instead. Callers will need to check the return value to detect if an error occurred. Also added a new test which ensures that no assertions occur when file contains invalid data. llvm-cov should return with error code 1 upon failure. llvm-svn: 194635
* Revert "llvm-cov: Added command-line option to change dir."Yuchen Wu2013-11-051-8/+6
| | | | | | This reverts commit d8acf0078cf363252727acff00f85ae8074f95b3. llvm-svn: 194040
* llvm-cov: Added command-line option to change dir.Yuchen Wu2013-11-051-6/+8
| | | | | | | This will allow for much easier testing when the input files are in a different folder from the test script. llvm-svn: 194034
* Support for reading run counts in llvm-cov.Yuchen Wu2013-11-051-1/+13
| | | | | | | | | | | | This patch enables llvm-cov to correctly output the run count stored in the GCDA file. GCOVProfiling currently does not generate this information, so the GCDA run data had to be hacked on from a GCDA file generated by gcc. This is corrected by a subsequent patch. With the run and program data included, both llvm-cov and gcov produced the same output. llvm-svn: 194033
* Added command-line option to output llvm-cov to file.Yuchen Wu2013-11-021-10/+11
| | | | | | | Added -o option to llvm-cov. If no output file is specified, it defaults to STDOUT. llvm-svn: 193899
* llvm-cov dump to dbgs() instead of outs().Yuchen Wu2013-10-251-13/+14
| | | | llvm-svn: 193390
* Support for reading program counts in llvm-cov.Yuchen Wu2013-10-251-12/+17
| | | | | | | | | | | | | llvm-cov will now be able to read program counts from the GCDA file and output it in the same format as gcov. The program summary tag was identified from gcov-io.h as "\0\0\0\a3". There is currently a bug in GCOVProfiling.cpp which does not generate the run- or program-counting IR, so this change was tested manually by modifying the GCDA file and comparing the gcov and llvm-cov outputs. llvm-svn: 193389
* Fixed llvm-cov to count edges instead of blocks.Yuchen Wu2013-10-241-2/+11
| | | | | | | | | | | | | | | | | This was a fundamental flaw in llvm-cov where it treated the values in the GCDA files as block counts instead of edge counts. This created incorrect line counts when branching was present. Instead, the edge counts should be summed to obtain the correct block count. The fix was tested using custom test files as well as single source files from the test-suite directory. The behaviour can be verified by reading the GCOV documentation that describes the GCDA spec ("ARC_COUNTS gives the counter values for those arcs that are instrumented") and the header description provided by GCOVProfiling.cpp ("instruments the code that runs to records (sic) the edges between blocks that run and emit a complementary "gcda" file on exit"). llvm-svn: 193299
* Use a map instead of vector to store line counts.Yuchen Wu2013-10-231-22/+10
| | | | | | | | | | | | There are a few motivations for this: - Using a map allows for checking if line is in map. This differentiates unexecutable lines (such as comments) from unexecuted logical lines of code. "#####" is now outputted in this case, in line with gcov. - Source files are no longer read in twice: once when storing the line counts, and once when outputting the data. - Greatly simplifies the function FileInfo::addLineCount(). llvm-svn: 193264
* Test commit. Added whitespace in GCOV.cpp.Yuchen Wu2013-10-231-1/+1
| | | | llvm-svn: 193224
* llvm-cov: Use uint32_t for loop variables to be more consistent.Bob Wilson2013-10-221-2/+2
| | | | | | | | | The loop bounds here are uint32_t variables, so it makes sense for the loop variables to have the same type. Patch by Yuchen Wu! llvm-svn: 193192
* llvm-cov: fix a typo and rename a variable.Bob Wilson2013-10-221-4/+4
| | | | | | | | | Rename Size to EndPos, which makes more sense because the variable stores the last location of the blocks. Patch by Yuchen Wu! llvm-svn: 193189
* Fix llvm-cov counts to be 64-bit integers to avoid overflows.Bob Wilson2013-10-221-2/+2
| | | | | | | | | | Line counts in llvm-cov are read in as 64-bit integers but were being truncated to 32-bit in collectLineCounts(), which caused overflow for large counts. This patch fixes all counts to be uint64_t. Patch by Yuchen Wu! llvm-svn: 193172
* Change llvm-cov output formatting to be more similar to gcov.Bob Wilson2013-10-221-7/+9
| | | | | | | | | | | | - Replaced tabs with proper padding - print() takes two arguments, which are the GCNO and GCDA filenames - Files are listed at the top of output, appended by line 0 - Stripped strings of trailing \0s - Removed last two lines of whitespace in output Patch by Yuchen Wu! llvm-svn: 193148
* Move the printing of llvm-cov information out from collectLineCounts().Bob Wilson2013-10-221-1/+0
| | | | | | | | | | collectLineCounts() should only organize the output data. This is done in anticipation of subsequent changes which will pass in GCNO and GCDA filenames into the print function where it is printed similar to the gcov output. Patch by Yuchen Wu! llvm-svn: 193134
* Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-041-7/+7
| | | | | | specifying the vector size. llvm-svn: 185606
* The GCDA 402 format won't have a second checksum either.Bill Wendling2013-06-251-1/+1
| | | | llvm-svn: 184864
* Rename VMCore directory to IR.Chandler Carruth2013-01-021-0/+283
Aside from moving the actual files, this patch only updates the build system and the source file comments under lib/... that are relevant. I'll be updating other docs and other files in smaller subsequnet commits. While I've tried to test this, but it is entirely possible that there will still be some build system fallout. Also, note that I've not changed the library name itself: libLLVMCore.a is still the library name. I'd be interested in others' opinions about whether we should rename this as well (I think we should, just not sure what it might break) llvm-svn: 171359
OpenPOWER on IntegriCloud