For PR780:
authorReid Spencer <rspencer@reidspencer.com>
Wed, 26 Jul 2006 16:18:00 +0000 (16:18 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Wed, 26 Jul 2006 16:18:00 +0000 (16:18 +0000)
1. Move IncludeFile.h to System library
2. Move IncludeFile.cpp to System library
3. #1 and #2 required to prevent cyclic library dependencies for libSystem
4. Convert all existing uses of Support/IncludeFile.h to System/IncludeFile.h
5. Add IncludeFile support to various lib/System classes.
6. Add new lib/System classes to LinkAllVMCore.h
All this in an attempt to pull in lib/System to what's required for VMCore

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

23 files changed:
include/llvm/Analysis/AliasAnalysis.h
include/llvm/InlineAsm.h
include/llvm/IntrinsicInst.h
include/llvm/LinkAllVMCore.h
include/llvm/PassSupport.h
include/llvm/Support/Dwarf.h
include/llvm/Support/IncludeFile.h [deleted file]
include/llvm/Support/Mangler.h
include/llvm/Support/MathExtras.h
include/llvm/Support/SlowOperationInformer.h
include/llvm/System/IncludeFile.h
include/llvm/System/Memory.h
include/llvm/System/Mutex.h
lib/CodeGen/SelectionDAG/Makefile
lib/Support/Dwarf.cpp
lib/Support/IncludeFile.cpp [deleted file]
lib/Support/IsInf.cpp
lib/Support/IsNAN.cpp
lib/Support/SlowOperationInformer.cpp
lib/System/IncludeFile.cpp
lib/System/Memory.cpp
lib/System/Mutex.cpp
lib/VMCore/Verifier.cpp

index 2fff77420aeb5b29f7521ea0ef1b198cc4ff6521..66f60ab547db8162144b75511be3e91ab47834ad 100644 (file)
@@ -31,7 +31,7 @@
 #define LLVM_ANALYSIS_ALIAS_ANALYSIS_H
 
 #include "llvm/Support/CallSite.h"
-#include "llvm/Support/IncludeFile.h"
+#include "llvm/System/IncludeFile.h"
 
 namespace llvm {
 
index 6e7aab1cb03c68ef56b11ef8e6c4ec603114cec5..b9f707cf83cbebd1d7e0ded73deb9b213deb5f6d 100644 (file)
@@ -17,7 +17,7 @@
 #define LLVM_INLINEASM_H
 
 #include "llvm/Value.h"
-#include "llvm/Support/IncludeFile.h"
+#include "llvm/System/IncludeFile.h"
 #include <vector>
 
 namespace llvm {
index 5b784fc2b90fec7df943e60f71f5a30c3125b476..996c83cb8ef3ed4ef5010d76173d887bfad411fd 100644 (file)
@@ -28,7 +28,7 @@
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
-#include "llvm/Support/IncludeFile.h"
+#include "llvm/System/IncludeFile.h"
 
 namespace llvm {
   /// IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic
index d0366ebe1e1ac40afe5aea520031663daa87e31c..fa46dbb1f1190eb24ec7e671e859861eae483c87 100644 (file)
 #ifndef LLVM_LINKALLVMCORE_H
 #define LLVM_LINKALLVMCORE_H
 
-#include "llvm/Support/IncludeFile.h"
-#include "llvm/Support/Mangler.h"
+#include "llvm/System/IncludeFile.h"
+
 #include "llvm/Module.h"
 #include "llvm/Instructions.h"
 #include "llvm/IntrinsicInst.h"
 #include "llvm/InlineAsm.h"
 #include "llvm/Analysis/Verifier.h"
+#include "llvm/System/Memory.h"
+#include "llvm/System/Mutex.h"
+#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/Mangler.h"
+#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/SlowOperationInformer.h"
 
 namespace {
   struct ForceVMCoreLinking {
index 57dcce7950660d41b6c643746da1091c72439a0d..9350e284fcf84ba359a4eedae74d34e5778aa01e 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef LLVM_PASS_SUPPORT_H
 #define LLVM_PASS_SUPPORT_H
 
-#include "llvm/Support/IncludeFile.h"
+#include "llvm/System/IncludeFile.h"
 // No need to include Pass.h, we are being included by it!
 
 namespace llvm {
index 17622f4515810705f572547257221e4d9b95466e..05260be2d7cbde9b790439d88462c4c671bd9106 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef LLVM_SUPPORT_DWARF_H
 #define LLVM_SUPPORT_DWARF_H
 
+#include "llvm/System/IncludeFile.h"
+
 namespace llvm {
 
 namespace dwarf {
@@ -546,4 +548,6 @@ const char *CallFrameString(unsigned Encoding);
 
 } // End of namespace llvm
 
+FORCE_DEFINING_FILE_TO_BE_LINKED(SupportDwarf)
+
 #endif
diff --git a/include/llvm/Support/IncludeFile.h b/include/llvm/Support/IncludeFile.h
deleted file mode 100644 (file)
index 798c6b4..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-//===- llvm/Support/IncludeFile.h - Ensure Linking Of Library ---*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file was developed by Reid Spencer and is distributed under the 
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the FORCE_DEFINING_FILE_TO_BE_LINKED and DEFINE_FILE_FOR
-// macros.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_INCLUDEFILE_H
-#define LLVM_SUPPORT_INCLUDEFILE_H
-
-/// This macro is the public interface that IncludeFile.h exports. This gives
-/// us the option to implement the "link the definition" capability in any 
-/// manner that we choose. All header files that depend on a specific .cpp
-/// file being linked at run time should use this macro instead of the
-/// IncludeFile class directly. 
-/// 
-/// For example, foo.h would use:<br/>
-/// <tt>FORCE_DEFINING_FILE_TO_BE_LINKED(foo)</tt><br/>
-/// 
-/// And, foo.cp would use:<br/>
-/// <tt>DEFINING_FILE_FOR(foo)</tt><br/>
-#define FORCE_DEFINING_FILE_TO_BE_LINKED(name) \
-  namespace llvm { \
-    extern char name ## LinkVar; \
-    static IncludeFile name ## LinkObj ( &name ## LinkVar ); \
-  } 
-
-/// This macro is the counterpart to FORCE_DEFINING_FILE_TO_BE_LINKED. It should
-/// be used in a .cpp file to define the name referenced in a header file that
-/// will cause linkage of the .cpp file. It should only be used at extern level.
-#define DEFINING_FILE_FOR(name) namespace llvm { char name ## LinkVar; }
-
-namespace llvm {
-
-/// This class is used in the implementation of FORCE_DEFINING_FILE_TO_BE_LINKED
-/// macro to make sure that the implementation of a header file is included 
-/// into a tool that uses the header.  This is solely 
-/// to overcome problems linking .a files and not getting the implementation 
-/// of compilation units we need. This is commonly an issue with the various
-/// Passes but also occurs elsewhere in LLVM. We like to use .a files because
-/// they link faster and provide the smallest executables. However, sometimes
-/// those executables are too small, if the program doesn't reference something
-/// that might be needed, especially by a loaded share object. This little class
-/// helps to resolve that problem. The basic strategy is to use this class in
-/// a header file and pass the address of a variable to the constructor. If the
-/// variable is defined in the header file's corresponding .cpp file then all
-/// tools/libraries that #include the header file will require the .cpp as well.
-/// For example:<br/>
-/// <tt>extern int LinkMyCodeStub;</tt><br/>
-/// <tt>static IncludeFile LinkMyModule(&LinkMyCodeStub);</tt><br/>
-/// @brief Class to ensure linking of corresponding object file.
-struct IncludeFile {
-  IncludeFile(void *);
-};
-
-}
-
-#endif
index 50e49ff8a55b2f036dac3a10aec063b867d01219..ac7deadf8bdca26723187ff1be65e2f4f2296d0a 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef LLVM_SUPPORT_MANGLER_H
 #define LLVM_SUPPORT_MANGLER_H
 
-#include "llvm/Support/IncludeFile.h"
+#include "llvm/System/IncludeFile.h"
 #include <map>
 #include <set>
 #include <string>
index 0f5961ff739e065bcf554144db861a5ea6dae9d1..228d35ceff522f1b00541fc90eb8b34a868f287b 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_SUPPORT_MATHEXTRAS_H
 
 #include "llvm/Support/DataTypes.h"
+#include "llvm/System/IncludeFile.h"
 
 namespace llvm {
 
@@ -306,4 +307,7 @@ int IsInf (double d);
 
 } // End llvm namespace
 
+FORCE_DEFINING_FILE_TO_BE_LINKED(SupportIsInf)
+FORCE_DEFINING_FILE_TO_BE_LINKED(SupportIsNAN)
+
 #endif
index d05792672ac8b7d1bcefafb1326562cba451ff51..0be01960caf34e7767aebb077e23e62b405e26d5 100644 (file)
@@ -32,6 +32,7 @@
 #include <string>
 #include <cassert>
 #include "llvm/Support/DataTypes.h"
+#include "llvm/System/IncludeFile.h"
 
 namespace llvm {
   class SlowOperationInformer {
@@ -63,3 +64,5 @@ namespace llvm {
 } // end namespace llvm
 
 #endif /* SLOW_OPERATION_INFORMER_H */
+
+FORCE_DEFINING_FILE_TO_BE_LINKED(SupportSlowOperationInformer)
index 798c6b454fc9dfe7a49ee5e37c8ebec985966ed8..c9f388235977d98bafe774694f979c8938a00b5d 100644 (file)
@@ -1,4 +1,4 @@
-//===- llvm/Support/IncludeFile.h - Ensure Linking Of Library ---*- C++ -*-===//
+//===- llvm/System/IncludeFile.h - Ensure Linking Of Library ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_SUPPORT_INCLUDEFILE_H
-#define LLVM_SUPPORT_INCLUDEFILE_H
+#ifndef LLVM_SYSTEM_INCLUDEFILE_H
+#define LLVM_SYSTEM_INCLUDEFILE_H
 
 /// This macro is the public interface that IncludeFile.h exports. This gives
 /// us the option to implement the "link the definition" capability in any 
index 27d7c0cb5c0434ffbe72d00a63dfd92e9a526ce8..c343177e17864e81793d66909e359470a3ac1469 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_SYSTEM_MEMORY_H
 
 #include <string>
+#include "llvm/System/IncludeFile.h"
 
 namespace llvm {
 namespace sys {
@@ -70,4 +71,6 @@ namespace sys {
 }
 }
 
+FORCE_DEFINING_FILE_TO_BE_LINKED(SystemMemory)
+
 #endif
index 94dd8113781e40a057e2c7dee790bf0077da7717..27bcea18d344de42f097cec24895a52efd2eafa5 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef LLVM_SYSTEM_MUTEX_H
 #define LLVM_SYSTEM_MUTEX_H
 
+#include "llvm/System/IncludeFile.h"
+
 namespace llvm
 {
   namespace sys
@@ -81,4 +83,6 @@ namespace llvm
   }
 }
 
+FORCE_DEFINING_FILE_TO_BE_LINKED(SystemMutex)
+
 #endif
index 306a6caad5d696e720232587ffacb51768a61856..6c502886c5fd83a09c2e08905e31d4ff4f5b186d 100644 (file)
@@ -10,5 +10,6 @@ LEVEL = ../../..
 LIBRARYNAME = LLVMSelectionDAG
 PARALLEL_DIRS =
 BUILD_ARCHIVE = 1
+DONT_BUILD_RELINKED = 1
 
 include $(LEVEL)/Makefile.common
index 409eadd560744516328a86220f2d650860082f2b..35862e843929580f7a1d9f64115f4beab302836d 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Dwarf.h"
+#include "llvm/System/IncludeFile.h"
 
 #include <cassert>
 
@@ -580,3 +581,5 @@ const char *CallFrameString(unsigned Encoding) {
 } // End of namespace dwarf.
 
 } // End of namespace llvm.
+
+DEFINING_FILE_FOR(SupportDwarf)
diff --git a/lib/Support/IncludeFile.cpp b/lib/Support/IncludeFile.cpp
deleted file mode 100644 (file)
index d472917..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-//===- lib/Support/IncludeFile.cpp - Ensure Linking Of Implementation -----===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file was developed by Reid Spencer and is distributed under the 
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the IncludeFile constructor.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/IncludeFile.h"
-
-using namespace llvm;
-
-// This constructor is used to ensure linking of other modules. See the
-// llvm/Support/IncludeFile.h header for details. 
-IncludeFile::IncludeFile(void*) {}
index 39c11cd7a666e27728d99a890a1a476ecc4a4a87..9b0556fcb09f42d218b0d175e2f308dae9385bc5 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Config/config.h"
+#include "llvm/System/IncludeFile.h"
 
 #if HAVE_ISINF_IN_MATH_H
 # include <math.h>
@@ -43,3 +44,5 @@ int IsInf (float f)  { return isinf (f); }
 int IsInf (double d) { return isinf (d); }
 
 } // end namespace llvm;
+
+DEFINING_FILE_FOR(SupportIsInf)
index 2ed2b284c7d19623f6a8fb31a170d40d6d37438c..5ed3971254bb374e7f9ef4152c8b94a810c7e326 100644 (file)
@@ -12,6 +12,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Config/config.h"
+#include "llvm/System/IncludeFile.h"
+
 #if HAVE_ISNAN_IN_MATH_H
 # include <math.h>
 #elif HAVE_ISNAN_IN_CMATH
@@ -32,3 +34,5 @@ int IsNAN (float f)  { return isnan (f); }
 int IsNAN (double d) { return isnan (d); }
 
 } // end namespace llvm;
+
+DEFINING_FILE_FOR(SupportIsNAN)
index bfdfe8808f46f62937dd2e8cca970606f8993727..c5f271870118a331e7d71e7379c459ee3725b8db 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/SlowOperationInformer.h"
+#include "llvm/System/IncludeFile.h"
 #include "llvm/System/Alarm.h"
 #include <iostream>
 #include <sstream>
@@ -64,3 +65,5 @@ bool SlowOperationInformer::progress(unsigned Amount) {
   std::cout << ToPrint+OS.str() << std::flush;
   return false;
 }
+
+DEFINING_FILE_FOR(SupportSlowOperationInformer)
index d4729176f41732d5ef15c5379d4e4b4f72204fcb..2ba9595ea18bdbc9491daca359599e0fd22124b3 100644 (file)
@@ -1,4 +1,4 @@
-//===- lib/Support/IncludeFile.cpp - Ensure Linking Of Implementation -----===//
+//===- lib/System/IncludeFile.cpp - Ensure Linking Of Implementation -----===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/IncludeFile.h"
+#include "llvm/System/IncludeFile.h"
 
 using namespace llvm;
 
 // This constructor is used to ensure linking of other modules. See the
-// llvm/Support/IncludeFile.h header for details. 
+// llvm/System/IncludeFile.h header for details. 
 IncludeFile::IncludeFile(void*) {}
index e951e3c26a1614cf1c30a9ec28b71e937658524d..3788abef08afc1516ddf9fb583242d8b8412cc91 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "llvm/System/Memory.h"
 #include "llvm/Config/config.h"
+#include "llvm/System/IncludeFile.h"
 
 namespace llvm {
 using namespace sys;
@@ -33,3 +34,4 @@ using namespace sys;
 #include "Win32/Memory.inc"
 #endif
 
+DEFINING_FILE_FOR(SystemMemory)
index abcf77e67511f82ea5f39145381061f338a73d0e..44e3332d1791477464cd8f28071b87c01ed2ab3b 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "llvm/Config/config.h"
 #include "llvm/System/Mutex.h"
+#include "llvm/System/IncludeFile.h"
 
 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only TRULY operating system
@@ -157,3 +158,5 @@ Mutex::tryacquire()
 #warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in System/Mutex.cpp
 #endif
 #endif
+
+DEFINING_FILE_FOR(SystemMutex)
index 635f5a25edf849a0538cd52c4e9cc22a43cd1f38..3dac3f1a74fa6a04de6a2c82d0b4b1fd5898c6b7 100644 (file)
@@ -105,7 +105,7 @@ namespace {  // Anonymous namespace for class
       // returning back to the pass manager, or else the pass manager may try to
       // run other passes on the broken module.
       if (RealPass)
-        abortIfBroken();
+        return abortIfBroken();
       return false;
     }
 
@@ -119,7 +119,7 @@ namespace {  // Anonymous namespace for class
       // returning back to the pass manager, or else the pass manager may try to
       // run other passes on the broken module.
       if (RealPass)
-        abortIfBroken();
+        return abortIfBroken();
 
       return false;
     }
@@ -138,8 +138,7 @@ namespace {  // Anonymous namespace for class
         visitGlobalVariable(*I);
 
       // If the module is broken, abort at this time.
-      abortIfBroken();
-      return false;
+      return abortIfBroken();
     }
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -151,7 +150,7 @@ namespace {  // Anonymous namespace for class
     /// abortIfBroken - If the module is broken and we are supposed to abort on
     /// this condition, do so.
     ///
-    void abortIfBroken() {
+    bool abortIfBroken() {
       if (Broken) {
         msgs << "Broken module found, ";
         switch (action) {
@@ -162,11 +161,13 @@ namespace {  // Anonymous namespace for class
           case PrintMessageAction:
             msgs << "verification continues.\n";
             std::cerr << msgs.str();
-            break;
+            return false;
           case ReturnStatusAction:
-            break;
+            msgs << "compilation terminated.\n";
+            return Broken;
         }
       }
+      return false;
     }