summaryrefslogtreecommitdiffstats
path: root/openmp/libomptarget/src
diff options
context:
space:
mode:
authorSergey Dmitriev <serguei.n.dmitriev@intel.com>2017-08-14 15:09:59 +0000
committerSergey Dmitriev <serguei.n.dmitriev@intel.com>2017-08-14 15:09:59 +0000
commitb305d26b57623a54ddd0ce3f534f416b67c9abed (patch)
tree2b3e90e415d2e8672554282459df75fd82499da5 /openmp/libomptarget/src
parent3c595a6b2c58a23c42a6270bddca8ae99108b5be (diff)
downloadbcm5719-llvm-b305d26b57623a54ddd0ce3f534f416b67c9abed.tar.gz
bcm5719-llvm-b305d26b57623a54ddd0ce3f534f416b67c9abed.zip
[OpenMP] libomptarget: move debugging dumps under control of env var LIBOMPTARGET_DEBUG
Disable default debugging dumps for libomptarget and plugins and move dumps under control of environment variable LIBOMPTARGET_DEBUG=<integer>. Dumps are enabled when LIBOMPTARGET_DEBUG is set to a positive integer value. Debugging dumps are available only in debug build; release build does not support it. Differential Revision: https://reviews.llvm.org/D33227 llvm-svn: 310841
Diffstat (limited to 'openmp/libomptarget/src')
-rw-r--r--openmp/libomptarget/src/omptarget.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index 8edc3f7db22..95e0e1ee2ba 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -27,7 +27,19 @@
// Header file global to this project
#include "omptarget.h"
-#define DP(...) DEBUGP("Libomptarget", __VA_ARGS__)
+#ifdef OMPTARGET_DEBUG
+static int DebugLevel = 0;
+
+#define DP(...) \
+ do { \
+ if (DebugLevel > 0) { \
+ DEBUGP("Libomptarget", __VA_ARGS__); \
+ } \
+ } while (false)
+#else // OMPTARGET_DEBUG
+#define DP(...) {}
+#endif // OMPTARGET_DEBUG
+
#define INF_REF_CNT (LONG_MAX>>1) // leave room for additions/subtractions
#define CONSIDERED_INF(x) (x > (INF_REF_CNT>>1))
@@ -281,6 +293,12 @@ public:
};
void RTLsTy::LoadRTLs() {
+#ifdef OMPTARGET_DEBUG
+ if (char *envStr = getenv("LIBOMPTARGET_DEBUG")) {
+ DebugLevel = std::stoi(envStr);
+ }
+#endif // OMPTARGET_DEBUG
+
// Parse environment variable OMP_TARGET_OFFLOAD (if set)
char *envStr = getenv("OMP_TARGET_OFFLOAD");
if (envStr && !strcmp(envStr, "DISABLED")) {
OpenPOWER on IntegriCloud