summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/CoverageMappingReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* InstrProf: Fix CoverageMappingReader on big endianJustin Bogner2015-03-161-16/+28
| | | | | | | | This makes the reader check the endianness of the object file its given and behave appropriately. For the test I dug up a really old linker and created a ppc-apple-darwin file for llvm-cov to read. llvm-svn: 232422
* InstrProf: Do a better job of reading coverage mapping data.Justin Bogner2015-03-161-59/+41
| | | | | | | | | | | | | | | | | | | | | | This code was casting regions of a memory buffer to a couple of different structs. This is wrong in a few ways: 1. It breaks aliasing rules. 2. If the buffer isn't aligned, it hits undefined behaviour. 3. It completely ignores endianness differences. 4. The structs being defined for this aren't specifying their padding properly, so this doesn't even represent the data properly on some platforms. This commit is mostly NFC, except that it fixes reading coverage for 32 bit binaries as a side effect of getting rid of the mispadded structs. I've included a test for that. I've also baked in that we only handle little endian more explicitly, since that was true in practice already. I'll fix this to handle endianness properly in a followup commit. llvm-svn: 232346
* InstrProf: Teach llvm-cov to handle universal binaries when given -archJustin Bogner2015-03-111-6/+28
| | | | llvm-svn: 231902
* InstrProf: Simplify the construction of BinaryCoverageReaderJustin Bogner2015-02-261-60/+55
| | | | | | | | | | | | | Creating BinaryCoverageReader is a strange and complicated dance where the constructor sets error codes that member functions will later read, and the object is in an invalid state if readHeader isn't immediately called after construction. Instead, make the constructor private and add a static create method to do the construction properly. This also has the benefit of removing readHeader completely and simplifying the interface of the object. llvm-svn: 230676
* InstrProf: Rename ObjectFileCoverageMappingReader to BinaryCoverageReaderJustin Bogner2015-02-261-5/+5
| | | | | | | The current name is long and confusing. A shorter one is both easier to understand and easier to work with. llvm-svn: 230675
* InstrProf: Remove dead code in CoverageMappingReaderJustin Bogner2015-02-251-13/+3
| | | | | | | Remove a default argument that's never passed and a constructor that's never called. llvm-svn: 230563
* InstrProf: Make CounterMappingRegions less confusing to constructJustin Bogner2015-02-031-4/+3
| | | | | | | Creating empty and expansion regions is awkward with the current API. Expose static methods to make this simpler. llvm-svn: 228075
* InstrProf: Remove CoverageMapping::HasCodeBefore, it isn't usedJustin Bogner2015-02-031-8/+5
| | | | | | | It's not entirely clear to me what this field was meant for, but it's always false. Remove it. llvm-svn: 228034
* InstrProf: Simplify RawCoverageMappingReader's API slightlyJustin Bogner2015-02-031-7/+9
| | | | | | | | This is still kind of a weird API, but dropping the (partial) update of the passed in CoverageMappingRecord makes it a little easier to understand and use. llvm-svn: 227900
* InstrProf: Simplify some logic by using ArrayRef::slice (NFC)Justin Bogner2015-02-031-1/+1
| | | | llvm-svn: 227898
* [Object] Modify OwningBinary's interface to separate inspection from ownership.Lang Hames2014-10-311-1/+1
| | | | | | | | The getBinary and getBuffer method now return ordinary pointers of appropriate const-ness. Ownership is transferred by calling takeBinary(), which returns a pair of the Binary and a MemoryBuffer. llvm-svn: 221003
* Reduce double set lookups. NFC.Benjamin Kramer2014-10-101-2/+2
| | | | llvm-svn: 219505
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-081-1/+2
| | | | | | | | | | | | | | There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314
* llvm-cov: Move some reader debug output out of the tool.Justin Bogner2014-09-201-0/+15
| | | | | | | This debug output is really for testing CoverageMappingReader, not the llvm-cov tool. Move it to where it can be more useful. llvm-svn: 218183
* llvm-cov: add code coverage tool that's based on coverage mapping format and ↵Alex Lorenz2014-08-221-26/+71
| | | | | | | | | | | | | clang's pgo. This commit expands llvm-cov's functionality by adding support for a new code coverage tool that uses LLVM's coverage mapping format and clang's instrumentation based profiling. The gcov compatible tool can be invoked by supplying the 'gcov' command as the first argument, or by modifying the tool's name to end with 'gcov'. Differential Revision: http://reviews.llvm.org/D4445 llvm-svn: 216300
* Coverage Mapping: add function's hash to coverage function records.Alex Lorenz2014-08-211-2/+4
| | | | | | | | | | The profile data format was recently updated and the new indexing api requires the code coverage tool to know the function's hash as well as the function's name to get the execution counts for a function. Differential Revision: http://reviews.llvm.org/D4994 llvm-svn: 216207
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
* Coverage: add HasCodeBefore flag to a mapping region.Alex Lorenz2014-08-041-6/+10
| | | | | | | | | This flag will be used by the coverage tool to help compute the execution counts for each line in a source file. Differential Revision: http://reviews.llvm.org/D4746 llvm-svn: 214740
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+2
| | | | llvm-svn: 214377
* Coverage: improve efficiency of the counter propagation to the expansion ↵Alex Lorenz2014-07-291-8/+12
| | | | | | | | | regions. This patch reduces the complexity of the two inner loops in order to speed up the loading of coverage data for very large functions. llvm-svn: 214228
* coverage: remove empty mapping regionsAlex Lorenz2014-07-251-3/+0
| | | | | | | | This patch removes the empty coverage mapping regions. Those regions were produced by clang's old mapping region generation algorithm, but the new algorithm doesn't generate them. llvm-svn: 213981
* Fix a warning in CoverageMappingReader.cppEhsan Akhgari2014-07-251-1/+1
| | | | llvm-svn: 213920
* Add code coverage mapping data, reader, and writer.Alex Lorenz2014-07-241-0/+482
This patch implements the data structures, the reader and the writers for the new code coverage mapping system. The new code coverage mapping system uses the instrumentation based profiling to provide code coverage analysis. llvm-svn: 213910
OpenPOWER on IntegriCloud