[MIPS GlobalISel] Select MSA vector generic and builtin add
[llvm-complete.git] / lib / ExecutionEngine / IntelJITEvents / jitprofiling.h
blobba627b430ff1272101a65bd8c41b2af123cf743e
1 /*===-- jitprofiling.h - JIT Profiling API-------------------------*- C -*-===*
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===----------------------------------------------------------------------===*
9 * This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
10 * Profiling API declaration.
12 * NOTE: This file comes in a style different from the rest of LLVM
13 * source base since this is a piece of code shared from Intel(R)
14 * products. Please do not reformat / re-style this code to make
15 * subsequent merges and contributions from the original source base eaiser.
17 *===----------------------------------------------------------------------===*/
18 #ifndef __JITPROFILING_H__
19 #define __JITPROFILING_H__
22 * Various constants used by functions
25 /* event notification */
26 typedef enum iJIT_jvm_event
29 /* shutdown */
32 * Program exiting EventSpecificData NA
34 iJVM_EVENT_TYPE_SHUTDOWN = 2,
36 /* JIT profiling */
39 * issued after method code jitted into memory but before code is executed
40 * EventSpecificData is an iJIT_Method_Load
42 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13,
44 /* issued before unload. Method code will no longer be executed, but code
45 * and info are still in memory. The VTune profiler may capture method
46 * code only at this point EventSpecificData is iJIT_Method_Id
48 iJVM_EVENT_TYPE_METHOD_UNLOAD_START,
50 /* Method Profiling */
52 /* method name, Id and stack is supplied
53 * issued when a method is about to be entered EventSpecificData is
54 * iJIT_Method_NIDS
56 iJVM_EVENT_TYPE_ENTER_NIDS = 19,
58 /* method name, Id and stack is supplied
59 * issued when a method is about to be left EventSpecificData is
60 * iJIT_Method_NIDS
62 iJVM_EVENT_TYPE_LEAVE_NIDS
63 } iJIT_JVM_EVENT;
65 typedef enum _iJIT_ModeFlags
67 /* No need to Notify VTune, since VTune is not running */
68 iJIT_NO_NOTIFICATIONS = 0x0000,
70 /* when turned on the jit must call
71 * iJIT_NotifyEvent
72 * (
73 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED,
74 * )
75 * for all the method already jitted
77 iJIT_BE_NOTIFY_ON_LOAD = 0x0001,
79 /* when turned on the jit must call
80 * iJIT_NotifyEvent
81 * (
82 * iJVM_EVENT_TYPE_METHOD_UNLOAD_FINISHED,
83 * ) for all the method that are unloaded
85 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002,
87 /* when turned on the jit must instrument all
88 * the currently jited code with calls on
89 * method entries
91 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004,
93 /* when turned on the jit must instrument all
94 * the currently jited code with calls
95 * on method exit
97 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008
99 } iJIT_ModeFlags;
102 /* Flags used by iJIT_IsProfilingActive() */
103 typedef enum _iJIT_IsProfilingActiveFlags
105 /* No profiler is running. Currently not used */
106 iJIT_NOTHING_RUNNING = 0x0000,
108 /* Sampling is running. This is the default value
109 * returned by iJIT_IsProfilingActive()
111 iJIT_SAMPLING_ON = 0x0001,
113 /* Call Graph is running */
114 iJIT_CALLGRAPH_ON = 0x0002
116 } iJIT_IsProfilingActiveFlags;
118 /* Enumerator for the environment of methods*/
119 typedef enum _iJDEnvironmentType
121 iJDE_JittingAPI = 2
122 } iJDEnvironmentType;
124 /**********************************
125 * Data structures for the events *
126 **********************************/
128 /* structure for the events:
129 * iJVM_EVENT_TYPE_METHOD_UNLOAD_START
132 typedef struct _iJIT_Method_Id
134 /* Id of the method (same as the one passed in
135 * the iJIT_Method_Load struct
137 unsigned int method_id;
139 } *piJIT_Method_Id, iJIT_Method_Id;
142 /* structure for the events:
143 * iJVM_EVENT_TYPE_ENTER_NIDS,
144 * iJVM_EVENT_TYPE_LEAVE_NIDS,
145 * iJVM_EVENT_TYPE_EXCEPTION_OCCURRED_NIDS
148 typedef struct _iJIT_Method_NIDS
150 /* unique method ID */
151 unsigned int method_id;
153 /* NOTE: no need to fill this field, it's filled by VTune */
154 unsigned int stack_id;
156 /* method name (just the method, without the class) */
157 char* method_name;
158 } *piJIT_Method_NIDS, iJIT_Method_NIDS;
160 /* structures for the events:
161 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED
164 typedef struct _LineNumberInfo
166 /* x86 Offset from the beginning of the method*/
167 unsigned int Offset;
169 /* source line number from the beginning of the source file */
170 unsigned int LineNumber;
172 } *pLineNumberInfo, LineNumberInfo;
174 typedef struct _iJIT_Method_Load
176 /* unique method ID - can be any unique value, (except 0 - 999) */
177 unsigned int method_id;
179 /* method name (can be with or without the class and signature, in any case
180 * the class name will be added to it)
182 char* method_name;
184 /* virtual address of that method - This determines the method range for the
185 * iJVM_EVENT_TYPE_ENTER/LEAVE_METHOD_ADDR events
187 void* method_load_address;
189 /* Size in memory - Must be exact */
190 unsigned int method_size;
192 /* Line Table size in number of entries - Zero if none */
193 unsigned int line_number_size;
195 /* Pointer to the beginning of the line numbers info array */
196 pLineNumberInfo line_number_table;
198 /* unique class ID */
199 unsigned int class_id;
201 /* class file name */
202 char* class_file_name;
204 /* source file name */
205 char* source_file_name;
207 /* bits supplied by the user for saving in the JIT file */
208 void* user_data;
210 /* the size of the user data buffer */
211 unsigned int user_data_size;
213 /* NOTE: no need to fill this field, it's filled by VTune */
214 iJDEnvironmentType env;
216 } *piJIT_Method_Load, iJIT_Method_Load;
218 /* API Functions */
219 #ifdef __cplusplus
220 extern "C" {
221 #endif
223 #ifndef CDECL
224 # if defined WIN32 || defined _WIN32
225 # define CDECL __cdecl
226 # else /* defined WIN32 || defined _WIN32 */
227 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
228 # define CDECL /* not actual on x86_64 platform */
229 # else /* _M_X64 || _M_AMD64 || __x86_64__ */
230 # define CDECL __attribute__ ((cdecl))
231 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */
232 # endif /* defined WIN32 || defined _WIN32 */
233 #endif /* CDECL */
235 #define JITAPI CDECL
237 /* called when the settings are changed with new settings */
238 typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags);
240 int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData);
242 /* The new mode call back routine */
243 void JITAPI iJIT_RegisterCallbackEx(void *userdata,
244 iJIT_ModeChangedEx NewModeCallBackFuncEx);
246 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
248 void JITAPI FinalizeThread(void);
250 void JITAPI FinalizeProcess(void);
252 unsigned int JITAPI iJIT_GetNewMethodID(void);
254 #ifdef __cplusplus
256 #endif
258 #endif /* __JITPROFILING_H__ */