aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lli
diff options
context:
space:
mode:
authorEli Bendersky <eli.bendersky@intel.com>2012-03-13 08:33:15 +0000
committerEli Bendersky <eli.bendersky@intel.com>2012-03-13 08:33:15 +0000
commit61b1851a205cb8dd29c1d3d4231efb8f8f7da283 (patch)
tree8282d3ba79077e426d5875c82f3c6f97513f0b77 /tools/lli
parentc007ba86f31ebe3a1c4cdba5fa23260caaf81e0f (diff)
downloadexternal_llvm-61b1851a205cb8dd29c1d3d4231efb8f8f7da283.zip
external_llvm-61b1851a205cb8dd29c1d3d4231efb8f8f7da283.tar.gz
external_llvm-61b1851a205cb8dd29c1d3d4231efb8f8f7da283.tar.bz2
Add profiling support for Intel Parallel Amplifier XE (VTune) for JITted code in LLVM.
Also refactor the existing OProfile profiling code to reuse the same interfaces with the VTune profiling code. In addition, unit tests for the profiling interfaces were added. This patch was prepared by Andrew Kaylor and Daniel Malea, and reviewed in the llvm-commits list by Jim Grosbach git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r--tools/lli/CMakeLists.txt17
-rw-r--r--tools/lli/Makefile17
-rw-r--r--tools/lli/lli.cpp7
3 files changed, 39 insertions, 2 deletions
diff --git a/tools/lli/CMakeLists.txt b/tools/lli/CMakeLists.txt
index 9378ef2..a5d2e61 100644
--- a/tools/lli/CMakeLists.txt
+++ b/tools/lli/CMakeLists.txt
@@ -1,5 +1,22 @@
+
+link_directories( ${LLVM_INTEL_JITEVENTS_LIBDIR} )
+
set(LLVM_LINK_COMPONENTS mcjit jit interpreter nativecodegen bitreader asmparser selectiondag)
+if( LLVM_USE_OPROFILE )
+ set(LLVM_LINK_COMPONENTS
+ ${LLVM_LINK_COMPONENTS}
+ OProfileJIT
+ )
+endif( LLVM_USE_OPROFILE )
+
+if( LLVM_USE_INTEL_JITEVENTS )
+ set(LLVM_LINK_COMPONENTS
+ ${LLVM_LINK_COMPONENTS}
+ IntelJITEvents
+ )
+endif( LLVM_USE_INTEL_JITEVENTS )
+
add_llvm_tool(lli
lli.cpp
)
diff --git a/tools/lli/Makefile b/tools/lli/Makefile
index 292f608..100fc2e 100644
--- a/tools/lli/Makefile
+++ b/tools/lli/Makefile
@@ -9,6 +9,21 @@
LEVEL := ../..
TOOLNAME := lli
+
+include $(LEVEL)/Makefile.config
+
LINK_COMPONENTS := mcjit jit interpreter nativecodegen bitreader asmparser selectiondag
-include $(LEVEL)/Makefile.common
+# If Intel JIT Events support is confiured, link against the LLVM Intel JIT
+# Events interface library
+ifeq ($(USE_INTEL_JITEVENTS), 1)
+ LINK_COMPONENTS += inteljitevents
+endif
+
+# If oprofile support is confiured, link against the LLVM oprofile interface
+# library
+ifeq ($(USE_OPROFILE), 1)
+ LINK_COMPONENTS += oprofilejit
+endif
+
+include $(LLVM_SRC_ROOT)/Makefile.rules
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 0e8d1d8..efcc1f5 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -238,7 +238,12 @@ int main(int argc, char **argv, char * const *envp) {
exit(1);
}
- EE->RegisterJITEventListener(createOProfileJITEventListener());
+ // The following functions have no effect if their respective profiling
+ // support wasn't enabled in the build configuration.
+ EE->RegisterJITEventListener(
+ JITEventListener::createOProfileJITEventListener());
+ EE->RegisterJITEventListener(
+ JITEventListener::createIntelJITEventListener());
EE->DisableLazyCompilation(NoLazyCompilation);