Commit Graph

304 Commits

Author SHA1 Message Date
NAKAMURA Takumi
5c025c67e6 libprofile: [CMake] Let libprofile_rt be not loadable_module but shared library. Autoconf's one does so.
llvm-svn: 162812
2012-08-29 00:37:51 +00:00
Manman Ren
15cce6cb87 Profile: move a single enum out of ProfileInfoTypes.h into a new
ProfileDataTypes.h header.

With this patch the old and new profiling code can exist side-by-side. The new
profiling code will be submitted soon and it only supports insert-edge-profiling
for now and will not depend on ProfileInfo.

Patch by Alastair Murray.

llvm-svn: 162576
2012-08-24 18:31:44 +00:00
Bill Wendling
33d8ca2ddc Free the allocated filename. Found by clang static analyzer.
llvm-svn: 158513
2012-06-15 09:11:47 +00:00
Bill Wendling
a909ffb08b Small code cleanup. No functionality change.
llvm-svn: 157502
2012-05-25 21:57:59 +00:00
Bill Wendling
3651e385d6 Open in read/write mode, creating the file if it doesn't exist.
llvm-svn: 157501
2012-05-25 21:55:06 +00:00
Bill Wendling
df1d6dcf47 Early-continue.Reducing indentation.
llvm-svn: 157451
2012-05-25 00:57:21 +00:00
Bill Wendling
9bf37abe42 Don't call exit from a runtime.
llvm-svn: 157450
2012-05-25 00:55:38 +00:00
David Blaikie
00a231aa73 Switch to c-style comments in a C file.
llvm-svn: 155726
2012-04-27 19:30:29 +00:00
Ted Kremenek
ec38ddb19c Defensively guard against calling malloc() with a size of zero.
llvm-svn: 155661
2012-04-26 20:54:27 +00:00
Bill Wendling
8d0a85a379 Use the correct filename for the error message.
llvm-svn: 153564
2012-03-28 02:39:06 +00:00
Bill Wendling
ec11c59c98 Use Nakamura's suggestion of bypassing using 'filename' and just the pointers directly.
llvm-svn: 153558
2012-03-28 01:30:51 +00:00
Francois Pichet
d04f23f329 MSVC doesn't like the mixing of declarations and statements in a .c file.
llvm-svn: 153549
2012-03-27 23:52:22 +00:00
Bill Wendling
5c8d6c7990 Try to use the CWD if the path to the GCDA output is not available (e.g., the
executable has been moved to another machine). If that's not available
(read-only or something), then exit gracefully.
<rdar://problem/11111686>

llvm-svn: 153538
2012-03-27 21:17:04 +00:00
Aaron Ballman
5ea088c8c2 Fixing a warning in MSVC (this is also a test commit)
llvm-svn: 149844
2012-02-05 19:43:39 +00:00
Daniel Dunbar
30d6a45140 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
NAKAMURA Takumi
a40fc9b826 PathProfiling.c: Get rid of using "inline". We may expect compiler shall optimize out "static" scope w/o "inline".
llvm-svn: 144080
2011-11-08 12:03:14 +00:00
NAKAMURA Takumi
e30a3a9d85 runtime/libprofile/PathProfiling.c: Use __inline__ to appease clang -std=gnu89 -pedantic.
FIXME: Should configure detect one?
llvm-svn: 144070
2011-11-08 03:54:40 +00:00
Daniel Dunbar
3760ebeebb build: Add initial cut at LLVMBuild.txt files.
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
Benjamin Kramer
22607ddb94 Include direct.h for _mkdir on mingw32 too.
llvm-svn: 141495
2011-10-08 15:49:19 +00:00
Galina Kistanova
95b887e917 Fix for warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result.
llvm-svn: 140314
2011-09-22 17:33:24 +00:00
Bill Wendling
8f7bb614ea Use version 402 for the GCDA files when compiling for Apple.
llvm-svn: 136369
2011-07-28 18:12:20 +00:00
Bill Wendling
f3325864ce Build and install the archive when building the Apple way.
llvm-svn: 135538
2011-07-19 23:33:42 +00:00
Eli Friedman
2c7773157c Fix build for (some versions of?) MinGW. Patch by Ruben Van Boxem.
llvm-svn: 133741
2011-06-23 18:24:27 +00:00
Bill Wendling
108a793705 Remove the LTO stuff from the profile_rt library's Makefile.
llvm-svn: 133042
2011-06-15 04:56:13 +00:00
Bill Wendling
a3941782e9 Add compatibility version when compiling the Apple way.
<rdar://problem/9600408>

llvm-svn: 132929
2011-06-13 20:14:37 +00:00
Francois Pichet
3d8581cca9 Fix MSVC warning regarding mkdir function usage.
llvm-svn: 132109
2011-05-26 04:55:20 +00:00
Francois Pichet
b8f50b86bc Fix 3 MSVC warnings:
'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'

atexit really expects a "void f(void)" function.

llvm-svn: 132061
2011-05-25 16:32:33 +00:00
Nick Lewycky
eef7bead41 The computation of string length is not that complicated. Fix it, again. :)
llvm-svn: 130967
2011-05-05 23:52:18 +00:00
Nick Lewycky
c537bf5a97 Update the gcov version used slightly, to make it stop causing modern gcov's to
crash.

llvm-svn: 130911
2011-05-05 02:46:38 +00:00
Nick Lewycky
e3e47cc4d8 Create the parent directories to place the .gcda files in if they don't exist.
That's kinda weird because the .gcno files are supposed to already be there,
but libgcov does this and somehow Google has managed to depend on it.

llvm-svn: 130879
2011-05-04 22:34:29 +00:00
Nick Lewycky
75424d52d7 Fix crash when not setting GCOV_PREFIX.
llvm-svn: 130834
2011-05-04 03:58:45 +00:00
NAKAMURA Takumi
f485b6e3a8 runtime/libprofile/PathProfiling.c: Don't use // comment in C source.
llvm-svn: 130589
2011-04-30 03:53:56 +00:00
Daniel Dunbar
64d3760882 win32: Include DataTypes.h instead of stdint.h to try and fix a Win32 build
issue.

llvm-svn: 130530
2011-04-29 18:58:57 +00:00
Daniel Dunbar
33083542c4 Cleanup some DOS newlines.
llvm-svn: 130529
2011-04-29 18:58:55 +00:00
Francois Pichet
4c0e0098a5 Unbreak the MSVC build:
- unistd.h doesn't exist with MSVC
  - inline must be __inline in Microsoft C
  - atexit cannot take a function declared as void f(), must be void f(void).

llvm-svn: 130490
2011-04-29 08:56:07 +00:00
Nick Lewycky
ea1dbad689 Rename profile_rt.so to libprofile_rt.so under configure+make (it already was
under cmake).

Add libprofile_rt.a so that we can tell clang to link against it in --coverage
mode. Also turn it on by default in cmake builds.

Oscar, this touches a change you made for EXCLUDE_FROM_ALL support -- I think
I've done the right thing, but please let me know (or fix and commit) if not!

llvm-svn: 130470
2011-04-29 02:12:06 +00:00
Nick Lewycky
40c59f95d7 Only read *predecessor once so as to fix a theoretical issue where it changes
between two reads (threading).

Fix an off-by-one in the indirect counter table that I meant to revert after an
earlier experiment. Whoops!

Implement GCOV_PREFIX. Doesn't handle GCOV_PREFIX_STRIP yet.

Fix an off-by-one in string emission. Extra whoops!

Tolerate DISubprograms that have null Function*'s attached to them. I don't yet
understand what this means, but it happens when you have a global static with
a non-trivial constructor/destructor.

Fix a crash on switch statements with a single successor (default-only).

llvm-svn: 130443
2011-04-28 21:35:49 +00:00
Nick Lewycky
0a9ef78096 Use static inline to do the right thing when built in C99 mode. Of course,
C89 doesn't have an inline keyword.

llvm-svn: 130279
2011-04-27 03:22:17 +00:00
Oscar Fuentes
246a11f21c Honor LLVM_BUILD_RUNTIME.
llvm-svn: 130199
2011-04-26 14:55:27 +00:00
Nick Lewycky
6a72236e5f Add cmakefiles to build profile_rt.so!
llvm-svn: 130191
2011-04-26 05:48:41 +00:00
Nick Lewycky
d4d9c257e0 Rename everything to follow LLVM style ... I think.
Add support for switch and indirectbr edges. This works by densely numbering
all blocks which have such terminators, and then separately numbering the
possible successors. The predecessors write down a number, the successor knows
its own number (as a ConstantInt) and sends that and the pointer to the number
the predecessor wrote down to the runtime, who looks up the counter in a
per-function table.

Coverage data should now be functional, but I haven't tested it on anything
other than my 2-file synthetic test program for coverage.

llvm-svn: 130186
2011-04-26 03:54:16 +00:00
Benjamin Kramer
c7d15fb261 Write out uint64_t as i{0..32},i{33..64} instead of i{0..32},0.
llvm-svn: 129638
2011-04-16 10:25:32 +00:00
Nick Lewycky
e704042077 Don't use C++ comments in C code.
llvm-svn: 129637
2011-04-16 04:25:36 +00:00
Nick Lewycky
9aeaafc27a Rename LineProfiling to GCOVProfiling to more accurately represent what it
does. Also mostly implement it. Still a work-in-progress, but generates legal
output on crafted test cases.

llvm-svn: 129630
2011-04-16 01:20:23 +00:00
Chris Lattner
0304b82f80 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Benjamin Kramer
41b2c100c4 Fix format string warning.
llvm-svn: 129467
2011-04-13 20:41:43 +00:00
Nick Lewycky
0ec72ba684 Use %ull here.
llvm-svn: 129423
2011-04-13 01:05:45 +00:00
Nick Lewycky
b461b6de06 Print our uint64_t with the more portable (C99 and C++0x) %PRIu64 format
specifier.

llvm-svn: 129384
2011-04-12 20:06:50 +00:00
Nick Lewycky
ec33cecdf0 The counters are unsigned.
llvm-svn: 129380
2011-04-12 19:35:45 +00:00
Nick Lewycky
cbe911f7d8 Add support for line profiling. Very work-in-progress.
Use debug info in the IR to find the directory/file:line:col. Each time that location changes, bump a counter.

Unlike the existing profiling system, we don't try to look at argv[], and thusly don't require main() to be present in the IR. This matches GCC's technique where you specify the profiling flag when producing each .o file.

The runtime library is minimal, currently just calling printf at program shutdown time. The API is designed to make it possible to emit GCOV data later on.

llvm-svn: 129340
2011-04-12 01:06:09 +00:00