LLVM 20.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 uint16_t getType() const {
37 return Type;
38 }
39 void setType(uint16_t Ty) const {
40 Type = Ty;
41 }
42
44 return (getFlags() & SF_ClassMask) >> SF_ClassShift;
45 }
47 modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
48 }
49
51 return static_cast<COFF::WeakExternalCharacteristics>((getFlags() & SF_WeakExternalCharacteristicsMask) >>
52 SF_WeakExternalCharacteristicsShift);
53 }
55 modifyFlags(Characteristics << SF_WeakExternalCharacteristicsShift,
56 SF_WeakExternalCharacteristicsMask);
57 }
58 void setIsWeakExternal(bool WeakExt) const {
59 IsWeakExternal = WeakExt;
60 }
61
62 bool isSafeSEH() const {
63 return getFlags() & SF_SafeSEH;
64 }
65 void setIsSafeSEH() const {
66 modifyFlags(SF_SafeSEH, SF_SafeSEH);
67 }
68
69 static bool classof(const MCSymbol *S) { return S->isCOFF(); }
70};
71
72} // end namespace llvm
73
74#endif // LLVM_MC_MCSYMBOLCOFF_H
COFFYAML::WeakExternalCharacteristics Characteristics
Definition: COFFYAML.cpp:331
std::string Name
void setIsWeakExternal(bool WeakExt) const
Definition: MCSymbolCOFF.h:58
void setWeakExternalCharacteristics(COFF::WeakExternalCharacteristics Characteristics) const
Definition: MCSymbolCOFF.h:54
void setIsSafeSEH() const
Definition: MCSymbolCOFF.h:65
uint16_t getType() const
Definition: MCSymbolCOFF.h:36
void setType(uint16_t Ty) const
Definition: MCSymbolCOFF.h:39
static bool classof(const MCSymbol *S)
Definition: MCSymbolCOFF.h:69
bool isSafeSEH() const
Definition: MCSymbolCOFF.h:62
void setClass(uint16_t StorageClass) const
Definition: MCSymbolCOFF.h:46
MCSymbolCOFF(const MCSymbolTableEntry *Name, bool isTemporary)
Definition: MCSymbolCOFF.h:33
COFF::WeakExternalCharacteristics getWeakExternalCharacteristics() const
Definition: MCSymbolCOFF.h:50
uint16_t getClass() const
Definition: MCSymbolCOFF.h:43
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
unsigned IsWeakExternal
This symbol is weak external.
Definition: MCSymbol.h:106
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
Definition: MCSymbol.h:430
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
Definition: MCSymbol.h:421
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:468
StorageClass
Definition: XCOFF.h:170
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18