[llvm-commits] [llvm] r37945 - in /llvm/trunk: include/llvm/Bitcode/Archive.h include/llvm/System/Path.h lib/Archive/Archive.cpp lib/Archive/ArchiveReader.cpp lib/Archive/ArchiveWriter.cpp lib/Linker/LinkItems.cpp lib/Linker/Linker.cpp lib/System/Path.cpp tools/llvm-ar/llvm-ar.cpp

Gabor Greif ggreif at gmail.com
Fri Jul 6 06:38:18 PDT 2007


Author: ggreif
Date: Fri Jul  6 08:38:17 2007
New Revision: 37945

URL: http://llvm.org/viewvc/llvm-project?rev=37945&view=rev
Log:
eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.

Modified:
    llvm/trunk/include/llvm/Bitcode/Archive.h
    llvm/trunk/include/llvm/System/Path.h
    llvm/trunk/lib/Archive/Archive.cpp
    llvm/trunk/lib/Archive/ArchiveReader.cpp
    llvm/trunk/lib/Archive/ArchiveWriter.cpp
    llvm/trunk/lib/Linker/LinkItems.cpp
    llvm/trunk/lib/Linker/Linker.cpp
    llvm/trunk/lib/System/Path.cpp
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp

Modified: llvm/trunk/include/llvm/Bitcode/Archive.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Archive.h?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Archive.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Archive.h Fri Jul  6 08:38:17 2007
@@ -51,8 +51,7 @@
       SVR4SymbolTableFlag = 2,     ///< Member is a SVR4 symbol table
       BSD4SymbolTableFlag = 4,     ///< Member is a BSD4 symbol table
       LLVMSymbolTableFlag = 8,     ///< Member is an LLVM symbol table
-      BytecodeFlag = 16,           ///< Member is uncompressed bytecode
-      CompressedBytecodeFlag = 32, ///< Member is compressed bytecode
+      BitcodeFlag = 16,            ///< Member is uncompressed bytecode
       HasPathFlag = 64,            ///< Member has a full or partial path
       HasLongFilenameFlag = 128,   ///< Member uses the long filename syntax
       StringTableFlag = 256        ///< Member is an ar(1) format string table
@@ -112,7 +111,6 @@
 
     /// This method determines if the member is a regular compressed file. Note
     /// that compressed bytecode files will yield "false" for this method.
-    /// @see isCompressedBytecode()
     /// @returns true iff the archive member is a compressed regular file.
     /// @brief Determine if the member is a compressed regular file.
     bool isCompressed() const { return flags&CompressedFlag; }
@@ -135,11 +133,7 @@
 
     /// @returns true iff the archive member is an uncompressed bytecode file.
     /// @brief Determine if this member is a bytecode file.
-    bool isBytecode() const { return flags&BytecodeFlag; }
-
-    /// @returns true iff the archive member is a compressed bytecode file.
-    /// @brief Determine if the member is a compressed bytecode file.
-    bool isCompressedBytecode() const { return flags&CompressedBytecodeFlag;}
+    bool isBitcode() const { return flags&BitcodeFlag; }
 
     /// @returns true iff the file name contains a path (directory) component.
     /// @brief Determine if the member has a path

Modified: llvm/trunk/include/llvm/System/Path.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Fri Jul  6 08:38:17 2007
@@ -307,13 +307,6 @@
       bool isArchive() const;
 
       /// This function determines if the path name in the object references an
-      /// LLVM Bytecode file by looking at its magic number.
-      /// @returns true if the file starts with the magic number for LLVM
-      /// bytecode files.
-      /// @brief Determine if the path references a bytecode file.
-      bool isBytecodeFile() const;
-
-      /// This function determines if the path name in the object references an
       /// LLVM Bitcode file by looking at its magic number.
       /// @returns true if the file starts with the magic number for LLVM
       /// bitcode files.
@@ -621,9 +614,7 @@
   /// This enumeration delineates the kinds of files that LLVM knows about.
   enum LLVMFileType {
     Unknown_FileType = 0,              ///< Unrecognized file
-    Bytecode_FileType,                 ///< Uncompressed bytecode file
     Bitcode_FileType,                  ///< Bitcode file
-    CompressedBytecode_FileType,       ///< Compressed bytecode file
     Archive_FileType,                  ///< ar style archive file
     ELF_Relocatable_FileType,          ///< ELF Relocatable object file
     ELF_Executable_FileType,           ///< ELF Executable image

Modified: llvm/trunk/lib/Archive/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/Archive.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/lib/Archive/Archive.cpp (original)
+++ llvm/trunk/lib/Archive/Archive.cpp Fri Jul  6 08:38:17 2007
@@ -126,15 +126,8 @@
 
   // Determine what kind of file it is
   switch (sys::IdentifyFileType(signature,4)) {
-    case sys::Bytecode_FileType:
-      flags |= BytecodeFlag;
-      break;
-    case sys::CompressedBytecode_FileType:
-      flags |= CompressedBytecodeFlag;
-      flags &= ~CompressedFlag;
-      break;
     default:
-      flags &= ~(BytecodeFlag|CompressedBytecodeFlag);
+      flags &= ~BitcodeFlag;
       break;
   }
   return false;

Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/lib/Archive/ArchiveReader.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveReader.cpp Fri Jul  6 08:38:17 2007
@@ -207,16 +207,10 @@
   // Determine if this is a bytecode file
   switch (sys::IdentifyFileType(At, 4)) {
     case sys::Bitcode_FileType:
-    case sys::Bytecode_FileType:
-      flags |= ArchiveMember::BytecodeFlag;
-      break;
-    case sys::CompressedBytecode_FileType:
-      flags |= ArchiveMember::CompressedBytecodeFlag;
-      flags &= ~ArchiveMember::CompressedFlag;
+      flags |= ArchiveMember::BitcodeFlag;
       break;
     default:
-      flags &= ~(ArchiveMember::BytecodeFlag|
-                 ArchiveMember::CompressedBytecodeFlag);
+      flags &= ~ArchiveMember::BitcodeFlag;
       break;
   }
 
@@ -349,7 +343,7 @@
 Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) {
 
   for (iterator I=begin(), E=end(); I != E; ++I) {
-    if (I->isBytecode() || I->isCompressedBytecode()) {
+    if (I->isBitcode()) {
       std::string FullMemberName = archPath.toString() +
         "(" + I->getPath().toString() + ")";
       MemoryBuffer *Buffer =
@@ -535,7 +529,7 @@
         return false;
 
       // If it contains symbols
-      if (mbr->isBytecode() || mbr->isCompressedBytecode()) {
+      if (mbr->isBitcode()) {
         // Get the symbols
         std::vector<std::string> symbols;
         std::string FullMemberName = archPath.toString() + "(" +
@@ -612,7 +606,7 @@
   // Scan the archive, trying to load a bitcode member.  We only load one to
   // see if this works.
   for (iterator I = begin(), E = end(); I != E; ++I) {
-    if (!I->isBytecode() && !I->isCompressedBytecode())
+    if (!I->isBitcode())
       continue;
     
     std::string FullMemberName = 

Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Fri Jul  6 08:38:17 2007
@@ -179,11 +179,7 @@
   mbr->path.getMagicNumber(magic,4);
   switch (sys::IdentifyFileType(magic.c_str(),4)) {
     case sys::Bitcode_FileType:
-    case sys::Bytecode_FileType:
-      flags |= ArchiveMember::BytecodeFlag;
-      break;
-    case sys::CompressedBytecode_FileType:
-      flags |= ArchiveMember::CompressedBytecodeFlag;
+      flags |= ArchiveMember::BitcodeFlag;
       break;
     default:
       break;
@@ -223,8 +219,7 @@
 
   // Now that we have the data in memory, update the
   // symbol table if its a bitcode file.
-  if (CreateSymbolTable &&
-      (member.isBytecode() || member.isCompressedBytecode())) {
+  if (CreateSymbolTable && member.isBitcode()) {
     std::vector<std::string> symbols;
     std::string FullMemberName = archPath.toString() + "(" +
       member.getPath().toString()

Modified: llvm/trunk/lib/Linker/LinkItems.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkItems.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/lib/Linker/LinkItems.cpp (original)
+++ llvm/trunk/lib/Linker/LinkItems.cpp Fri Jul  6 08:38:17 2007
@@ -82,9 +82,7 @@
     case sys::Unknown_FileType:
       return warning("Supposed library '" + Lib + "' isn't a library.");
 
-    case sys::Bytecode_FileType:
     case sys::Bitcode_FileType:
-    case sys::CompressedBytecode_FileType:
       // LLVM ".so" file.
       if (LinkInFile(Pathname, is_native))
         return error("Cannot link file '" + Pathname.toString() + "'");
@@ -176,9 +174,7 @@
         return error("Cannot link archive '" + File.toString() + "'");
       break;
 
-    case sys::Bitcode_FileType:
-    case sys::Bytecode_FileType:
-    case sys::CompressedBytecode_FileType: {
+    case sys::Bitcode_FileType: {
       verbose("Linking bitcode file '" + File.toString() + "'");
       std::auto_ptr<Module> M(LoadObject(File));
       if (M.get() == 0)

Modified: llvm/trunk/lib/Linker/Linker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/Linker.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/lib/Linker/Linker.cpp (original)
+++ llvm/trunk/lib/Linker/Linker.cpp Fri Jul  6 08:38:17 2007
@@ -142,8 +142,6 @@
   FullPath.appendSuffix(&(LTDL_SHLIB_EXT[1]));
   if (FullPath.isDynamicLibrary())  // Native shared library?
     return FullPath;
-  if (FullPath.isBytecodeFile())    // .so file containing bytecode?
-    return FullPath;
   if (FullPath.isBitcodeFile())    // .so file containing bitcode?
     return FullPath;
 

Modified: llvm/trunk/lib/System/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/lib/System/Path.cpp (original)
+++ llvm/trunk/lib/System/Path.cpp Fri Jul  6 08:38:17 2007
@@ -47,14 +47,6 @@
       if (magic[1] == 'C' && magic[2] == (char)0xC0 && magic[3] == (char)0xDE)
         return Bitcode_FileType;
       break;
-    case 'l':
-      if (magic[1] == 'l' && magic[2] == 'v') {
-        if (magic[3] == 'c')
-          return CompressedBytecode_FileType;
-        else if (magic[3] == 'm')
-          return Bytecode_FileType;
-      }
-      break;
     case '!':
       if (length >= 8)
         if (memcmp(magic,"!<arch>\n",8) == 0)
@@ -165,14 +157,6 @@
 }
 
 bool
-Path::isBytecodeFile() const {
-  std::string actualMagic;
-  if (!getMagicNumber(actualMagic, 4))
-    return false;
-  return actualMagic == "llvc" || actualMagic == "llvm";
-}
-
-bool
 Path::isBitcodeFile() const {
   std::string actualMagic;
   if (!getMagicNumber(actualMagic, 4))

Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=37945&r1=37944&r2=37945&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Fri Jul  6 08:38:17 2007
@@ -356,8 +356,7 @@
 
         // Skip things that don't make sense to print
         if (I->isLLVMSymbolTable() || I->isSVR4SymbolTable() ||
-            I->isBSD4SymbolTable() || (!DontSkipBitcode &&
-             (I->isBytecode() || I->isCompressedBytecode())))
+            I->isBSD4SymbolTable() || (!DontSkipBitcode && I->isBitcode()))
           continue;
 
         if (Verbose)
@@ -406,10 +405,8 @@
       if (Verbose) {
         // FIXME: Output should be this format:
         // Zrw-r--r--  500/ 500    525 Nov  8 17:42 2004 Makefile
-        if (I->isBytecode())
+        if (I->isBitcode())
           std::cout << "b";
-        else if (I->isCompressedBytecode())
-          std::cout << "B";
         else if (I->isCompressed())
           std::cout << "Z";
         else





More information about the llvm-commits mailing list