LLVM 22.0.0git
MCSymbolCOFF.h
Go to the documentation of this file.
1//===- MCSymbolCOFF.h - ----------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_MC_MCSYMBOLCOFF_H
10#define LLVM_MC_MCSYMBOLCOFF_H
11
13#include "llvm/MC/MCSymbol.h"
15#include <cstdint>
16
17namespace llvm {
18
19class MCSymbolCOFF : public MCSymbol {
20 /// This corresponds to the e_type field of the COFF symbol.
21 mutable uint16_t Type = 0;
22
23 enum SymbolFlags : uint16_t {
24 SF_ClassMask = 0x00FF,
25 SF_ClassShift = 0,
26
27 SF_SafeSEH = 0x0100,
28 SF_WeakExternalCharacteristicsMask = 0x0E00,
29 SF_WeakExternalCharacteristicsShift = 9,
30 };
31
32public:
35
36 bool isExternal() const { return IsExternal; }
37 void setExternal(bool Value) const { IsExternal = Value; }
38
39 uint16_t getType() const {
40 return Type;
41 }
42 void setType(uint16_t Ty) const {
43 Type = Ty;
44 }
45
47 return (getFlags() & SF_ClassMask) >> SF_ClassShift;
48 }
50 modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
51 }
52
54 return static_cast<COFF::WeakExternalCharacteristics>((getFlags() & SF_WeakExternalCharacteristicsMask) >>
55 SF_WeakExternalCharacteristicsShift);
56 }
58 modifyFlags(Characteristics << SF_WeakExternalCharacteristicsShift,
59 SF_WeakExternalCharacteristicsMask);
60 }
61 void setIsWeakExternal(bool WeakExt) const {
62 IsWeakExternal = WeakExt;
63 }
64
65 bool isSafeSEH() const {
66 return getFlags() & SF_SafeSEH;
67 }
68 void setIsSafeSEH() const {
69 modifyFlags(SF_SafeSEH, SF_SafeSEH);
70 }
71};
72
73} // end namespace llvm
74
75#endif // LLVM_MC_MCSYMBOLCOFF_H
bool isExternal() const
void setIsWeakExternal(bool WeakExt) const
void setWeakExternalCharacteristics(COFF::WeakExternalCharacteristics Characteristics) const
void setIsSafeSEH() const
uint16_t getType() const
void setType(uint16_t Ty) const
bool isSafeSEH() const
void setClass(uint16_t StorageClass) const
MCSymbolCOFF(const MCSymbolTableEntry *Name, bool isTemporary)
void setExternal(bool Value) const
COFF::WeakExternalCharacteristics getWeakExternalCharacteristics() const
uint16_t getClass() const
unsigned IsWeakExternal
This symbol is weak external.
Definition MCSymbol.h:93
MCSymbol(const MCSymbolTableEntry *Name, bool isTemporary)
Definition MCSymbol.h:146
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
Definition MCSymbol.h:375
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
Definition MCSymbol.h:366
unsigned IsExternal
True if this symbol is visible outside this translation unit.
Definition MCSymbol.h:87
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition MCSymbol.h:205
const MCExpr * Value
If non-null, the value for a variable symbol.
Definition MCSymbol.h:130
WeakExternalCharacteristics
Definition COFF.h:487
This is an optimization pass for GlobalISel generic memory operations.
StringMapEntry< MCSymbolTableValue > MCSymbolTableEntry
MCContext stores MCSymbolTableValue in a string map (see MCSymbol::operator new).