JITEventListener.h revision 195098
1195098Sed//===- JITEventListener.h - Exposes events from JIT compilation -*- C++ -*-===// 2195098Sed// 3195098Sed// The LLVM Compiler Infrastructure 4195098Sed// 5195098Sed// This file is distributed under the University of Illinois Open Source 6195098Sed// License. See LICENSE.TXT for details. 7195098Sed// 8195098Sed//===----------------------------------------------------------------------===// 9195098Sed// 10195098Sed// This file defines the JITEventListener interface, which lets users get 11195098Sed// callbacks when significant events happen during the JIT compilation process. 12195098Sed// 13195098Sed//===----------------------------------------------------------------------===// 14195098Sed 15195098Sed#ifndef LLVM_EXECUTION_ENGINE_JIT_EVENTLISTENER_H 16195098Sed#define LLVM_EXECUTION_ENGINE_JIT_EVENTLISTENER_H 17195098Sed 18195098Sed#include "llvm/Support/DataTypes.h" 19195098Sed 20195098Sednamespace llvm { 21195098Sedclass Function; 22195098Sed 23195098Sed/// Empty for now, but this object will contain all details about the 24195098Sed/// generated machine code that a Listener might care about. 25195098Sedstruct JITEvent_EmittedFunctionDetails { 26195098Sed}; 27195098Sed 28195098Sed/// JITEventListener - This interface is used by the JIT to notify clients about 29195098Sed/// significant events during compilation. For example, we could have 30195098Sed/// implementations for profilers and debuggers that need to know where 31195098Sed/// functions have been emitted. 32195098Sed/// 33195098Sed/// Each method defaults to doing nothing, so you only need to override the ones 34195098Sed/// you care about. 35195098Sedclass JITEventListener { 36195098Sedpublic: 37195098Sed JITEventListener() {} 38195098Sed virtual ~JITEventListener(); // Defined in JIT.cpp. 39195098Sed 40195098Sed typedef JITEvent_EmittedFunctionDetails EmittedFunctionDetails; 41195098Sed /// NotifyFunctionEmitted - Called after a function has been successfully 42195098Sed /// emitted to memory. The function still has its MachineFunction attached, 43195098Sed /// if you should happen to need that. 44195098Sed virtual void NotifyFunctionEmitted(const Function &F, 45195098Sed void *Code, size_t Size, 46195098Sed const EmittedFunctionDetails &Details) {} 47195098Sed 48195098Sed /// NotifyFreeingMachineCode - This is called inside of 49195098Sed /// freeMachineCodeForFunction(), after the global mapping is removed, but 50195098Sed /// before the machine code is returned to the allocator. OldPtr is the 51195098Sed /// address of the machine code. 52195098Sed virtual void NotifyFreeingMachineCode(const Function &F, void *OldPtr) {} 53195098Sed}; 54195098Sed 55195098SedJITEventListener *createMacOSJITEventListener(); 56195098Sed 57195098Sed} // end namespace llvm. 58195098Sed 59195098Sed#endif 60