[PATCH] D84076: [llvm-exegesis] Unset HAVE_LIBPFM if the kernel is too old.
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 24 09:36:02 PDT 2020
oontvoo updated this revision to Diff 280499.
oontvoo marked an inline comment as done.
oontvoo added a comment.
'cycle' -> 'cycles'
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84076/new/
https://reviews.llvm.org/D84076
Files:
llvm/cmake/modules/FindLibpfm.cmake
llvm/include/llvm/Config/config.h.cmake
Index: llvm/include/llvm/Config/config.h.cmake
===================================================================
--- llvm/include/llvm/Config/config.h.cmake
+++ llvm/include/llvm/Config/config.h.cmake
@@ -97,6 +97,9 @@
/* Define to 1 if you have the `pfm' library (-lpfm). */
#cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM}
+/* Define to 1 if the `perf_branch_entry' struct has field cycles. */
+#cmakedefine LIBPFM_HAS_FIELD_CYCLES ${LIBPFM_HAS_FIELD_CYCLES}
+
/* Define to 1 if you have the `psapi' library (-lpsapi). */
#cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI}
Index: llvm/cmake/modules/FindLibpfm.cmake
===================================================================
--- llvm/cmake/modules/FindLibpfm.cmake
+++ llvm/cmake/modules/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 @@
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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84076.280499.patch
Type: text/x-patch
Size: 1736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200724/484112b3/attachment.bin>
More information about the llvm-commits
mailing list