summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfiling.h
AgeCommit message (Collapse)Author
2017-08-31Revert r312240Alex Lorenz
The buildbots have shown that -Wstrict-prototypes behaves differently in GCC and Clang so we should keep it disabled until Clang follows GCC's behaviour git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31Build LLVM with -Wstrict-prototypes enabledAlex Lorenz
Clang 5 supports -Wstrict-prototypes. We should use it to catch any C declarations that declare a non-prototype function. rdar://33705313 Differential Revision: https://reviews.llvm.org/D36669 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09[Profile] Implement new API __llvm_profile_dumpXinliang David Li
The API is intended to be used by user to do fine grained (per-region) control of profile dumping. Differential Revision: http://reviews.llvm.org/D23106 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22[Profile] cleanup: do not reference name directly of vars shared between rt ↵Xinliang David Li
and llvm git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276385 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21[Profile] deprecate __llvm_profile_override_default_filename (part2)Xinliang David Li
This eliminates unncessary calls and init functions. Differential Revision: http://reviews.llvm.org/D22614 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276355 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20[Profile] implement interface to get profile path prefixXinliang David Li
Differential Revision: http://reviews.llvm.org/D22546 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276083 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[profile] Hide some external symbols in InstrProfData.incVedant Kumar
Differential Revision: http://reviews.llvm.org/D21116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272167 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24[profile] clean up profile file handling codeXinliang David Li
Differentianl Revision: http://reviews.llvm.org/D20572 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270617 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-21[profile] Static counter allocation for value profiling (part-2)Xinliang David Li
Differential Revision: http://reviews.llvm.org/D20460 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20Small typo and whitespace fix.Sean Silva
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19Fix typo.Sean Silva
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270005 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18[profile] add runtime variable documentationXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16[profile] minor code restructuring /NFCXinliang David Li
This is one of the enabler patch to allow value profiler to allocate counter statically. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269689 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10Reapply r268840: [profile] Simplify value profile writingXinliang David Li
Revert r268864 that reverted 268840 after underlying problem is fixed for arm bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07Revert "[profile] Simplify value profile writing"Renato Golin
This reverts commit r268840, as it breaks Thumb2 self-hosting. There is something unstable in the profiling for Thumb2 that needs to be sorted out before we continue implementing these changes to the profiler. See PR27667. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07[profile] Simplify value profile writingXinliang David Li
With this patch, value data are longer pre-collected before writing. The code is simplified and requires less heap space for dumping. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268840 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04[PGO] Add API to check compatibility of profile data in bufferXinliang David Li
This is needed by client which uses in-process merge API. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262736 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03[PGO] Add API for profile merge from bufferXinliang David Li
Differential Revision: http://reviews.llvm.org/D17831 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262644 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26[profile] Compute number of data entries correctlyVedant Kumar
Compiler-rt miscalculates the number of entries in the __llvm_prf_data section on i386 Darwin. This results in a number of test failures (which we started catching after r261344). The fix we attempted earlier is insufficient (r261683). It caused some tests to start passing again, but that hid the fact that we drop some data entries. This patch should fix the real problem. It fixes the way we compute DataSize by taking into account the way the Darwin linker lays out __llvm_prf_data. Differential Revision: http://reviews.llvm.org/D17623 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-29[PGO]: Do not update Data->Value field during profile write.Xinliang David Li
The profile reader no longer depends on this field to be updated and point to owning func's vp data. The VP data also no longer needs to be allocated in a contiguous memory space. Differential Revision: http://reviews.llvm.org/D15258 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256543 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16[PGO] cleanup: unify prefix for portability macrosXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255748 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10[PGO] Header file cleanup (NFC)Xinliang David Li
InstrProfiling.h file declares profile runtime public APIs. It has become a dumping place for many different things, which needs cleanups. In this change, core type declarations and portability macros are moved to a new file InstrProfilingPort.h. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07[PGO] Stop leaking libc function to buffer API implXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04Move macro defs closer (NFC)Xinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03[PGO] Introduce error report macro in profile-rtXinliang David Li
Also added a test case for runtime error reporting. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254625 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] sync up target instrument decl between runtime and llvm (NFC)Xinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253911 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Unify raw profile header definitionXinliang David Li
Replace duplicate definition raw header with common definition in InstrProfData.inc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253896 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Use the alignment macro newly introduced (NFC)Xinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253895 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Unify per-function control data definitionXinliang David Li
Replace duplicate definition per-func profile control data with common definition in InstrProfData.inc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253891 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Use common definition of value profile kindXinliang David Li
Replace duplicate definition value profile kind definitions with common definition in InstrProfData.inc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253890 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Start use InstrProf template file in compiler-rt/lib/profileXinliang David Li
- Replace use of __llvm_profile_value_data with common data structure. - Remve duplicate InstrProfValueNode git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253883 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[PGO] Compiler-rt cleanup -- introduces macros for various macrosXinliang David Li
This makes code more readable and be made more portable in the future. There is no functional change. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20[PGO] Fix buildbot failure on FreeBSD (when building __x86_64__ lib)Xinliang David Li
There seems to be a problem in system header (stdint.h) of FreeBSD where uint8_t nor uint16_t are defined. Explicitly define the key types as done for FreeBSD i386. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20[PGO] Profile runtime name cleanupsXinliang David Li
Value profile enumerator change to match LLVM code ProfData new member field name change to match LLVM code ProfData member type change to match LLVM code Do not use lower case for types that are internal to implementation (not exposed to APIs) There is no functional change. This is a preparation patch to enable more code sharing in follow up patches Differential Revision: http://reviews.llvm.org/D14841 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20Speculativley try to fix FreeBSD buildbots, which apparently cannot use stdint.hReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253681 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18[PGO] Minor cleanups (formating, comments etc) (NFC)Xinliang David Li
1. Added missing public API decl in InstrProfiling.h 2. Clang formatting fix 3. Added more comments for new VP code 4. refactor the VP allocation code to make it more readable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253508 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18[PGO] Fix the build failures due to 253483 and 253489.Betul Buyukkurt
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18[PGO] Removed an extra ')' in the LLVM_ALIGNAS(x) macro.Betul Buyukkurt
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18[PGO] Runtime support for value profiling.Betul Buyukkurt
This change adds extends the data structures and adds in the routines for handling runtime calls for value profiling. The profile data format is modified and the version number is incremented. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-08[PGO] Cleanup: fix function-data field namesXinliang David Li
To make them the same as the common def in InstrProfData.inc. This is a preparation to make the runtime code to use the template as well. NFC git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252421 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16Use struct type instead of raw array for raw profile header (NFC)Xinliang David Li
This patch introduces a well defined header struct to represent raw profile header instead of using raw array. Previously the raw array is used in two different files and is very error prone when header structure is re-organized. This is a small cleanup with NFC. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09Add support for generating profiles in a given directory.Diego Novillo
When the file is initialized, this patch checks whether the path specifies a directory. If so, it creates the directory tree before truncating the file. Use default.profdata instead of pgo-data for default indexed profile name. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@241824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28This change is the first of 3 patches to add support for specifyingEric Christopher
the profile output from the command line via -fprofile-instr-generate=<path>, where the specified output path/file will be overridden by the LLVM_PROFILE_FILE environment variable. Several changes are made to the runtime to support this: Add a new interface __llvm_profile_override_default_filename that will set the profile output filename, but allows LLVM_PROFILE_FILE to override. This is the interface used by the new option. Refactor the pid-expansion done for LLVM_PROFILE_FILE into a separate routine that can be shared by the various filename setting routines (so that the filename from the option can also use the "%p" syntax). Move the truncation into setFilename, and only truncate if there is a new filename specified (to maintain support for appending to the same profile file in the case of multiple shared objects built with profiling). Move the handling for a NULL filename passed to __llvm_profile_set_filename and __llvm_profile_override_default_filename into the new setFilenamePossiblyWithPid routine. This now correctly resets the output file to default.profraw instead of NULL. The handling for a null LLVM_PROFILE_FILE (which should not reset) is done by caller setFilenameFromEnvironment. Patch by Teresa Johnson. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236055 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09profile: Add low level versions of profile buffer functionsJustin Bogner
On Darwin, compiler_rt uses magic linker symbols to find the profile counters in the __DATA segment. This is a reasonable method for normal, hosted, userspace programs. However programs with custom memory layouts, such as the kernel, will need to tell compiler_rt explicitly where to find these sections. Patch by Lawrence D'Anna. Thanks! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223840 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04profile: Avoid name collisions between instrumentation and runtimeJustin Bogner
The naming scheme we're using for counters in profile data shares a prefix with some fixed names we use for the runtime, notably __llvm_profile_data_begin and _end. Embarrassingly, this means a function called begin() can't be instrumented. This modifies the runtime names so as not to collide with the instrumentation. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217166 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-17InstrProf: Support profiling dlopen'd shared librariesDuncan P. N. Exon Smith
Shared objects are hard. After this commit, we do the right thing when profiling two separate shared objects that have been dlopen'd with `RTLD_LOCAL`, when the main executable is *not* being profiled. This mainly simplifies the writer logic. - At initialization, determine the output filename and truncate the file. Depending on whether shared objects can see each other, this may happen multiple times. - At exit, each executable writes its own profile in append mode. <rdar://problem/16918688> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209053 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-16InstrProf: Fix shared object profilingDuncan P. N. Exon Smith
Change the API of the instrumented profiling library to work with shared objects. - Most things are now declared hidden, so that each executable gets its own copy. - Initialization hooks up a linked list of writers. - The raw format with shared objects that are profiled consists of a concatenated series of profiles. llvm-profdata knows how to deal with that since r208938. <rdar://problem/16918688> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208940 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26Define uintptr_t in the profiling sources on x86_64 FreeBSD in 32-bit modeViktor Kutuzov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204799 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21InstrProf: Remove MSVC-specific logicDuncan P. N. Exon Smith
Apparently, MSVC has stdint.h now? Let's see if the buildbots complain. I'm not convinced that the build system is even set up for MSVC to build this file, but... git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204515 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21InstrProf: __ => _ in header guardsDuncan P. N. Exon Smith
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204502 91177308-0d34-0410-b5e6-96231b3b80d8