summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfiling.c
Commit message (Collapse)AuthorAgeFilesLines
* Reland "[CMake] Support installation of InstrProfData.inc"Petr Hosek2019-11-221-1/+1
| | | | | | | | | | | This header fragment is useful on its own for any consumer that wants to use custom instruction profile runtime with the LLVM instrumentation. The concrete use case is in Fuchsia's kernel where we want to use instruction profile instrumentation, but we cannot use the compiler-rt runtime because it's not designed for use in the kernel environment. This change allows installing this header as part of compiler-rt. Differential Revision: https://reviews.llvm.org/D64532
* Revert "[CMake] Support installation of InstrProfData.inc"Petr Hosek2019-11-221-1/+1
| | | | | This reverts commit f11bc1776fd2815b60e0b1ed97be00b517348162 since it's failing to build on some bots.
* [CMake] Support installation of InstrProfData.incPetr Hosek2019-11-221-1/+1
| | | | | | | | | | | This header fragment is useful on its own for any consumer that wants to use custom instruction profile runtime with the LLVM instrumentation. The concrete use case is in Fuchsia's kernel where we want to use instruction profile instrumentation, but we cannot use the compiler-rt runtime because it's not designed for use in the kernel environment. This change allows installing this header as part of compiler-rt. Differential Revision: https://reviews.llvm.org/D64532
* This change adds an API to allow setting the flag to indicate that the ↵Max Moroz2019-05-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | profile data has been dumped to the file. Summary: The main use is for users to disable dumping profile data to the file for certain processes in case the processes don't have permission to write to the disks, and trying to do so would result in side effects such as crashes. Patch by Yuke Liao (@liaoyuke). Additional context (Chromium use case): - https://bugs.chromium.org/p/chromium/issues/detail?id=842424 - https://bugs.chromium.org/p/chromium/issues/detail?id=957655 - https://chromium-review.googlesource.com/c/chromium/src/+/1610093 Reviewers: Dor1s, vsk, davidxl Reviewed By: Dor1s, davidxl Subscribers: delcypher, davidxl, sajjadm, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D62078 llvm-svn: 361194
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [profile] Port the runtime to Solaris (retry)Vedant Kumar2017-12-141-2/+4
| | | | | | | | | | | | | This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Hopefully the Windows support is fixed now. Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 llvm-svn: 320731
* Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the ↵Vedant Kumar2017-12-141-4/+2
| | | | | | | | | | | runtime to Solaris" This reverts commit r320726. It looks like flock isn't available on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio llvm-svn: 320728
* [profile] Port the runtime to SolarisVedant Kumar2017-12-141-2/+4
| | | | | | | | | | | This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 llvm-svn: 320726
* [profile] Move __llvm_profile_filename into a separate objectVedant Kumar2017-06-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users can specify the path a raw profile is written to by passing -fprofile-instr-generate=<path>, but this functionality broke on Darwin after __llvm_profile_filename was made weak [1], resulting in profiles being written to "default.profraw" even when <path> is specified. The situation is that instrumented programs provide a weak definition of __llvm_profile_filename, which conflicts with a weak redefinition provided by the profiling runtime. The linker appears to pick the 'winning' definition arbitrarily: on Darwin, it usually prefers the larger definition, which is probably why the instrprof-override-filename.c test has been passing. The fix is to move the runtime's definition into a separate object file within the archive. This means that the linker won't "see" the runtime's definition unless the user program has not provided one. I couldn't think of a great way to test this other than to mimic the Darwin failure: use -fprofile-instr-generate=<some-small-path>. Testing: check-{clang,profile}, modified instrprof-override-filename.c. [1] [Profile] deprecate __llvm_profile_override_default_filename https://reviews.llvm.org/D22613 https://reviews.llvm.org/D22614 Differential Revision: https://reviews.llvm.org/D34797 llvm-svn: 306710
* [Profile] Remove unused variableXinliang David Li2016-09-221-1/+0
| | | | llvm-svn: 282198
* [Profile] Implement new API __llvm_profile_dumpXinliang David Li2016-08-091-0/+11
| | | | | | | | | 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 llvm-svn: 278092
* [Profile] cleanup: do not reference name directly of vars shared between rt ↵Xinliang David Li2016-07-221-1/+1
| | | | | | and llvm llvm-svn: 276385
* [Profile] deprecate __llvm_profile_override_default_filename (part2)Xinliang David Li2016-07-211-0/+2
| | | | | | | | This eliminates unncessary calls and init functions. Differential Revision: http://reviews.llvm.org/D22614 llvm-svn: 276355
* [profile] Un-hide two symbolsVedant Kumar2016-06-081-2/+1
| | | | | | | | | | | - lprofCurFilename was intended to have external visibility. This is pending further discussion. - The raw version number doesn't need to be hidden: hiding it may make it easier to accidentally combine FE/IR profiles. See the mailing list discussion on r272081. llvm-svn: 272089
* [profile] Hide a few external symbols (NFCI)Vedant Kumar2016-06-081-1/+2
| | | | | | | | There are still a few external symbols visible from InstrProfData.inc. The plan for dealing with those isn't as straightforward, so I'll try it in a separate commit. llvm-svn: 272081
* [profile] minor code restructuring /NFCXinliang David Li2016-05-161-1/+1
| | | | | | | This is one of the enabler patch to allow value profiler to allocate counter statically. llvm-svn: 269689
* Fix variable visibilityXinliang David Li2016-05-091-1/+1
| | | | llvm-svn: 268952
* [profile] Fix iteration over profile data entriesVedant Kumar2016-02-231-1/+1
| | | | | | | | | | | | | | Fix a crash when gathering value profile data on i386 Darwin. The Darwin linker shrinks sections containing aligned structures when padding is not explicitly added to the end of the structure. When iterating over these structures, be sure to not walk past the end of the section. No tests added, since running `ninja check-profile` on i386 Darwin is enough to reproduce the original crash. llvm-svn: 261683
* [PGO] Add runtime hook so that IR instrumentation can override versionXinliang David Li2016-01-081-2/+3
| | | | | | | | IR level instrumentation needs to override version with variant bits. No change for FE instrumentation is needed. Test case is added to detect version mismatch. llvm-svn: 257230
* [PGO] cleanup: unify prefix for portability macrosXinliang David Li2015-12-161-4/+4
| | | | llvm-svn: 255748
* [PGO] Split value profiling runtime into its own fileXinliang David Li2015-12-101-219/+0
| | | | | | | | | Value profile runtime depends on libc which breaks buffer API implemenation with current file organization. Test case is also updated to check more symbols. llvm-svn: 255294
* [PGO] Move impl specific decl to InstrProfilingInternal.h (NFC)Xinliang David Li2015-12-101-0/+1
| | | | llvm-svn: 255290
* [PGO] Move target-dependent macro to InstrProfilingPort.h (NFC)Xinliang David Li2015-12-101-5/+1
| | | | llvm-svn: 255285
* [PGO] use COMPILER_RT_HAS_ATOMTICS macroXinliang David Li2015-12-101-4/+4
| | | | llvm-svn: 255266
* Fix typoXinliang David Li2015-12-081-1/+1
| | | | llvm-svn: 255068
* [PGO] Stop leaking libc function to buffer API implXinliang David Li2015-12-071-1/+4
| | | | llvm-svn: 254943
* Use macro for common code pattern (NFC)Xinliang David Li2015-12-051-9/+15
| | | | llvm-svn: 254831
* [PGO] Fix mips test failure with new test caseXinliang David Li2015-12-041-4/+19
| | | | | | | | | | cmp&swap is not well supported -- the new test case triggers some assembler error. This is a partial fix to the general problem (lack of atomics operation support for certain targets). llvm-svn: 254701
* [PGO] Unify VP data format between raw and indexed profile (runtime)Xinliang David Li2015-12-041-59/+116
| | | | | | | | | | With the latest refactoring and code sharing patches landed, it is possible to unify the value profile implementation between raw and indexed profile. This is part in prfofile runtime. Differential Revision: http://reviews.llvm.org/D15057 llvm-svn: 254678
* [PGO] Use common definition of raw magic and versionXinliang David Li2015-11-231-15/+3
| | | | | | | - Replace duplicate definition and use of magic in profile runtime - Replace hard coded version reference in profile runtime llvm-svn: 253885
* [PGO] Start use InstrProf template file in compiler-rt/lib/profileXinliang David Li2015-11-231-17/+12
| | | | | | | - Replace use of __llvm_profile_value_data with common data structure. - Remve duplicate InstrProfValueNode llvm-svn: 253883
* [PGO] Compiler-rt cleanup -- introduces macros for various macrosXinliang David Li2015-11-231-10/+8
| | | | | | | This makes code more readable and be made more portable in the future. There is no functional change. llvm-svn: 253845
* [PGO] Profile runtime name cleanupsXinliang David Li2015-11-201-25/+33
| | | | | | | | | | | | | 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 llvm-svn: 253700
* Speculatively fix MIPS build bot failuresXinliang David Li2015-11-201-0/+9
| | | | | | | | MIPS build bots failed due to lack of 64bit atomic operations. The fix is to disable VP for MIPS target until a better solution is found. llvm-svn: 253687
* Fix format in comments.Xinliang David Li2015-11-181-9/+12
| | | | llvm-svn: 253510
* [PGO] Minor cleanups (formating, comments etc) (NFC)Xinliang David Li2015-11-181-47/+55
| | | | | | | | | 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. llvm-svn: 253508
* Fix for loop initial decl used outside c99 mode errorXinliang David Li2015-11-181-9/+15
| | | | llvm-svn: 253496
* [PGO] Runtime support for value profiling.Betul Buyukkurt2015-11-181-1/+147
| | | | | | | | 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. llvm-svn: 253483
* profile: Avoid name collisions between instrumentation and runtimeJustin Bogner2014-09-041-2/+2
| | | | | | | | | | | | 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. llvm-svn: 217166
* InstrProf: Fix shared object profilingDuncan P. N. Exon Smith2014-05-161-0/+3
| | | | | | | | | | | | | | | | | | 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> llvm-svn: 208940
* InstrProf: Indicate pointer size in raw profileDuncan P. N. Exon Smith2014-03-231-4/+6
| | | | | | | | | Since the profile can come from 32-bit machines, the reader needs to check the pointer size. Change the magic number to facilitate this. <rdar://problem/16400648> llvm-svn: 204556
* InstrProf: Change magic number to have non-text charactersDuncan P. N. Exon Smith2014-03-211-9/+16
| | | | | | | | | Include non-text characters in the magic number so that text files can't match. <rdar://problem/15950346> llvm-svn: 204514
* InstrProf: Reorganize files; no functionality changeDuncan P. N. Exon Smith2014-03-211-47/+4
| | | | | | | | | | | | | | | | | | Move functions around to prepare for some other changes. - Merge InstrProfilingExtras.h with InstrProfiling.h. There's no benefit to having these split. - Rename InstrProfilingExtras.c to InstrProfilingFile.c. - Split actual buffer writing code out of InstrProfiling.c into InstrProfilingBuffer.c. - Drive-by corrections of a couple of header comments. <rdar://problem/15943240> llvm-svn: 204497
* InstrProf: Write raw binary profile from runtimeDuncan P. N. Exon Smith2014-03-211-22/+47
| | | | | | | | Write a raw binary profile from the runtime. <rdar://problem/15950346> llvm-svn: 204495
* PGO: Indicate errors in profile runtime APIDuncan P. N. Exon Smith2014-03-211-7/+17
| | | | | | Return 0 for success, non-0 for failure. llvm-svn: 204415
* PGO: Change runtime prefix from pgo to profileDuncan P. N. Exon Smith2014-03-201-8/+8
| | | | | | | | | | | These functions are in the profile runtime. PGO comes later. Unfortunately, there's only room for 16 characters in a Darwin section, so use __llvm_prf_ instead of __llvm_profile_ for section names. <rdar://problem/15943240> llvm-svn: 204391
* PGO: Add function to reset counters at runtimeDuncan P. N. Exon Smith2014-03-201-0/+8
| | | | | | | | Adding __llvm_pgo_reset_counters(), which sets all the counters to 0. <rdar://problem/15943240> llvm-svn: 204386
* PGO: Split out initialization of section boundsDuncan P. N. Exon Smith2014-03-201-35/+2
| | | | | | | | | | | | | | | Currently we register instrumentation data at runtime to determine the bounds of the sections where the data lives. Soon we'll implement platform-specific linker magic to determine this at link time. Move this logic to a separate file, so that our build system can choose the correct platform-specific code. No functionality change intended. <rdar://problem/15943240> llvm-svn: 204299
* PGO: Constify references to instrumentation dataDuncan P. N. Exon Smith2014-03-201-6/+6
| | | | | | <rdar://problem/15943240> llvm-svn: 204298
* PGO: Use past-the-end semantics for pointer rangeDuncan P. N. Exon Smith2014-03-191-5/+4
| | | | llvm-svn: 204278
OpenPOWER on IntegriCloud