Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: src/IceBuildDefs.h

Issue 1197863003: Subzero: Reduce the amount of #ifdef'd code. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceAssemblerX8632.cpp ('k') | src/IceCfg.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceBuildDefs.h
diff --git a/src/IceBuildDefs.h b/src/IceBuildDefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..6af41f1d2e3ab2f3d8da282a8871ade39135d77b
--- /dev/null
+++ b/src/IceBuildDefs.h
@@ -0,0 +1,50 @@
+//===- subzero/src/IceBuildDefs.h - Translator build defines ----*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines constexpr functions to query various #define values.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_ICEBUILDDEFS_H
+#define SUBZERO_SRC_ICEBUILDDEFS_H
+
+namespace Ice {
+namespace BuildDefs {
+
+// The ALLOW_* etc. symbols must be #defined to zero or non-zero.
+constexpr bool disableIrGen() { return ALLOW_DISABLE_IR_GEN; }
+constexpr bool dump() { return ALLOW_DUMP; }
+constexpr bool llvmCl() { return ALLOW_LLVM_CL; }
+constexpr bool llvmIr() { return ALLOW_LLVM_IR; }
+constexpr bool llvmIrAsInput() { return ALLOW_LLVM_IR_AS_INPUT; }
+constexpr bool minimal() { return ALLOW_MINIMAL_BUILD; }
+constexpr bool textualBitcode() { return INPUT_IS_TEXTUAL_BITCODE; }
+
+// NDEBUG can be undefined, or defined to something arbitrary.
+constexpr bool asserts() {
+#ifdef NDEBUG
+ return false;
+#else // !NDEBUG
+ return true;
+#endif // !NDEBUG
+}
+
+// ALLOW_EXTRA_VALIDATION can be undefined, or defined to something non-zero.
+constexpr bool extraValidation() {
+#if ALLOW_EXTRA_VALIDATION
+ return true;
+#else // !ALLOW_EXTRA_VALIDATION
+ return false;
+#endif // !ALLOW_EXTRA_VALIDATION
+}
+
+} // end of namespace BuildDefs
+} // end of namespace Ice
+
+#endif // SUBZERO_SRC_ICEBUILDDEFS_H
« no previous file with comments | « src/IceAssemblerX8632.cpp ('k') | src/IceCfg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698