[llvm] r239313 - Move COFF Type in to the MCSymbolCOFF class.

Pete Cooper peter_cooper at apple.com
Mon Jun 8 10:17:16 PDT 2015


Author: pete
Date: Mon Jun  8 12:17:16 2015
New Revision: 239313

URL: http://llvm.org/viewvc/llvm-project?rev=239313&view=rev
Log:
Move COFF Type in to the MCSymbolCOFF class.

The flags field in MCSymbol only needs to be 16-bits on ELF and MachO.
This moves the 16-bit Type out of there so that it can be reduced in size in a future commit.

Reviewed by Rafael EspĂ­ndola.

Modified:
    llvm/trunk/include/llvm/MC/MCSymbolCOFF.h
    llvm/trunk/include/llvm/Support/COFF.h

Modified: llvm/trunk/include/llvm/MC/MCSymbolCOFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbolCOFF.h?rev=239313&r1=239312&r2=239313&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbolCOFF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbolCOFF.h Mon Jun  8 12:17:16 2015
@@ -15,15 +15,18 @@
 namespace llvm {
 class MCSymbolCOFF : public MCSymbol {
 
+  /// This corresponds to the e_type field of the COFF symbol.
+  mutable uint16_t Type;
+
 public:
   MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
-      : MCSymbol(SymbolKindCOFF, Name, isTemporary) {}
+      : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
 
   uint16_t getType() const {
-    return (getFlags() & COFF::SF_TypeMask) >> COFF::SF_TypeShift;
+    return Type;
   }
-  void setType(uint16_t Type) const {
-    modifyFlags(Type << COFF::SF_TypeShift, COFF::SF_TypeMask);
+  void setType(uint16_t Ty) const {
+    Type = Ty;
   }
 
   static bool classof(const MCSymbol *S) { return S->isCOFF(); }

Modified: llvm/trunk/include/llvm/Support/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/COFF.h?rev=239313&r1=239312&r2=239313&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/COFF.h (original)
+++ llvm/trunk/include/llvm/Support/COFF.h Mon Jun  8 12:17:16 2015
@@ -155,15 +155,12 @@ namespace COFF {
     uint8_t  NumberOfAuxSymbols;
   };
 
-  enum SymbolFlags {
-    SF_TypeMask = 0x0000FFFF,
-    SF_TypeShift = 0,
+  enum SymbolFlags : uint16_t {
+    SF_ClassMask = 0x00FF,
+    SF_ClassShift = 0,
 
-    SF_ClassMask = 0x00FF0000,
-    SF_ClassShift = 16,
-
-    SF_WeakExternal = 0x01000000,
-    SF_SafeSEH = 0x02000000,
+    SF_WeakExternal = 0x0100,
+    SF_SafeSEH = 0x0200,
   };
 
   enum SymbolSectionNumber : int32_t {






More information about the llvm-commits mailing list