xref: /llvm-project/polly/include/polly/Support/PollyDebug.h (revision 601d7eab0665ba298d81952da11593124fd893a0)
1 //===-PollyDebug.h -Provide support for debugging Polly passes-*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Functions to aid printing Debug Info of all polly passes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef POLLY_DEBUG_H
14 #define POLLY_DEBUG_H
15 
16 #include "llvm/Support/Debug.h"
17 
18 namespace polly {
19 using namespace llvm;
20 bool getPollyDebugFlag();
21 
22 #ifndef NDEBUG
23 #define POLLY_DEBUG(X)                                                         \
24   do {                                                                         \
25     if (polly::getPollyDebugFlag()) {                                          \
26       X;                                                                       \
27     } else {                                                                   \
28       DEBUG_WITH_TYPE(DEBUG_TYPE, X);                                          \
29     }                                                                          \
30   } while (0)
31 #else
32 #define POLLY_DEBUG(X)                                                         \
33   do {                                                                         \
34   } while (false)
35 #endif
36 
37 } // namespace polly
38 #endif
39