From a335f333be97c51c347c0a2fd46042eb3cdfac2e Mon Sep 17 00:00:00 2001 From: Pete Cooper Date: Mon, 8 Jun 2015 17:17:16 +0000 Subject: [PATCH] Move COFF Type in to the MCSymbolCOFF class. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239313 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCSymbolCOFF.h | 11 +++++++---- include/llvm/Support/COFF.h | 13 +++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/llvm/MC/MCSymbolCOFF.h b/include/llvm/MC/MCSymbolCOFF.h index c7636e371dc..efa23de1817 100644 --- a/include/llvm/MC/MCSymbolCOFF.h +++ b/include/llvm/MC/MCSymbolCOFF.h @@ -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 *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(); } diff --git a/include/llvm/Support/COFF.h b/include/llvm/Support/COFF.h index c48370e53d1..fa210272f7e 100644 --- a/include/llvm/Support/COFF.h +++ b/include/llvm/Support/COFF.h @@ -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 { -- 2.34.1