]> granicus.if.org Git - llvm/commitdiff
Cleanup some problems with LLVM_ENABLE_DUMP in release builds, and
authorDon Hinton <hintonda@gmail.com>
Wed, 27 Sep 2017 21:19:56 +0000 (21:19 +0000)
committerDon Hinton <hintonda@gmail.com>
Wed, 27 Sep 2017 21:19:56 +0000 (21:19 +0000)
always set LLVM_ENABLE_DUMP=ON for +Asserts builds.

Differential Revision: https://reviews.llvm.org/D38306

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314346 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
cmake/modules/HandleLLVMOptions.cmake
include/llvm/CodeGen/MachineRegisterInfo.h
include/llvm/CodeGen/MachineScheduler.h
include/llvm/CodeGen/TargetSchedule.h
include/llvm/Config/config.h.cmake
include/llvm/MC/MCSchedule.h
lib/CodeGen/LiveDebugVariables.cpp
lib/CodeGen/ScoreboardHazardRecognizer.cpp
utils/TableGen/SubtargetEmitter.cpp

index b5454499df3828d567e41690bbb08337f6f843e1..410c6afa17e9ddd03452ee75f0fb24405d49ebf3 100644 (file)
@@ -388,15 +388,19 @@ option(LLVM_ENABLE_LLD "Use lld as C and C++ linker." OFF)
 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 
+option(LLVM_ENABLE_DUMP "Enable dump functions in release builds" OFF)
+
 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
 else()
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
 endif()
 
-option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
+if( LLVM_ENABLE_ASSERTIONS )
+  set(LLVM_ENABLE_DUMP ON)
+endif()
 
-option(LLVM_ENABLE_DUMP "Enable dump functions in release builds" OFF)
+option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
 
 set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING
   "Enable abi-breaking checks.  Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF.")
index bd5e8989596a1bf5d5b2d3a6f8423d01f1d510a6..76683c351d8123cde3d494fc78adf9b36ad24d65 100644 (file)
@@ -84,10 +84,6 @@ if(LLVM_ENABLE_EXPENSIVE_CHECKS)
   add_definitions(-D_GLIBCXX_DEBUG)
 endif()
 
-if(LLVM_ENABLE_DUMP)
-  add_definitions(-DLLVM_ENABLE_DUMP)
-endif()
-
 string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS)
 
 if( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "WITH_ASSERTS" )
index 5ef0ac90e3c2a758352f7b2bc80c0f7a76a87b89..74fd81c14395026a731f20a9243f2f342b13940b 100644 (file)
@@ -575,9 +575,7 @@ public:
   /// preserve conservative kill flag information.
   void clearKillFlags(unsigned Reg) const;
 
-#ifndef NDEBUG
   void dumpUses(unsigned RegNo) const;
-#endif
 
   /// Returns true if PhysReg is unallocatable and constant throughout the
   /// function. Writing to a constant register has no effect.
index c983d6ccf2cd4cd443601ddd47f047a2acbe07bb..e327881de13aac598839bc9a735b0a9f5fe3e325 100644 (file)
@@ -776,9 +776,7 @@ public:
   /// available instruction, or NULL if there are multiple candidates.
   SUnit *pickOnlyChoice();
 
-#ifndef NDEBUG
   void dumpScheduledState() const;
-#endif
 };
 
 /// Base class for GenericScheduler. This class maintains information about
index f236679764688c7797b3ec6e39afb0b732fdfc8e..733693e1b584dfb67b61df46a99e5b8e25a63544 100644 (file)
@@ -116,7 +116,7 @@ public:
     return SchedModel.getProcResource(PIdx);
   }
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   const char *getResourceName(unsigned PIdx) const {
     if (!PIdx)
       return "MOps";
index 4163d7d9c440af5c50117592759d56365d51d0b1..d0d1e0985ccae7ea42019bd5dedc703b80bc4e07 100644 (file)
 /* Has gcc/MSVC atomic intrinsics */
 #cmakedefine01 LLVM_HAS_ATOMICS
 
+/* Define if LLVM_ENABLE_DUMP is enabled */
+#cmakedefine LLVM_ENABLE_DUMP
+
 /* Host triple LLVM will be executed on */
 #cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
 
index 37728797f626abe34ee836aaf93df25039949b38..a79afe163e6c1ba2bdb57d654b8f36ec6a5895ac 100644 (file)
@@ -24,7 +24,7 @@ struct InstrItinerary;
 
 /// Define a kind of processor resource that will be modeled by the scheduler.
 struct MCProcResourceDesc {
-#ifndef NDEBUG
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   const char *Name;
 #endif
   unsigned NumUnits; // Number of resource of this kind
@@ -102,7 +102,7 @@ struct MCSchedClassDesc {
   static const unsigned short InvalidNumMicroOps = UINT16_MAX;
   static const unsigned short VariantNumMicroOps = UINT16_MAX - 1;
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   const char* Name;
 #endif
   unsigned short NumMicroOps;
index 37ff30a92a0498619fd943e034a3d70afdf9dfa0..9a82e3c42ddd48e0f5db231a0070270e17fb8877 100644 (file)
@@ -355,7 +355,7 @@ public:
 
 } // end anonymous namespace
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
 static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS,
                           const LLVMContext &Ctx) {
   if (!DL)
index b3d83d5313aff75bce8fb7c9aa0ae7601fbf9ae4..e2cb8cad6e18f9d9a147e64482ed96f52157b88b 100644 (file)
@@ -32,6 +32,7 @@ ScoreboardHazardRecognizer::ScoreboardHazardRecognizer(
     const char *ParentDebugType)
     : ScheduleHazardRecognizer(), DebugType(ParentDebugType), ItinData(II),
       DAG(SchedDAG) {
+  (void)DebugType;
   // Determine the maximum depth of any itinerary. This determines the depth of
   // the scoreboard. We always make the scoreboard at least 1 cycle deep to
   // avoid dealing with the boundary condition.
index cc46481a8133e4772460493a78cc3242a2a0c7dc..4cb941cfecceb6db63a0e48c7fff852b928eda2b 100644 (file)
@@ -1237,7 +1237,7 @@ void SubtargetEmitter::EmitSchedModel(raw_ostream &OS) {
   OS << "#ifdef DBGFIELD\n"
      << "#error \"<target>GenSubtargetInfo.inc requires a DBGFIELD macro\"\n"
      << "#endif\n"
-     << "#ifndef NDEBUG\n"
+     << "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)\n"
      << "#define DBGFIELD(x) x,\n"
      << "#else\n"
      << "#define DBGFIELD(x)\n"