Commit Graph

95 Commits

Author SHA1 Message Date
NAKAMURA Takumi
875618f245 libprofile/CommonProfiling.c: Fix according to C89.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167272 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 01:32:02 +00:00
Manman Ren
9b25ff66dd PGO: allows the profile data file name to be specified by the LLVMPROF_OUTPUT
environment variable.

This allows parallel make for profiling code, without it there are file
collisions as each parallel run uses the default file name.

There is already code in the runtime library to specify the output file name
via the command line, but this only works for programs which already process
argc/argv.  This patch builds on that support.

Patch by Alastair Murray.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 01:10:15 +00:00
Bill Wendling
c33b9304da Place temporary LTO files into their own subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10 05:29:15 +00:00
Bob Wilson
52bcafe4bf Revert "Use a special path to place the .o files in."
This reverts commit 165428 in an attempt to get our buildbots going.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165574 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-09 23:59:01 +00:00
Bill Wendling
e57cb73153 Use a special path to place the .o files in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-08 21:17:45 +00:00
Bill Wendling
10181ae49c Add an explicit -object_path_lto flag during linking with a uniquified temporary
file name if building Apple-style.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165185 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 23:52:10 +00:00
NAKAMURA Takumi
20f09ac39a libprofile: [CMake] Let libprofile_rt be not loadable_module but shared library. Autoconf's one does so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162812 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29 00:37:51 +00:00
Manman Ren
cd62c28723 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162576 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 18:31:44 +00:00
Bill Wendling
6207cb519b Free the allocated filename. Found by clang static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158513 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15 09:11:47 +00:00
Bill Wendling
53caba6cc2 Small code cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157502 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 21:57:59 +00:00
Bill Wendling
e00c8fdcc1 Open in read/write mode, creating the file if it doesn't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 21:55:06 +00:00
Bill Wendling
43a699a112 Early-continue.Reducing indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157451 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 00:57:21 +00:00
Bill Wendling
717f7fa12a Don't call exit from a runtime.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157450 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 00:55:38 +00:00
David Blaikie
ca63acdc5d Switch to c-style comments in a C file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155726 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-27 19:30:29 +00:00
Ted Kremenek
06e950ecb2 Defensively guard against calling malloc() with a size of zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155661 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-26 20:54:27 +00:00
Bill Wendling
d4ec0547a2 Use the correct filename for the error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 02:39:06 +00:00
Bill Wendling
7242a4fb86 Use Nakamura's suggestion of bypassing using 'filename' and just the pointers directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153558 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 01:30:51 +00:00
Francois Pichet
da942482a3 MSVC doesn't like the mixing of declarations and statements in a .c file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 23:52:22 +00:00
Bill Wendling
66e30f8db1 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>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153538 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 21:17:04 +00:00
Aaron Ballman
17da6e7ad8 Fixing a warning in MSVC (this is also a test commit)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149844 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 19:43:39 +00:00
NAKAMURA Takumi
d63e7bf556 PathProfiling.c: Get rid of using "inline". We may expect compiler shall optimize out "static" scope w/o "inline".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144080 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 12:03:14 +00:00
NAKAMURA Takumi
d66d5718a4 runtime/libprofile/PathProfiling.c: Use __inline__ to appease clang -std=gnu89 -pedantic.
FIXME: Should configure detect one?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144070 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 03:54:40 +00:00
Benjamin Kramer
70b582ab9c Include direct.h for _mkdir on mingw32 too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141495 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 15:49:19 +00:00
Galina Kistanova
6bbba3cab4 Fix for warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-22 17:33:24 +00:00
Bill Wendling
ad759c5a07 Use version 402 for the GCDA files when compiling for Apple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 18:12:20 +00:00
Bill Wendling
c8dad112b4 Build and install the archive when building the Apple way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 23:33:42 +00:00
Eli Friedman
aeebc35886 Fix build for (some versions of?) MinGW. Patch by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133741 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 18:24:27 +00:00
Bill Wendling
31bfd9bc45 Remove the LTO stuff from the profile_rt library's Makefile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 04:56:13 +00:00
Bill Wendling
1922a11907 Add compatibility version when compiling the Apple way.
<rdar://problem/9600408>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-13 20:14:37 +00:00
Francois Pichet
97938081f3 Fix MSVC warning regarding mkdir function usage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-26 04:55:20 +00:00
Francois Pichet
0b5bb3b2b4 Fix 3 MSVC warnings:
'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132061 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25 16:32:33 +00:00
Nick Lewycky
d363ff334d The computation of string length is not that complicated. Fix it, again. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130967 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 23:52:18 +00:00
Nick Lewycky
5409a18832 Update the gcov version used slightly, to make it stop causing modern gcov's to
crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130911 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 02:46:38 +00:00
Nick Lewycky
5e436b3b0e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130879 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 22:34:29 +00:00
Nick Lewycky
d006ddc195 Fix crash when not setting GCOV_PREFIX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130834 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 03:58:45 +00:00
NAKAMURA Takumi
4f5558e676 runtime/libprofile/PathProfiling.c: Don't use // comment in C source.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130589 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-30 03:53:56 +00:00
Daniel Dunbar
8ddf6f2952 win32: Include DataTypes.h instead of stdint.h to try and fix a Win32 build
issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130530 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:58:57 +00:00
Daniel Dunbar
c69c4a839f Cleanup some DOS newlines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:58:55 +00:00
Francois Pichet
b89e699b74 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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130490 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 08:56:07 +00:00
Nick Lewycky
bcffb1fbb8 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130470 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 02:12:06 +00:00
Nick Lewycky
7a2ba2fbe4 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130443 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 21:35:49 +00:00
Nick Lewycky
3f5c832909 Use static inline to do the right thing when built in C99 mode. Of course,
C89 doesn't have an inline keyword.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130279 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 03:22:17 +00:00
Nick Lewycky
e88c724ff0 Add cmakefiles to build profile_rt.so!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130191 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-26 05:48:41 +00:00
Nick Lewycky
1790c9cbb6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130186 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-26 03:54:16 +00:00
Benjamin Kramer
571c0e95fa Write out uint64_t as i{0..32},i{33..64} instead of i{0..32},0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129638 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 10:25:32 +00:00
Nick Lewycky
ece78a30bd Don't use C++ comments in C code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129637 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 04:25:36 +00:00
Nick Lewycky
b192870420 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129630 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 01:20:23 +00:00
Chris Lattner
7a2bdde0a0 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
Benjamin Kramer
8b505739f4 Fix format string warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129467 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 20:41:43 +00:00
Nick Lewycky
8a7f4ecbc1 Use %ull here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129423 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 01:05:45 +00:00