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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Pete Cooper 2015-06-08 17:17:16 +00:00
parent f560b88d7c
commit a335f333be
2 changed files with 12 additions and 12 deletions

View File

@ -15,15 +15,18 @@
namespace llvm { namespace llvm {
class MCSymbolCOFF : public MCSymbol { class MCSymbolCOFF : public MCSymbol {
/// This corresponds to the e_type field of the COFF symbol.
mutable uint16_t Type;
public: public:
MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary) MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
: MCSymbol(SymbolKindCOFF, Name, isTemporary) {} : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
uint16_t getType() const { uint16_t getType() const {
return (getFlags() & COFF::SF_TypeMask) >> COFF::SF_TypeShift; return Type;
} }
void setType(uint16_t Type) const { void setType(uint16_t Ty) const {
modifyFlags(Type << COFF::SF_TypeShift, COFF::SF_TypeMask); Type = Ty;
} }
static bool classof(const MCSymbol *S) { return S->isCOFF(); } static bool classof(const MCSymbol *S) { return S->isCOFF(); }

View File

@ -155,15 +155,12 @@ namespace COFF {
uint8_t NumberOfAuxSymbols; uint8_t NumberOfAuxSymbols;
}; };
enum SymbolFlags { enum SymbolFlags : uint16_t {
SF_TypeMask = 0x0000FFFF, SF_ClassMask = 0x00FF,
SF_TypeShift = 0, SF_ClassShift = 0,
SF_ClassMask = 0x00FF0000, SF_WeakExternal = 0x0100,
SF_ClassShift = 16, SF_SafeSEH = 0x0200,
SF_WeakExternal = 0x01000000,
SF_SafeSEH = 0x02000000,
}; };
enum SymbolSectionNumber : int32_t { enum SymbolSectionNumber : int32_t {