LLVM  16.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 
15 namespace llvm {
16 
17 class MCSectionXCOFF;
18 
19 class MCSymbolXCOFF : public MCSymbol {
20 public:
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.value();
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 
65 private:
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
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MCSectionXCOFF
Definition: MCSectionXCOFF.h:32
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMapEntry.h:102
llvm::MCSymbol::isTemporary
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:215
llvm::MCSymbolXCOFF::MCSymbolXCOFF
MCSymbolXCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolXCOFF.h:21
StringRef.h
llvm::MCSymbolXCOFF::getSymbolTableName
StringRef getSymbolTableName() const
Definition: MCSymbolXCOFF.h:59
llvm::XCOFF::VisibilityType
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:238
llvm::MCSymbolXCOFF::getUnqualifiedName
static StringRef getUnqualifiedName(StringRef Name)
Definition: MCSymbolXCOFF.h:26
llvm::MCSymbolXCOFF::getVisibilityType
XCOFF::VisibilityType getVisibilityType() const
Definition: MCSymbolXCOFF.h:53
llvm::MCSymbolXCOFF::setRepresentedCsect
void setRepresentedCsect(MCSectionXCOFF *C)
Definition: MCSymbolXCOFF.cpp:22
llvm::MCSymbolXCOFF::setSymbolTableName
void setSymbolTableName(StringRef STN)
Definition: MCSymbolXCOFF.h:57
llvm::MCSymbolXCOFF::getRepresentedCsect
MCSectionXCOFF * getRepresentedCsect() const
Definition: MCSymbolXCOFF.cpp:13
llvm::MCSymbolXCOFF::setVisibilityType
void setVisibilityType(XCOFF::VisibilityType SVT)
Definition: MCSymbolXCOFF.h:51
XCOFF.h
llvm::PPCISD::SC
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
Definition: PPCISelLowering.h:420
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
MCSymbol.h
llvm::MCSymbolXCOFF::hasRename
bool hasRename() const
Definition: MCSymbolXCOFF.h:55
llvm::MCSymbol::getName
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:198
llvm::MCSymbolXCOFF::getStorageClass
XCOFF::StorageClass getStorageClass() const
Definition: MCSymbolXCOFF.h:40
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::MCSymbolXCOFF::setStorageClass
void setStorageClass(XCOFF::StorageClass SC)
Definition: MCSymbolXCOFF.h:36
llvm::XCOFF::StorageClass
StorageClass
Definition: XCOFF.h:157
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MCSymbolXCOFF::classof
static bool classof(const MCSymbol *S)
Definition: MCSymbolXCOFF.h:24
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::MCSymbolXCOFF::getUnqualifiedName
StringRef getUnqualifiedName() const
Definition: MCSymbolXCOFF.h:45
llvm::MCSymbol::SymbolKindXCOFF
@ SymbolKindXCOFF
Definition: MCSymbol.h:52
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::XCOFF::SYM_V_UNSPECIFIED
@ SYM_V_UNSPECIFIED
Definition: XCOFF.h:239
llvm::MCSymbolXCOFF
Definition: MCSymbolXCOFF.h:19