llvm-project/compiler-rt/lib
Bill Wendling 353fbd3516 Performance improvement.
Using fwrite and fread was very *very* slow. The resulting code was multiple
times slower than GCC's implementation of gcov. Replace the fwrite/fread system
with an mmap() version.

If the `.gcda' file doesn't exist, we (re)allocate a buffer that we write
into. That gets written to the `.gcda' file in one chunk. If the `.gcda' file
already exists, we simply mmap() the file, modify the mapped data, and use
msync() to write the contents out to disk. It's much easier than implementing
our own buffering scheme, and we don't have to use fwrite's and fread's
buffering.

For those who are numbers-oriented, here are some timings:

GCC Verison
-----------

`.gcda' files don't exist:  23s
`.gcda' files do exist:     14s

LLVM Version (before this change)
---------------------------------

`.gcda' files don't exist:  28s
`.gcda' files do exist:     28s

LLVM Version (with this change)
-------------------------------

`.gcda' files don't exist:  18s
`.gcda' files do exist:      4s

It's a win-win-win-win-lose-win-win scenario!

<rdar://problem/13466086>

llvm-svn: 182563
2013-05-23 07:18:59 +00:00
..
arm Implement aeabi_{f,d}cmp*. 2013-02-07 08:29:47 +00:00
asan [asan] fix the reported PCs for powerpc64 2013-05-22 14:21:34 +00:00
i386 Remove the old, and non-functional CMake build system from CompilerRT. 2012-04-04 22:12:01 +00:00
interception [libsanitizer] Introduce INTERCEPTOR_WITH_SUFFIX which is to be used for appending the __DARWIN_ALIAS() version suffixes to function names on Darwin. 2013-05-20 13:32:35 +00:00
lsan Revert r182465 and add lsan-common library to makefile-based build 2013-05-22 13:20:37 +00:00
msan [msan] Intercept getsockname. 2013-05-22 13:46:22 +00:00
msandr [msan] Get rid of "using std::string" in msandr. 2013-03-22 08:47:42 +00:00
ppc Remove the old, and non-functional CMake build system from CompilerRT. 2012-04-04 22:12:01 +00:00
profile Performance improvement. 2013-05-23 07:18:59 +00:00
sanitizer_common [sanitizer] Fix Mac build one more time. 2013-05-22 15:21:04 +00:00
tsan [msan] Intercept getsockname. 2013-05-22 13:46:22 +00:00
ubsan Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_tests depend on fresh headers. 2013-04-11 15:49:52 +00:00
x86_64 Remove the old, and non-functional CMake build system from CompilerRT. 2012-04-04 22:12:01 +00:00
CMakeLists.txt Effectively revert r182453 - atomic.c may not be compiled if host compiler doesn't understand _Atomic 2013-05-22 14:22:04 +00:00
Makefile.mk Revert r182465 and add lsan-common library to makefile-based build 2013-05-22 13:20:37 +00:00
absvdi2.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
absvsi2.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
absvti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
adddf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
addsf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
addvdi3.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
addvsi3.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
addvti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
apple_versioning.c <rdar://problem/13806954> enable __atomic_* functions for Darwin 2013-05-21 23:02:04 +00:00
ashldi3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
ashlti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
ashrdi3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
ashrti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
assembly.h <rdar://problem/11668446> Add .subsections_via_symbols to Darwin assembly files 2012-07-11 19:21:39 +00:00
atomic.c <rdar://problem/13806954> enable __atomic_* functions for Darwin 2013-05-21 23:02:04 +00:00
clear_cache.c Fix missing include of int_lib.h and ppc ifdef for FreeBSD. 2012-01-03 18:59:25 +00:00
clzdi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
clzsi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
clzti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
cmpdi2.c Implement __aeabi_lcmp and ulcmp 2013-01-13 19:18:02 +00:00
cmpti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
comparedf2.c Implement aeabi_{f,d}cmp*. 2013-02-07 08:29:47 +00:00
comparesf2.c Implement aeabi_{f,d}cmp*. 2013-02-07 08:29:47 +00:00
ctzdi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
ctzsi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
ctzti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
divdc3.c lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
divdf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
divdi3.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
divmoddi4.c Proper divmod implementation 2012-01-30 10:21:51 +00:00
divmodsi4.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
divsc3.c lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
divsf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
divsi3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
divti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
divxc3.c lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
enable_execute_stack.c lib: Include stdbool.h in int_lib.h, and eliminate duplicate includes from a number of source files. 2011-11-15 19:02:22 +00:00
eprintf.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
extendsfdf2.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
ffsdi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
ffsti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fixdfdi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixdfsi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixdfti.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fixsfdi.c Correct name of __aeabi_f2lz. 2013-01-13 19:18:00 +00:00
fixsfsi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixsfti.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fixunsdfdi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixunsdfsi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixunsdfti.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fixunssfdi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixunssfsi.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
fixunssfti.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fixunsxfdi.c license change 2010-11-16 22:13:33 +00:00
fixunsxfsi.c license change 2010-11-16 22:13:33 +00:00
fixunsxfti.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fixxfdi.c license change 2010-11-16 22:13:33 +00:00
fixxfti.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
floatdidf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatdisf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatdixf.c license change 2010-11-16 22:13:33 +00:00
floatsidf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatsisf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floattidf.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
floattisf.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
floattixf.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
floatundidf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatundisf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatundixf.c license change 2010-11-16 22:13:33 +00:00
floatunsidf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatunsisf.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
floatuntidf.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
floatuntisf.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
floatuntixf.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
fp_lib.h Declare some variables unsigned to avoid signed vs unsigned mismatches. 2012-06-18 18:51:13 +00:00
gcc_personality_v0.c lib/gcc_personality_v0: Remove an unnecessary include. 2011-11-16 01:19:29 +00:00
int_endianness.h Both OpenBSD and Bitrig need to include machine/endian.h to get the 2012-09-20 06:19:20 +00:00
int_lib.h lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
int_math.h lib/int_math: Some versions of GCC don't provide __builtin_isfinite. Support 2011-11-16 18:56:55 +00:00
int_types.h lib: Rename endianness.h to int_endianness.h (for consistency) and tidy up a bit. 2011-11-15 18:56:21 +00:00
int_util.c On Apple platforms, wire up compilerrt_abort() to log file and function info 2012-02-03 23:53:40 +00:00
int_util.h Remove __attribute__((weak)) on function prototype. It has a different meaning on prototypes then it does on definitions. It is not needed on the prototype and causes build failures for static codegen 2012-02-03 23:10:55 +00:00
lit.common.cfg Add lit config feature <target>-supported-target to mark target-specific tests 2013-05-21 08:22:03 +00:00
lit.common.unit.cfg Use LLVM_BUILD_TYPE instead of CMAKE_BUILD_TYPE in compiler-rt unit tests to match the behavior of llvm unittests 2013-01-30 12:18:49 +00:00
lshrdi3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
lshrti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
moddi3.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
modsi3.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
modti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
muldc3.c lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
muldf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
muldi3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
mulodi4.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
mulosi4.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
muloti4.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
mulsc3.c lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
mulsf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
multi3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
mulvdi3.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
mulvsi3.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
mulvti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
mulxc3.c lib: Finish int_math.h definitions using compiler builtins and eliminate 2011-11-16 07:33:06 +00:00
negdf2.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
negdi2.c license change 2010-11-16 22:13:33 +00:00
negsf2.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
negti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
negvdi2.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
negvsi2.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
negvti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
paritydi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
paritysi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
parityti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
popcountdi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
popcountsi2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
popcountti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
powidf2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
powisf2.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
powitf2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
powixf2.c license change 2010-11-16 22:13:33 +00:00
subdf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
subsf3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
subvdi3.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
subvsi3.c lib: Eliminate direct include of stdlib.h from files that used to (potentially) 2011-11-16 01:19:26 +00:00
subvti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
trampoline_setup.c Fix missing include of int_lib.h and ppc ifdef for FreeBSD. 2012-01-03 18:59:25 +00:00
truncdfsf2.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
ucmpdi2.c Implement __aeabi_lcmp and ulcmp 2013-01-13 19:18:02 +00:00
ucmpti2.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
udivdi3.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
udivmoddi4.c Proper divmod implementation 2012-01-30 10:21:51 +00:00
udivmodsi4.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
udivmodti4.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
udivsi3.c Remove extraneous semicolons outside of functions. This fixes a large 2012-06-22 21:09:15 +00:00
udivti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00
umoddi3.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
umodsi3.c lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity. 2011-11-15 18:34:44 +00:00
umodti3.c Mechanical change to sink a #ifdef guard for a platform below the 2012-06-22 21:09:22 +00:00