forked from OSchip/llvm-project
[OpenMP][OMPD] Implementation of OMPD debugging library - libompd.
This is a continuation of the review: https://reviews.llvm.org/D100183 It contains routines that retrieve OpenMP ICV values for OMPD. Reviewed By: @hbae Differential Revision: https://reviews.llvm.org/D100184
This commit is contained in:
parent
560221ac7f
commit
b0277bef97
|
@ -11,7 +11,7 @@
|
|||
project (libompd)
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
|
||||
add_library (ompd SHARED TargetValue.cpp omp-debug.cpp)
|
||||
add_library (ompd SHARED TargetValue.cpp omp-debug.cpp omp-state.cpp omp-icv.cpp)
|
||||
|
||||
add_dependencies(ompd omp) # ensure generated import library is created first
|
||||
|
||||
|
@ -38,9 +38,6 @@ if(${LIBOMPD_LD_STD_FLAGS})
|
|||
endif()
|
||||
endif()
|
||||
|
||||
#TODO: Required temporarily for lib to build as during patch submission.
|
||||
#when lld used, it expects every symbol to be defined, whereas a few function defined as a part of the next patch
|
||||
string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
include_directories (
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${LIBOMP_INCLUDE_DIR}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* omp-state.cpp -- OMPD states
|
||||
*/
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "omp-debug.h"
|
||||
#include "ompd-private.h"
|
||||
#include <cstring>
|
||||
|
||||
void __ompd_init_states(const ompd_callbacks_t *table) { callbacks = table; }
|
||||
|
||||
static const char *get_ompd_state_name(ompd_word_t state) {
|
||||
switch (state) {
|
||||
#define ompd_state_macro(state, code) \
|
||||
case code: \
|
||||
return #state;
|
||||
FOREACH_OMPD_STATE(ompd_state_macro)
|
||||
#undef ompd_state_macro
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ompd_rc_t
|
||||
ompd_enumerate_states(ompd_address_space_handle_t *address_space_handle,
|
||||
ompd_word_t current_state, ompd_word_t *next_state,
|
||||
const char **next_state_name, ompd_word_t *more_enums) {
|
||||
ompd_rc_t ret;
|
||||
if (current_state > ompt_state_undefined &&
|
||||
current_state >= OMPD_LAST_OMP_STATE) {
|
||||
return ompd_rc_bad_input;
|
||||
}
|
||||
const char *find_next_state_name;
|
||||
*next_state = (current_state == ompt_state_undefined ? ompt_state_work_serial
|
||||
: current_state + 1);
|
||||
while (!(find_next_state_name = get_ompd_state_name(*next_state))) {
|
||||
++(*next_state);
|
||||
}
|
||||
|
||||
char *next_state_name_cpy;
|
||||
ret = callbacks->alloc_memory(strlen(find_next_state_name) + 1,
|
||||
(void **)&next_state_name_cpy);
|
||||
if (ret != ompd_rc_ok) {
|
||||
return ret;
|
||||
}
|
||||
strcpy(next_state_name_cpy, find_next_state_name);
|
||||
|
||||
*next_state_name = next_state_name_cpy;
|
||||
|
||||
if (*next_state == OMPD_LAST_OMP_STATE) {
|
||||
*more_enums = 0;
|
||||
} else {
|
||||
*more_enums = 1;
|
||||
}
|
||||
|
||||
return ompd_rc_ok;
|
||||
}
|
Loading…
Reference in New Issue