1345153Sdim#if USE_DEBUGGER
2345153Sdim/*
3345153Sdim * kmp_omp.h -- OpenMP definition for kmp_omp_struct_info_t.
4345153Sdim *              This is for information about runtime library structures.
5345153Sdim */
6345153Sdim
7345153Sdim//===----------------------------------------------------------------------===//
8345153Sdim//
9353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
10353358Sdim// See https://llvm.org/LICENSE.txt for license information.
11353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12345153Sdim//
13345153Sdim//===----------------------------------------------------------------------===//
14345153Sdim
15345153Sdim/* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE
16345153Sdim   It should instead be modified in the OpenMP runtime and copied to the
17345153Sdim   interface library code.  This way we can minimize the problems that this is
18345153Sdim   sure to cause having two copies of the same file.
19345153Sdim
20345153Sdim   Files live in libomp and libomp_db/src/include  */
21345153Sdim
22345153Sdim/* CHANGE THIS WHEN STRUCTURES BELOW CHANGE
23345153Sdim   Before we release this to a customer, please don't change this value.  After
24345153Sdim   it is released and stable, then any new updates to the structures or data
25345153Sdim   structure traversal algorithms need to change this value. */
26345153Sdim#define KMP_OMP_VERSION 9
27345153Sdim
28345153Sdimtypedef struct {
29345153Sdim  kmp_int32 offset;
30345153Sdim  kmp_int32 size;
31345153Sdim} offset_and_size_t;
32345153Sdim
33345153Sdimtypedef struct {
34345153Sdim  kmp_uint64 addr;
35345153Sdim  kmp_int32 size;
36345153Sdim  kmp_int32 padding;
37345153Sdim} addr_and_size_t;
38345153Sdim
39345153Sdimtypedef struct {
40345153Sdim  kmp_uint64 flags; // Flags for future extensions.
41345153Sdim  kmp_uint64
42345153Sdim      file; // Pointer to name of source file where the parallel region is.
43345153Sdim  kmp_uint64 func; // Pointer to name of routine where the parallel region is.
44345153Sdim  kmp_int32 begin; // Beginning of source line range.
45345153Sdim  kmp_int32 end; // End of source line range.
46345153Sdim  kmp_int32 num_threads; // Specified number of threads.
47345153Sdim} kmp_omp_nthr_item_t;
48345153Sdim
49345153Sdimtypedef struct {
50345153Sdim  kmp_int32 num; // Number of items in the arrray.
51345153Sdim  kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t.
52345153Sdim} kmp_omp_nthr_info_t;
53345153Sdim
54345153Sdim/* This structure is known to the idb interface library */
55345153Sdimtypedef struct {
56345153Sdim
57345153Sdim  /* Change this only if you make a fundamental data structure change here */
58345153Sdim  kmp_int32 lib_version;
59345153Sdim
60345153Sdim  /* sanity check.  Only should be checked if versions are identical
61345153Sdim   * This is also used for backward compatibility to get the runtime
62345153Sdim   * structure size if it the runtime is older than the interface */
63345153Sdim  kmp_int32 sizeof_this_structure;
64345153Sdim
65345153Sdim  /* OpenMP RTL version info. */
66345153Sdim  addr_and_size_t major;
67345153Sdim  addr_and_size_t minor;
68345153Sdim  addr_and_size_t build;
69345153Sdim  addr_and_size_t openmp_version;
70345153Sdim  addr_and_size_t banner;
71345153Sdim
72345153Sdim  /* Various globals. */
73345153Sdim  addr_and_size_t threads; // Pointer to __kmp_threads.
74345153Sdim  addr_and_size_t roots; // Pointer to __kmp_root.
75345153Sdim  addr_and_size_t capacity; // Pointer to __kmp_threads_capacity.
76345153Sdim#if KMP_USE_MONITOR
77345153Sdim  addr_and_size_t monitor; // Pointer to __kmp_monitor.
78345153Sdim#endif
79345153Sdim#if !KMP_USE_DYNAMIC_LOCK
80345153Sdim  addr_and_size_t lock_table; // Pointer to __kmp_lock_table.
81345153Sdim#endif
82345153Sdim  addr_and_size_t func_microtask;
83345153Sdim  addr_and_size_t func_fork;
84345153Sdim  addr_and_size_t func_fork_teams;
85345153Sdim  addr_and_size_t team_counter;
86345153Sdim  addr_and_size_t task_counter;
87345153Sdim  addr_and_size_t nthr_info;
88345153Sdim  kmp_int32 address_width;
89345153Sdim  kmp_int32 indexed_locks;
90345153Sdim  kmp_int32 last_barrier; // The end in enum barrier_type
91345153Sdim  kmp_int32 deque_size; // TASK_DEQUE_SIZE
92345153Sdim
93345153Sdim  /* thread structure information. */
94345153Sdim  kmp_int32 th_sizeof_struct;
95345153Sdim  offset_and_size_t th_info; // descriptor for thread
96345153Sdim  offset_and_size_t th_team; // team for this thread
97345153Sdim  offset_and_size_t th_root; // root for this thread
98345153Sdim  offset_and_size_t th_serial_team; // serial team under this thread
99345153Sdim  offset_and_size_t th_ident; // location for this thread (if available)
100345153Sdim  offset_and_size_t th_spin_here; // is thread waiting for lock (if available)
101345153Sdim  offset_and_size_t
102345153Sdim      th_next_waiting; // next thread waiting for lock (if available)
103345153Sdim  offset_and_size_t th_task_team; // task team struct
104345153Sdim  offset_and_size_t th_current_task; // innermost task being executed
105345153Sdim  offset_and_size_t
106345153Sdim      th_task_state; // alternating 0/1 for task team identification
107345153Sdim  offset_and_size_t th_bar;
108345153Sdim  offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it
109353358Sdim  // arrives to the barrier
110345153Sdim
111345153Sdim  /* teams information */
112345153Sdim  offset_and_size_t th_teams_microtask; // entry address for teams construct
113345153Sdim  offset_and_size_t th_teams_level; // initial level of teams construct
114345153Sdim  offset_and_size_t th_teams_nteams; // number of teams in a league
115345153Sdim  offset_and_size_t
116345153Sdim      th_teams_nth; // number of threads in each team of the league
117345153Sdim
118345153Sdim  /* kmp_desc structure (for info field above) */
119345153Sdim  kmp_int32 ds_sizeof_struct;
120345153Sdim  offset_and_size_t ds_tid; // team thread id
121345153Sdim  offset_and_size_t ds_gtid; // global thread id
122345153Sdim  offset_and_size_t ds_thread; // native thread id
123345153Sdim
124345153Sdim  /* team structure information */
125345153Sdim  kmp_int32 t_sizeof_struct;
126345153Sdim  offset_and_size_t t_master_tid; // tid of master in parent team
127345153Sdim  offset_and_size_t t_ident; // location of parallel region
128345153Sdim  offset_and_size_t t_parent; // parent team
129345153Sdim  offset_and_size_t t_nproc; // # team threads
130345153Sdim  offset_and_size_t t_threads; // array of threads
131345153Sdim  offset_and_size_t t_serialized; // # levels of serialized teams
132345153Sdim  offset_and_size_t t_id; // unique team id
133345153Sdim  offset_and_size_t t_pkfn;
134345153Sdim  offset_and_size_t t_task_team; // task team structure
135345153Sdim  offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task
136345153Sdim  offset_and_size_t t_cancel_request;
137345153Sdim  offset_and_size_t t_bar;
138345153Sdim  offset_and_size_t
139345153Sdim      t_b_master_arrived; // increased by 1 when master arrives to a barrier
140345153Sdim  offset_and_size_t
141345153Sdim      t_b_team_arrived; // increased by one when all the threads arrived
142345153Sdim
143345153Sdim  /* root structure information */
144345153Sdim  kmp_int32 r_sizeof_struct;
145345153Sdim  offset_and_size_t r_root_team; // team at root
146345153Sdim  offset_and_size_t r_hot_team; // hot team for this root
147345153Sdim  offset_and_size_t r_uber_thread; // root thread
148345153Sdim  offset_and_size_t r_root_id; // unique root id (if available)
149345153Sdim
150345153Sdim  /* ident structure information */
151345153Sdim  kmp_int32 id_sizeof_struct;
152345153Sdim  offset_and_size_t
153345153Sdim      id_psource; /* address of string ";file;func;line1;line2;;". */
154345153Sdim  offset_and_size_t id_flags;
155345153Sdim
156345153Sdim  /* lock structure information */
157345153Sdim  kmp_int32 lk_sizeof_struct;
158345153Sdim  offset_and_size_t lk_initialized;
159345153Sdim  offset_and_size_t lk_location;
160345153Sdim  offset_and_size_t lk_tail_id;
161345153Sdim  offset_and_size_t lk_head_id;
162345153Sdim  offset_and_size_t lk_next_ticket;
163345153Sdim  offset_and_size_t lk_now_serving;
164345153Sdim  offset_and_size_t lk_owner_id;
165345153Sdim  offset_and_size_t lk_depth_locked;
166345153Sdim  offset_and_size_t lk_lock_flags;
167345153Sdim
168345153Sdim#if !KMP_USE_DYNAMIC_LOCK
169345153Sdim  /* lock_table_t */
170345153Sdim  kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */
171345153Sdim  offset_and_size_t lt_used;
172345153Sdim  offset_and_size_t lt_allocated;
173345153Sdim  offset_and_size_t lt_table;
174345153Sdim#endif
175345153Sdim
176345153Sdim  /* task_team_t */
177345153Sdim  kmp_int32 tt_sizeof_struct;
178345153Sdim  offset_and_size_t tt_threads_data;
179345153Sdim  offset_and_size_t tt_found_tasks;
180345153Sdim  offset_and_size_t tt_nproc;
181345153Sdim  offset_and_size_t tt_unfinished_threads;
182345153Sdim  offset_and_size_t tt_active;
183345153Sdim
184345153Sdim  /* kmp_taskdata_t */
185345153Sdim  kmp_int32 td_sizeof_struct;
186345153Sdim  offset_and_size_t td_task_id; // task id
187345153Sdim  offset_and_size_t td_flags; // task flags
188345153Sdim  offset_and_size_t td_team; // team for this task
189345153Sdim  offset_and_size_t td_parent; // parent task
190345153Sdim  offset_and_size_t td_level; // task testing level
191345153Sdim  offset_and_size_t td_ident; // task identifier
192345153Sdim  offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task)
193345153Sdim  // not yet deallocated
194345153Sdim  offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete
195345153Sdim
196345153Sdim  /* Taskwait */
197345153Sdim  offset_and_size_t td_taskwait_ident;
198345153Sdim  offset_and_size_t td_taskwait_counter;
199345153Sdim  offset_and_size_t
200345153Sdim      td_taskwait_thread; // gtid + 1 of thread encountered taskwait
201345153Sdim
202345153Sdim  /* Taskgroup */
203345153Sdim  offset_and_size_t td_taskgroup; // pointer to the current taskgroup
204345153Sdim  offset_and_size_t
205345153Sdim      td_task_count; // number of allocated and not yet complete tasks
206345153Sdim  offset_and_size_t td_cancel; // request for cancellation of this taskgroup
207345153Sdim
208345153Sdim  /* Task dependency */
209345153Sdim  offset_and_size_t
210345153Sdim      td_depnode; // pointer to graph node if the task has dependencies
211345153Sdim  offset_and_size_t dn_node;
212345153Sdim  offset_and_size_t dn_next;
213345153Sdim  offset_and_size_t dn_successors;
214345153Sdim  offset_and_size_t dn_task;
215345153Sdim  offset_and_size_t dn_npredecessors;
216345153Sdim  offset_and_size_t dn_nrefs;
217345153Sdim  offset_and_size_t dn_routine;
218345153Sdim
219345153Sdim  /* kmp_thread_data_t */
220345153Sdim  kmp_int32 hd_sizeof_struct;
221345153Sdim  offset_and_size_t hd_deque;
222345153Sdim  offset_and_size_t hd_deque_size;
223345153Sdim  offset_and_size_t hd_deque_head;
224345153Sdim  offset_and_size_t hd_deque_tail;
225345153Sdim  offset_and_size_t hd_deque_ntasks;
226345153Sdim  offset_and_size_t hd_deque_last_stolen;
227345153Sdim
228345153Sdim  // The last field of stable version.
229345153Sdim  kmp_uint64 last_field;
230345153Sdim
231345153Sdim} kmp_omp_struct_info_t;
232345153Sdim
233345153Sdim#endif /* USE_DEBUGGER */
234345153Sdim
235345153Sdim/* end of file */
236