LLVM  8.0.0svn
MCSymbolCOFF.h
Go to the documentation of this file.
1 //===- MCSymbolCOFF.h - ----------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_MC_MCSYMBOLCOFF_H
11 #define LLVM_MC_MCSYMBOLCOFF_H
12 
13 #include "llvm/MC/MCSymbol.h"
14 #include <cstdint>
15 
16 namespace llvm {
17 
18 class MCSymbolCOFF : public MCSymbol {
19  /// This corresponds to the e_type field of the COFF symbol.
20  mutable uint16_t Type = 0;
21 
22  enum SymbolFlags : uint16_t {
23  SF_ClassMask = 0x00FF,
24  SF_ClassShift = 0,
25 
26  SF_WeakExternal = 0x0100,
27  SF_SafeSEH = 0x0200,
28  };
29 
30 public:
32  : MCSymbol(SymbolKindCOFF, Name, isTemporary) {}
33 
34  uint16_t getType() const {
35  return Type;
36  }
37  void setType(uint16_t Ty) const {
38  Type = Ty;
39  }
40 
41  uint16_t getClass() const {
42  return (getFlags() & SF_ClassMask) >> SF_ClassShift;
43  }
44  void setClass(uint16_t StorageClass) const {
45  modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
46  }
47 
48  bool isWeakExternal() const {
49  return getFlags() & SF_WeakExternal;
50  }
51  void setIsWeakExternal() const {
52  modifyFlags(SF_WeakExternal, SF_WeakExternal);
53  }
54 
55  bool isSafeSEH() const {
56  return getFlags() & SF_SafeSEH;
57  }
58  void setIsSafeSEH() const {
59  modifyFlags(SF_SafeSEH, SF_SafeSEH);
60  }
61 
62  static bool classof(const MCSymbol *S) { return S->isCOFF(); }
63 };
64 
65 } // end namespace llvm
66 
67 #endif // LLVM_MC_MCSYMBOLCOFF_H
bool isCOFF() const
Definition: MCSymbol.h:283
This class represents lattice values for constants.
Definition: AllocatorList.h:24
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMap.h:126
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
void setIsWeakExternal() const
Definition: MCSymbolCOFF.h:51
MCSymbolCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolCOFF.h:31
COFF::SymbolStorageClass StorageClass
Definition: COFFYAML.cpp:354
amdgpu Simplify well known AMD library false Value Value const Twine & Name
void setClass(uint16_t StorageClass) const
Definition: MCSymbolCOFF.h:44
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
bool isWeakExternal() const
Definition: MCSymbolCOFF.h:48
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:220
static bool classof(const MCSymbol *S)
Definition: MCSymbolCOFF.h:62
void setIsSafeSEH() const
Definition: MCSymbolCOFF.h:58
void setType(uint16_t Ty) const
Definition: MCSymbolCOFF.h:37
bool isSafeSEH() const
Definition: MCSymbolCOFF.h:55
uint16_t getClass() const
Definition: MCSymbolCOFF.h:41
uint16_t getType() const
Definition: MCSymbolCOFF.h:34
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
Definition: MCSymbol.h:416
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
Definition: MCSymbol.h:407