freebsd-dev/contrib/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h
Dimitry Andric f785676f2a Upgrade our copy of llvm/clang to 3.4 release. This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.

The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3.  The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.

Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>

MFC after:	1 month
2014-02-16 19:44:07 +00:00

97 lines
3.4 KiB
C++

//===-- IntelJITEventsWrapper.h - Intel JIT Events API Wrapper --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a wrapper for the Intel JIT Events API. It allows for the
// implementation of the jitprofiling library to be swapped with an alternative
// implementation (for testing). To include this file, you must have the
// jitprofiling.h header available; it is available in Intel(R) VTune(TM)
// Amplifier XE 2011.
//
//===----------------------------------------------------------------------===//
#ifndef INTEL_JIT_EVENTS_WRAPPER_H
#define INTEL_JIT_EVENTS_WRAPPER_H
#include "jitprofiling.h"
namespace llvm {
class IntelJITEventsWrapper {
// Function pointer types for testing implementation of Intel jitprofiling
// library
typedef int (*NotifyEventPtr)(iJIT_JVM_EVENT, void*);
typedef void (*RegisterCallbackExPtr)(void *, iJIT_ModeChangedEx );
typedef iJIT_IsProfilingActiveFlags (*IsProfilingActivePtr)(void);
typedef void (*FinalizeThreadPtr)(void);
typedef void (*FinalizeProcessPtr)(void);
typedef unsigned int (*GetNewMethodIDPtr)(void);
NotifyEventPtr NotifyEventFunc;
RegisterCallbackExPtr RegisterCallbackExFunc;
IsProfilingActivePtr IsProfilingActiveFunc;
GetNewMethodIDPtr GetNewMethodIDFunc;
public:
bool isAmplifierRunning() {
return iJIT_IsProfilingActive() == iJIT_SAMPLING_ON;
}
IntelJITEventsWrapper()
: NotifyEventFunc(::iJIT_NotifyEvent),
RegisterCallbackExFunc(::iJIT_RegisterCallbackEx),
IsProfilingActiveFunc(::iJIT_IsProfilingActive),
GetNewMethodIDFunc(::iJIT_GetNewMethodID) {
}
IntelJITEventsWrapper(NotifyEventPtr NotifyEventImpl,
RegisterCallbackExPtr RegisterCallbackExImpl,
IsProfilingActivePtr IsProfilingActiveImpl,
FinalizeThreadPtr FinalizeThreadImpl,
FinalizeProcessPtr FinalizeProcessImpl,
GetNewMethodIDPtr GetNewMethodIDImpl)
: NotifyEventFunc(NotifyEventImpl),
RegisterCallbackExFunc(RegisterCallbackExImpl),
IsProfilingActiveFunc(IsProfilingActiveImpl),
GetNewMethodIDFunc(GetNewMethodIDImpl) {
}
// Sends an event announcing that a function has been emitted
// return values are event-specific. See Intel documentation for details.
int iJIT_NotifyEvent(iJIT_JVM_EVENT EventType, void *EventSpecificData) {
if (!NotifyEventFunc)
return -1;
return NotifyEventFunc(EventType, EventSpecificData);
}
// Registers a callback function to receive notice of profiling state changes
void iJIT_RegisterCallbackEx(void *UserData,
iJIT_ModeChangedEx NewModeCallBackFuncEx) {
if (RegisterCallbackExFunc)
RegisterCallbackExFunc(UserData, NewModeCallBackFuncEx);
}
// Returns the current profiler mode
iJIT_IsProfilingActiveFlags iJIT_IsProfilingActive(void) {
if (!IsProfilingActiveFunc)
return iJIT_NOTHING_RUNNING;
return IsProfilingActiveFunc();
}
// Generates a locally unique method ID for use in code registration
unsigned int iJIT_GetNewMethodID(void) {
if (!GetNewMethodIDFunc)
return -1;
return GetNewMethodIDFunc();
}
};
} //namespace llvm
#endif //INTEL_JIT_EVENTS_WRAPPER_H