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
COFFYAML::WeakExternalCharacteristics Characteristics
Definition: COFFYAML.cpp:350
std::string Name
bool isExternal() const
Definition: MCSymbolCOFF.h:36
void setIsWeakExternal(bool WeakExt) const
Definition: MCSymbolCOFF.h:61
void setWeakExternalCharacteristics(COFF::WeakExternalCharacteristics Characteristics) const
Definition: MCSymbolCOFF.h:57
void setIsSafeSEH() const
Definition: MCSymbolCOFF.h:68
uint16_t getType() const
Definition: MCSymbolCOFF.h:39
void setType(uint16_t Ty) const
Definition: MCSymbolCOFF.h:42
bool isSafeSEH() const
Definition: MCSymbolCOFF.h:65
void setClass(uint16_t StorageClass) const
Definition: MCSymbolCOFF.h:49
MCSymbolCOFF(const MCSymbolTableEntry *Name, bool isTemporary)
Definition: MCSymbolCOFF.h:33
void setExternal(bool Value) const
Definition: MCSymbolCOFF.h:37
COFF::WeakExternalCharacteristics getWeakExternalCharacteristics() const
Definition: MCSymbolCOFF.h:53
uint16_t getClass() const
Definition: MCSymbolCOFF.h:46
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
unsigned IsWeakExternal
This symbol is weak external.
Definition: MCSymbol.h:93
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
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
LLVM Value Representation.
Definition: Value.h:75
WeakExternalCharacteristics
Definition: COFF.h:487
StorageClass
Definition: XCOFF.h:171
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18