diff options
author | Martin Storsjö <martin@martin.st> | 2020-11-26 10:09:32 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2020-11-26 10:09:32 +0200 |
commit | 6b429668ded1aa7de4d586fc6dc8a469799b4d9c (patch) | |
tree | 0ca44879f87a3811c074cb7fef5830db327f4b62 | |
parent | dde0fcd7a7da4066c18ab5e73e0477e856da158f (diff) | |
download | llvm-6b429668ded1aa7de4d586fc6dc8a469799b4d9c.zip llvm-6b429668ded1aa7de4d586fc6dc8a469799b4d9c.tar.gz llvm-6b429668ded1aa7de4d586fc6dc8a469799b4d9c.tar.bz2 |
[OpenMP][OMPT] Fix building with OMPT disabled after 6d3b81664a4b79
-rw-r--r-- | openmp/runtime/src/ompt-specific.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h index 49aa645..18816e7 100644 --- a/openmp/runtime/src/ompt-specific.h +++ b/openmp/runtime/src/ompt-specific.h @@ -109,6 +109,26 @@ inline void ompt_set_thread_state(kmp_info_t *thread, ompt_state_t state) { inline const char *ompt_get_runtime_version() { return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN]; } + +class OmptReturnAddressGuard { +private: + bool SetAddress{false}; + int Gtid; + +public: + OmptReturnAddressGuard(int Gtid, void *ReturnAddress) : Gtid(Gtid) { + if (ompt_enabled.enabled && Gtid >= 0 && __kmp_threads[Gtid] && + !__kmp_threads[Gtid]->th.ompt_thread_info.return_address) { + SetAddress = true; + __kmp_threads[Gtid]->th.ompt_thread_info.return_address = ReturnAddress; + } + } + ~OmptReturnAddressGuard() { + if (SetAddress) + __kmp_threads[Gtid]->th.ompt_thread_info.return_address = NULL; + } +}; + #endif // OMPT_SUPPORT // macros providing the OMPT callbacks for reduction clause @@ -135,23 +155,4 @@ inline const char *ompt_get_runtime_version() { #define OMPT_REDUCTION_END #endif // ! OMPT_SUPPORT && OMPT_OPTIONAL -class OmptReturnAddressGuard { -private: - bool SetAddress{false}; - int Gtid; - -public: - OmptReturnAddressGuard(int Gtid, void *ReturnAddress) : Gtid(Gtid) { - if (ompt_enabled.enabled && Gtid >= 0 && __kmp_threads[Gtid] && - !__kmp_threads[Gtid]->th.ompt_thread_info.return_address) { - SetAddress = true; - __kmp_threads[Gtid]->th.ompt_thread_info.return_address = ReturnAddress; - } - } - ~OmptReturnAddressGuard() { - if (SetAddress) - __kmp_threads[Gtid]->th.ompt_thread_info.return_address = NULL; - } -}; - #endif |