diff options
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_misc.cpp')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index db0ca606e5..f004c0ae45 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -34,7 +34,10 @@ #define __STDC_CONSTANT_MACROS #endif -#include "llvm-c/Core.h" +#include <llvm-c/Core.h> +#include <llvm-c/ExecutionEngine.h> +#include <llvm/ExecutionEngine/ExecutionEngine.h> +#include <llvm/ExecutionEngine/JITEventListener.h> #include "pipe/p_config.h" #include "util/u_debug.h" @@ -98,3 +101,21 @@ lp_debug_dump_value(LLVMValueRef value) #endif + + +/** + * Register the engine with oprofile. + * + * This allows to see the LLVM IR function names in oprofile output. + * + * To actually work LLVM needs to be built with the --with-oprofile configure + * option. + * + * Also a oprofile:oprofile user:group is necessary. Which is not created by + * default on some distributions. + */ +extern "C" void +lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE) +{ + llvm::unwrap(EE)->RegisterJITEventListener(llvm::createOProfileJITEventListener()); +} |