LLVM 18.0.0git
MCSymbolXCOFF.h
Go to the documentation of this file.
1//===- MCSymbolXCOFF.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#ifndef LLVM_MC_MCSYMBOLXCOFF_H
9#define LLVM_MC_MCSYMBOLXCOFF_H
10
11#include "llvm/ADT/StringRef.h"
13#include "llvm/MC/MCSymbol.h"
14
15namespace llvm {
16
17class MCSectionXCOFF;
18
19class MCSymbolXCOFF : public MCSymbol {
20public:
23
24 static bool classof(const MCSymbol *S) { return S->isXCOFF(); }
25
27 if (Name.back() == ']') {
28 StringRef Lhs, Rhs;
29 std::tie(Lhs, Rhs) = Name.rsplit('[');
30 assert(!Rhs.empty() && "Invalid SMC format in XCOFF symbol.");
31 return Lhs;
32 }
33 return Name;
34 }
35
37 StorageClass = SC;
38 };
39
41 assert(StorageClass && "StorageClass not set on XCOFF MCSymbol.");
42 return *StorageClass;
43 }
44
46
48
50
52
54
55 bool hasRename() const { return !SymbolTableName.empty(); }
56
57 void setSymbolTableName(StringRef STN) { SymbolTableName = STN; }
58
60 if (hasRename())
61 return SymbolTableName;
62 return getUnqualifiedName();
63 }
64
65private:
66 std::optional<XCOFF::StorageClass> StorageClass;
67 MCSectionXCOFF *RepresentedCsect = nullptr;
69 StringRef SymbolTableName;
70};
71
72} // end namespace llvm
73
74#endif // LLVM_MC_MCSYMBOLXCOFF_H
std::string Name
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
XCOFF::VisibilityType getVisibilityType() const
Definition: MCSymbolXCOFF.h:53
static bool classof(const MCSymbol *S)
Definition: MCSymbolXCOFF.h:24
StringRef getSymbolTableName() const
Definition: MCSymbolXCOFF.h:59
XCOFF::StorageClass getStorageClass() const
Definition: MCSymbolXCOFF.h:40
bool hasRename() const
Definition: MCSymbolXCOFF.h:55
void setVisibilityType(XCOFF::VisibilityType SVT)
Definition: MCSymbolXCOFF.h:51
void setRepresentedCsect(MCSectionXCOFF *C)
static StringRef getUnqualifiedName(StringRef Name)
Definition: MCSymbolXCOFF.h:26
void setSymbolTableName(StringRef STN)
Definition: MCSymbolXCOFF.h:57
MCSymbolXCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolXCOFF.h:21
void setStorageClass(XCOFF::StorageClass SC)
Definition: MCSymbolXCOFF.h:36
StringRef getUnqualifiedName() const
Definition: MCSymbolXCOFF.h:45
MCSectionXCOFF * getRepresentedCsect() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:206
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:223
bool isXCOFF() const
Definition: MCSymbol.h:294
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
VisibilityType
Values for visibility as they would appear when encoded in the high 4 bits of the 16-bit unsigned n_t...
Definition: XCOFF.h:250
@ SYM_V_UNSPECIFIED
Definition: XCOFF.h:251
StorageClass
Definition: XCOFF.h:169
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18