Move SymbolSize from MCSymbolData to MCSymbol.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 29 May 2015 17:24:52 +0000 (17:24 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 29 May 2015 17:24:52 +0000 (17:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238580 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCSymbol.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCELFStreamer.cpp

index cf99c919281e2427a3919a05a5121676cef362c2..d9b3b8486d266ddb160eff49c37ca76ebfc2f620 100644 (file)
@@ -43,10 +43,6 @@ class MCSymbolData {
     uint64_t CommonSize;
   };
 
-  /// SymbolSize - An expression describing how to calculate the size of
-  /// a symbol. If a symbol has no size this field will be NULL.
-  const MCExpr *SymbolSize = nullptr;
-
   /// CommonAlign - The alignment of the symbol, if it is 'common', or -1.
   //
   // FIXME: Pack this in with other fields?
@@ -104,10 +100,6 @@ public:
     return CommonSize;
   }
 
-  void setSize(const MCExpr *SS) { SymbolSize = SS; }
-
-  const MCExpr *getSize() const { return SymbolSize; }
-
   /// getCommonAlignment - Return the alignment of a 'common' symbol.
   unsigned getCommonAlignment() const {
     assert(isCommon() && "Not a 'common' symbol!");
@@ -171,6 +163,10 @@ class MCSymbol {
   /// Index field, for use by the object file implementation.
   mutable uint64_t Index : 60;
 
+  /// An expression describing how to calculate the size of a symbol. If a
+  /// symbol has no size this field will be NULL.
+  const MCExpr *SymbolSize = nullptr;
+
   mutable MCSymbolData Data;
 
 private: // MCContext creates and uniques these.
@@ -295,6 +291,10 @@ public:
     Index = Value;
   }
 
+  void setSize(const MCExpr *SS) { SymbolSize = SS; }
+
+  const MCExpr *getSize() const { return SymbolSize; }
+
   /// print - Print the value to the stream \p OS.
   void print(raw_ostream &OS) const;
 
index 27b8b9be9fda7187ee4a743750dccbade3d7ce73..97c0bcb4af7aefdc092c07b5dc77759840bbe1ce 100644 (file)
@@ -480,9 +480,9 @@ void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
   uint64_t Value = SymbolValue(*MSD.Symbol, Layout);
   uint64_t Size = 0;
 
-  const MCExpr *ESize = OrigData.getSize();
+  const MCExpr *ESize = MSD.Symbol->getSize();
   if (!ESize && Base)
-    ESize = BaseSD->getSize();
+    ESize = Base->getSize();
 
   if (ESize) {
     int64_t Res;
index ed97d01a9096b2bd17d5c5e7afeb98addfe78826..e470ab49b01ca4f7fb23e91fb254b6c66e61a9b3 100644 (file)
@@ -331,12 +331,11 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
     SD.setCommon(Size, ByteAlignment);
   }
 
-  SD.setSize(MCConstantExpr::Create(Size, getContext()));
+  Symbol->setSize(MCConstantExpr::Create(Size, getContext()));
 }
 
 void MCELFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
-  MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
-  SD.setSize(Value);
+  Symbol->setSize(Value);
 }
 
 void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,