[cfe-commits] r70228 - in /cfe/trunk: include/clang/Frontend/PCHReader.h lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp

Chris Lattner sabre at nondot.org
Mon Apr 27 12:01:47 PDT 2009


Author: lattner
Date: Mon Apr 27 14:01:47 2009
New Revision: 70228

URL: http://llvm.org/viewvc/llvm-project?rev=70228&view=rev
Log:
shrink SOURCE_LOCATION_OFFSETS to use 4-byte entries instead of 8-byte
entries, shaving 100K off the PCH file for cocoa.


Modified:
    cfe/trunk/include/clang/Frontend/PCHReader.h
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/lib/Frontend/PCHWriter.cpp

Modified: cfe/trunk/include/clang/Frontend/PCHReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHReader.h?rev=70228&r1=70227&r2=70228&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHReader.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHReader.h Mon Apr 27 14:01:47 2009
@@ -106,7 +106,7 @@
 
   /// \brief Offset type for all of the source location entries in the
   /// PCH file.
-  const uint64_t *SLocOffsets;
+  const uint32_t *SLocOffsets;
 
   /// \brief The number of source location entries in the PCH file.
   unsigned TotalNumSLocEntries;

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=70228&r1=70227&r2=70228&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Mon Apr 27 14:01:47 2009
@@ -1017,7 +1017,7 @@
       break;
 
     case pch::SOURCE_LOCATION_OFFSETS:
-      SLocOffsets = (const uint64_t *)BlobStart;
+      SLocOffsets = (const uint32_t *)BlobStart;
       TotalNumSLocEntries = Record[0];
       PP.getSourceManager().PreallocateSLocEntries(this, 
                                                    TotalNumSLocEntries, 

Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=70228&r1=70227&r2=70228&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Mon Apr 27 14:01:47 2009
@@ -738,7 +738,7 @@
 
   // Write out the source location entry table. We skip the first
   // entry, which is always the same dummy entry.
-  std::vector<uint64_t> SLocEntryOffsets;
+  std::vector<uint32_t> SLocEntryOffsets;
   RecordData PreloadSLocs;
   SLocEntryOffsets.reserve(SourceMgr.sloc_entry_size() - 1);
   for (SourceManager::sloc_entry_iterator 
@@ -836,7 +836,7 @@
   Record.push_back(SourceMgr.getNextOffset());
   Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record,
                             (const char *)&SLocEntryOffsets.front(), 
-                            SLocEntryOffsets.size() * 8);
+                           SLocEntryOffsets.size()*sizeof(SLocEntryOffsets[0]));
 
   // Write the source location entry preloads array, telling the PCH
   // reader which source locations entries it should load eagerly.





More information about the cfe-commits mailing list