LLVM 19.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"
14#include <cstdint>
15
16namespace llvm {
17
18class 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_SafeSEH = 0x0100,
27 SF_WeakExternalCharacteristicsMask = 0x0E00,
28 SF_WeakExternalCharacteristicsShift = 9,
29 };
30
31public:
34
35 uint16_t getType() const {
36 return Type;
37 }
38 void setType(uint16_t Ty) const {
39 Type = Ty;
40 }
41
43 return (getFlags() & SF_ClassMask) >> SF_ClassShift;
44 }
46 modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
47 }
48
50 return static_cast<COFF::WeakExternalCharacteristics>((getFlags() & SF_WeakExternalCharacteristicsMask) >>
51 SF_WeakExternalCharacteristicsShift);
52 }
54 modifyFlags(Characteristics << SF_WeakExternalCharacteristicsShift,
55 SF_WeakExternalCharacteristicsMask);
56 }
57 void setIsWeakExternal(bool WeakExt) const {
58 IsWeakExternal = WeakExt;
59 }
60
61 bool isSafeSEH() const {
62 return getFlags() & SF_SafeSEH;
63 }
64 void setIsSafeSEH() const {
65 modifyFlags(SF_SafeSEH, SF_SafeSEH);
66 }
67
68 static bool classof(const MCSymbol *S) { return S->isCOFF(); }
69};
70
71} // end namespace llvm
72
73#endif // LLVM_MC_MCSYMBOLCOFF_H
COFFYAML::WeakExternalCharacteristics Characteristics
Definition: COFFYAML.cpp:331
std::string Name
void setIsWeakExternal(bool WeakExt) const
Definition: MCSymbolCOFF.h:57
void setWeakExternalCharacteristics(COFF::WeakExternalCharacteristics Characteristics) const
Definition: MCSymbolCOFF.h:53
void setIsSafeSEH() const
Definition: MCSymbolCOFF.h:64
uint16_t getType() const
Definition: MCSymbolCOFF.h:35
MCSymbolCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolCOFF.h:32
void setType(uint16_t Ty) const
Definition: MCSymbolCOFF.h:38
static bool classof(const MCSymbol *S)
Definition: MCSymbolCOFF.h:68
bool isSafeSEH() const
Definition: MCSymbolCOFF.h:61
void setClass(uint16_t StorageClass) const
Definition: MCSymbolCOFF.h:45
COFF::WeakExternalCharacteristics getWeakExternalCharacteristics() const
Definition: MCSymbolCOFF.h:49
uint16_t getClass() const
Definition: MCSymbolCOFF.h:42
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:40
unsigned IsWeakExternal
This symbol is weak external.
Definition: MCSymbol.h:105
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
Definition: MCSymbol.h:431
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
Definition: MCSymbol.h:422
bool isCOFF() const
Definition: MCSymbol.h:285
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:222
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
WeakExternalCharacteristics
Definition: COFF.h:453
StorageClass
Definition: XCOFF.h:170
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18