[PATCH] [LLD] COFF: Make DefinedCOFF one pointer smaller

Rui Ueyama ruiu at google.com
Mon Jun 29 16:04:19 PDT 2015


Updated to use http://reviews.llvm.org/D10819


http://reviews.llvm.org/D10818

Files:
  COFF/Symbols.h

Index: COFF/Symbols.h
===================================================================
--- COFF/Symbols.h
+++ COFF/Symbols.h
@@ -25,6 +25,7 @@
 using llvm::object::Archive;
 using llvm::object::COFFSymbolRef;
 using llvm::object::coff_import_header;
+using llvm::object::coff_symbol_generic;
 
 class ArchiveFile;
 class InputFile;
@@ -131,40 +132,40 @@
   friend SymbolBody;
 public:
   DefinedCOFF(Kind K, ObjectFile *F, COFFSymbolRef S)
-      : Defined(K), File(F), Sym(S) {}
+      : Defined(K), File(F), Sym(S.getGeneric()) {}
 
   static bool classof(const SymbolBody *S) {
     return S->kind() <= LastDefinedCOFFKind;
   }
 
 protected:
   ObjectFile *File;
-  COFFSymbolRef Sym;
+  const coff_symbol_generic *Sym;
 };
 
 // Regular defined symbols read from object file symbol tables.
 class DefinedRegular : public DefinedCOFF {
 public:
   DefinedRegular(ObjectFile *F, COFFSymbolRef S, SectionChunk *C)
       : DefinedCOFF(DefinedRegularKind, F, S), Data(&C->Ptr) {
-    IsExternal = Sym.isExternal();
+    IsExternal = S.isExternal();
     IsCOMDAT = C->isCOMDAT();
   }
 
   static bool classof(const SymbolBody *S) {
     return S->kind() == DefinedRegularKind;
   }
 
   uint64_t getFileOff() {
-    return (*Data)->getFileOff() + Sym.getValue();
+    return (*Data)->getFileOff() + Sym->Value;
   }
 
-  uint64_t getRVA() { return (*Data)->getRVA() + Sym.getValue(); }
+  uint64_t getRVA() { return (*Data)->getRVA() + Sym->Value; }
   bool isCOMDAT() { return IsCOMDAT; }
   bool isLive() const { return (*Data)->isLive(); }
   void markLive() { (*Data)->markLive(); }
   SectionChunk *getChunk() { return *Data; }
-  uint64_t getValue() { return Sym.getValue(); }
+  uint32_t getValue() { return Sym->Value; }
 
 private:
   SectionChunk **Data;
@@ -174,7 +175,7 @@
 public:
   DefinedCommon(ObjectFile *F, COFFSymbolRef S, CommonChunk *C)
       : DefinedCOFF(DefinedCommonKind, F, S), Data(C) {
-    IsExternal = Sym.isExternal();
+    IsExternal = S.isExternal();
   }
 
   static bool classof(const SymbolBody *S) {
@@ -187,7 +188,7 @@
 private:
   friend SymbolBody;
 
-  uint64_t getSize() { return Sym.getValue(); }
+  uint64_t getSize() { return Sym->Value; }
 
   CommonChunk *Data;
 };

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10818.28723.patch
Type: text/x-patch
Size: 2220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150629/5df98534/attachment.bin>


More information about the llvm-commits mailing list