Commit Graph

37 Commits

Author SHA1 Message Date
Alex Lorenz b2ebf2a08b coverage: remove empty mapping regions
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
2014-07-25 22:22:24 +00:00
Ehsan Akhgari 29b61ce770 Fix a warning in CoverageMappingReader.cpp
llvm-svn: 213920
2014-07-25 02:51:57 +00:00
Alex Lorenz a20a5d50ba Add code coverage mapping data, reader, and writer.
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
2014-07-24 23:57:54 +00:00
Alex Lorenz 817e485470 Add code coverage mapping data, reader, and writer.
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: 213909
2014-07-24 23:55:56 +00:00
Rafael Espindola adf21f2a56 Update the MemoryBuffer API to use ErrorOr.
llvm-svn: 212405
2014-07-06 17:43:13 +00:00
Artyom Skrobov ef5e867f16 Renaming SwapByteOrder() to getSwappedBytes()
The next commit will add swapByteOrder(), acting in-place

llvm-svn: 210973
2014-06-14 11:36:01 +00:00
Rafael Espindola 54f1997979 Remove unused and odd code.
This code was never being used and any use of it would look fairly strange.
For example, it would try to map a object_error::parse_failed to
std::errc::invalid_argument.

llvm-svn: 210912
2014-06-13 15:36:17 +00:00
Rafael Espindola db4ed0bdab Remove 'using std::errro_code' from lib.
llvm-svn: 210871
2014-06-13 02:24:39 +00:00
Rafael Espindola 3acea39853 Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

llvm-svn: 210835
2014-06-12 21:46:39 +00:00
Rafael Espindola 25188c95de Don't import error_category into the llvm namespace.
llvm-svn: 210733
2014-06-12 01:45:43 +00:00
Rafael Espindola acc5d7c911 Don't import error_condition into the llvm namespace.
llvm-svn: 210731
2014-06-12 01:29:42 +00:00
Rafael Espindola 5c4f829424 Use std::error_code instead of llvm::error_code.
The idea of this patch is to turn llvm/Support/system_error.h into a
transitional header that just brings in the erorr_code api to the llvm
namespace. I will remove it shortly afterwards.

The cases where the general idea needed some tweaking:

* std::errc is a namespace in msvc, so we cannot use "using std::errc". I could
add an #ifdef, but there were not that many uses, so I just added std:: to
them in this patch.

* Template specialization had to be moved to the std namespace in this
patch set already.

* The msvc implementation of default_error_condition doesn't seem to
provide the same transformations as we need. Not too surprising since
the standard doesn't actually say what "equivalent" means. I fixed the
problem by keeping our old mapping and using it at error_code
construction time.

Despite these shortcomings I think this is still a good thing. Some reasons:

* The different implementations of system_error might improve over time.
* It removes 925 lines of code from llvm already.
* It removes 6313 bytes from the text segment of the clang binary when
it is built with gcc and 2816 bytes when building with clang and
libstdc++.

llvm-svn: 210687
2014-06-11 19:05:50 +00:00
Rafael Espindola f5d07fa586 Mark a few functions noexcept.
This reduces the difference between std::error_code and llvm::error_code.

llvm-svn: 210591
2014-06-10 21:26:47 +00:00
Rafael Espindola 92512e89a2 Use an enum class.
Might also fix the windows build.

llvm-svn: 210077
2014-06-03 05:12:33 +00:00
Rafael Espindola a3f2e3f01e There is no std::errc::success, remove the llvm one.
llvm-svn: 209960
2014-05-31 03:21:04 +00:00
Justin Bogner a119f32344 ProfileData: Allow multiple profiles in RawInstrProfReader
Allow multiple raw profiles to coexist in a single .profraw file,
given the following conditions:

- Zero padding at the end of or between profiles will be skipped.
- Each profile must start with a valid header.
- Mixing endianness or pointer sizes in concatenated profiles files is
  not allowed.

This is needed to handle cases where a program's shared libraries are
profiled as well as the main executable itself, as we'll need to emit
each executable's counters. Combining the tables in the runtime would
be expensive for the instrumented program.

rdar://16918688

llvm-svn: 208938
2014-05-16 00:38:00 +00:00
Aaron Ballman a7c9ed57d9 Fixing a cast-qual warning. getBufferStart() and getBufferEnd() both return a const char *, so casting to non-const was triggering a warning (even though the assignment and usage was always const anyway).
No functional changes intended.

llvm-svn: 207774
2014-05-01 17:16:24 +00:00
Benjamin Kramer d59664f4f7 raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary.
llvm-svn: 207593
2014-04-29 23:26:49 +00:00
Craig Topper 9d74a5a5f1 [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves.
llvm-svn: 207511
2014-04-29 07:58:41 +00:00
Justin Bogner b59d7c73b0 ProfileData: Treat missing function counts as malformed
llvm-svn: 207172
2014-04-25 02:45:33 +00:00
Justin Bogner fa5b013d48 ProfileData: Avoid unnecessary copies of CounterData
We're currently copying CounterData from InstrProfWriter into the
OnDiskHashTable, even though we don't need to, and then carelessly
leaking those copies. A const pointer is much better here.

llvm-svn: 207009
2014-04-23 18:50:16 +00:00
Justin Bogner a2bfd66e0e ProfileData: Remove an extra semicolon
Spotted by Nick Lewycky in review, thanks!

llvm-svn: 206708
2014-04-19 23:42:50 +00:00
Justin Bogner e808171628 OnDiskHashTable: Audit types and use offset_type consistently
llvm-svn: 206675
2014-04-19 00:33:15 +00:00
Justin Bogner b5d368e838 ProfileData: Don't forward declare ComputeHash and make it static inline
llvm-svn: 206663
2014-04-18 22:00:22 +00:00
Justin Bogner b7aa26303b ProfileData: Add support for the indexed instrprof format
This adds support for an indexed instrumentation based profiling
format, which is just a small header and an on disk hash table.  This
format will be used by clang's -fprofile-instr-use= for PGO.

llvm-svn: 206656
2014-04-18 21:48:40 +00:00
Duncan P. N. Exon Smith d7d83477fa InstrProf: Silence spurious warnings in GCC 4.8
No functionality change.

llvm-svn: 204580
2014-03-24 00:47:18 +00:00
Duncan P. N. Exon Smith 4680361d7c InstrProf: Check pointer size in raw profile
Since the profile can come from 32-bit machines, we need to check the
pointer size.  Change the magic number to facilitate this.

Adds tests for reading 32-bit and 64-bit binaries (both big- and
little-endian).  The tests write a binary using printf in RUN lines
(like raw-magic-but-no-header.test).  Assuming the bots don't complain,
this seems like a better way forward for testing RawInstrProfReader than
committing binary files.

<rdar://problem/16400648>

llvm-svn: 204557
2014-03-23 03:38:12 +00:00
NAKAMURA Takumi d3415c2440 [CMake] LLVMProfileData: No need to add LINK_LIBS here. LLVMBuild should do.
llvm-svn: 204553
2014-03-23 01:23:36 +00:00
Duncan P. N. Exon Smith ae29f7a5ec InstrProf: Move constructor to the header
Fixes 80-column violation at the same time.

<rdar://problem/15950346>

llvm-svn: 204516
2014-03-21 20:59:19 +00:00
Duncan P. N. Exon Smith 745a2bf0b8 InstrProf: Change magic number to have non-text characters
Include non-text characters in the magic number so that text files can't
match.

<rdar://problem/15950346>

llvm-svn: 204513
2014-03-21 20:42:37 +00:00
Duncan P. N. Exon Smith 4c5b7cb1fc InstrProf: Use move semantics with unique_ptr
<rdar://problem/15950346>

llvm-svn: 204512
2014-03-21 20:42:34 +00:00
Duncan P. N. Exon Smith 09a67f45ee InstrProf: Detect magic numbers in a more scalable way
No functionality change.

<rdar://problem/15950346>

llvm-svn: 204511
2014-03-21 20:42:31 +00:00
Duncan P. N. Exon Smith 531bb481e2 InstrProf: Actually detect bad headers
<rdar://problem/15950346>

llvm-svn: 204510
2014-03-21 20:42:28 +00:00
Duncan P. N. Exon Smith 24b4b65339 InstrProf: Read raw binary profile in llvm-profdata
Read a raw binary profile that corresponds to a memory dump from the
runtime profile.

The test is a binary file generated from
cfe/trunk/test/Profile/c-general.c with the new compiler-rt runtime and
the matching text version of the input.  It includes instructions on how
to regenerate.

<rdar://problem/15950346>

llvm-svn: 204496
2014-03-21 18:26:05 +00:00
Justin Bogner 47b8768fc0 ProfileData: Avoid brace initialization, windows doesn't like it
llvm-svn: 204494
2014-03-21 18:22:16 +00:00
Justin Bogner b9bd7f85a7 ProfileData: Introduce InstrProfWriter using the naive text format
This isn't a format we'll want to write out in practice, but moving it
to the writer library simplifies llvm-profdata and isolates it from
further changes to the format.

This also allows us to update the tests to not rely on the text output
format.

llvm-svn: 204489
2014-03-21 17:46:22 +00:00
Justin Bogner f8d791983c ProfileData: Introduce the InstrProfReader interface and a text reader
This introduces the ProfileData library and updates llvm-profdata to
use this library for reading profiles. InstrProfReader is an abstract
base class that will be subclassed for both the raw instrprof data
from compiler-rt and the efficient instrprof format that will be used
for PGO.

llvm-svn: 204482
2014-03-21 17:24:48 +00:00