aboutsummaryrefslogtreecommitdiff
path: root/lib/cmake/llvm/FindLibpfm.cmake
diff options
context:
space:
mode:
authorDanny <danny@kdrag0n.dev>2021-01-09 23:34:32 +0000
committermosimchah <mosimchah@gmail.com>2021-01-22 03:35:20 -0800
commit783d21ff74759076d2fc503685ca47d2c29baea3 (patch)
treed650cc46cbf7ca53f15c77ced2682e97d492c068 /lib/cmake/llvm/FindLibpfm.cmake
parentfdbc6f7102056fb52d26bfb2cbc6ea317890ee34 (diff)
Update to 20210109 buildHEADmaster
LLVM commit: https://github.com/llvm/llvm-project/commit/b02eab9058e58782fca32dd8b1e53c27ed93f866 binutils version: 2.35.1 Builder commit: https://github.com/kdrag0n/proton-clang-build/commit/ba42f701467c9103f23fbb90aca4b23858221ee2
Diffstat (limited to 'lib/cmake/llvm/FindLibpfm.cmake')
-rw-r--r--lib/cmake/llvm/FindLibpfm.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/cmake/llvm/FindLibpfm.cmake b/lib/cmake/llvm/FindLibpfm.cmake
index 202bb03..38cf3af 100644
--- a/lib/cmake/llvm/FindLibpfm.cmake
+++ b/lib/cmake/llvm/FindLibpfm.cmake
@@ -7,6 +7,7 @@
include(CheckIncludeFile)
include(CheckLibraryExists)
+include(CheckCXXSourceCompiles)
if (LLVM_ENABLE_LIBPFM)
check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE)
@@ -16,6 +17,19 @@ if (LLVM_ENABLE_LIBPFM)
check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
set(HAVE_LIBPFM 1)
+ # Check to see if perf_branch_entry has the field 'cycles'.
+ # We couldn't use CheckStructHasMember here because 'cycles' is a bit field which is not
+ # supported by CheckStructHasMember.
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <perfmon/perf_event.h>
+ int main() {
+ perf_branch_entry entry;
+ entry.cycles = 2;
+ return 0;
+ }" COMPILE_WITH_CYCLES)
+ if(COMPILE_WITH_CYCLES)
+ set(LIBPFM_HAS_FIELD_CYCLES 1)
+ endif()
endif()
endif()
endif()