blob: 71600d403d864f9f7f11f929ad9d3c275c3388af [file] [log] [blame]
Jim Stichnoth20b71f52015-06-24 15:52:24 -07001//===- subzero/src/IceBuildDefs.h - Translator build defines ----*- C++ -*-===//
2//
3// The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Andrew Scull9612d322015-07-06 14:53:25 -07009///
10/// \file
11/// This file defines constexpr functions to query various #define values.
12///
Jim Stichnoth20b71f52015-06-24 15:52:24 -070013//===----------------------------------------------------------------------===//
14
15#ifndef SUBZERO_SRC_ICEBUILDDEFS_H
16#define SUBZERO_SRC_ICEBUILDDEFS_H
17
18namespace Ice {
19namespace BuildDefs {
20
21// The ALLOW_* etc. symbols must be #defined to zero or non-zero.
22constexpr bool disableIrGen() { return ALLOW_DISABLE_IR_GEN; }
23constexpr bool dump() { return ALLOW_DUMP; }
24constexpr bool llvmCl() { return ALLOW_LLVM_CL; }
25constexpr bool llvmIr() { return ALLOW_LLVM_IR; }
26constexpr bool llvmIrAsInput() { return ALLOW_LLVM_IR_AS_INPUT; }
27constexpr bool minimal() { return ALLOW_MINIMAL_BUILD; }
Jim Stichnoth20b71f52015-06-24 15:52:24 -070028
29// NDEBUG can be undefined, or defined to something arbitrary.
30constexpr bool asserts() {
31#ifdef NDEBUG
32 return false;
33#else // !NDEBUG
34 return true;
35#endif // !NDEBUG
36}
37
38// ALLOW_EXTRA_VALIDATION can be undefined, or defined to something non-zero.
39constexpr bool extraValidation() {
40#if ALLOW_EXTRA_VALIDATION
41 return true;
42#else // !ALLOW_EXTRA_VALIDATION
43 return false;
44#endif // !ALLOW_EXTRA_VALIDATION
45}
46
47} // end of namespace BuildDefs
48} // end of namespace Ice
49
50#endif // SUBZERO_SRC_ICEBUILDDEFS_H