LLVM  13.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/Optional.h"
12 #include "llvm/ADT/StringRef.h"
14 #include "llvm/MC/MCSymbol.h"
15 
16 namespace llvm {
17 
18 class MCSectionXCOFF;
19 
20 class MCSymbolXCOFF : public MCSymbol {
21 public:
24 
25  static bool classof(const MCSymbol *S) { return S->isXCOFF(); }
26 
28  if (Name.back() == ']') {
29  StringRef Lhs, Rhs;
30  std::tie(Lhs, Rhs) = Name.rsplit('[');
31  assert(!Rhs.empty() && "Invalid SMC format in XCOFF symbol.");
32  return Lhs;
33  }
34  return Name;
35  }
36 
38  StorageClass = SC;
39  };
40 
42  assert(StorageClass.hasValue() &&
43  "StorageClass not set on XCOFF MCSymbol.");
44  return StorageClass.getValue();
45  }
46 
48 
50 
52 
54 
56 
57  bool hasRename() const { return !SymbolTableName.empty(); }
58 
59  void setSymbolTableName(StringRef STN) { SymbolTableName = STN; }
60 
62  if (hasRename())
63  return SymbolTableName;
64  return getUnqualifiedName();
65  }
66 
67 private:
69  MCSectionXCOFF *RepresentedCsect = nullptr;
71  StringRef SymbolTableName;
72 };
73 
74 } // end namespace llvm
75 
76 #endif // LLVM_MC_MCSYMBOLXCOFF_H
llvm
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
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:98
Optional.h
llvm::MCSymbol::isTemporary
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:214
llvm::MCSymbolXCOFF::MCSymbolXCOFF
MCSymbolXCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolXCOFF.h:22
StringRef.h
llvm::MCSymbolXCOFF::getSymbolTableName
StringRef getSymbolTableName() const
Definition: MCSymbolXCOFF.h:61
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:188
llvm::MCSymbolXCOFF::getUnqualifiedName
static StringRef getUnqualifiedName(StringRef Name)
Definition: MCSymbolXCOFF.h:27
llvm::Optional< XCOFF::StorageClass >
llvm::MCSymbolXCOFF::getVisibilityType
XCOFF::VisibilityType getVisibilityType() const
Definition: MCSymbolXCOFF.h:55
llvm::MCSymbolXCOFF::setRepresentedCsect
void setRepresentedCsect(MCSectionXCOFF *C)
Definition: MCSymbolXCOFF.cpp:22
llvm::MCSymbolXCOFF::setSymbolTableName
void setSymbolTableName(StringRef STN)
Definition: MCSymbolXCOFF.h:59
llvm::MCSymbolXCOFF::getRepresentedCsect
MCSectionXCOFF * getRepresentedCsect() const
Definition: MCSymbolXCOFF.cpp:13
llvm::MCSymbolXCOFF::setVisibilityType
void setVisibilityType(XCOFF::VisibilityType SVT)
Definition: MCSymbolXCOFF.h:53
XCOFF.h
llvm::PPCISD::SC
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
Definition: PPCISelLowering.h:410
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
MCSymbol.h
llvm::MCSymbolXCOFF::hasRename
bool hasRename() const
Definition: MCSymbolXCOFF.h:57
llvm::MCSymbol::getName
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:197
llvm::MCSymbolXCOFF::getStorageClass
XCOFF::StorageClass getStorageClass() const
Definition: MCSymbolXCOFF.h:41
llvm::MCSymbolXCOFF::setStorageClass
void setStorageClass(XCOFF::StorageClass SC)
Definition: MCSymbolXCOFF.h:37
llvm::XCOFF::StorageClass
StorageClass
Definition: XCOFF.h:107
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MCSymbolXCOFF::classof
static bool classof(const MCSymbol *S)
Definition: MCSymbolXCOFF.h:25
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCSymbolXCOFF::getUnqualifiedName
StringRef getUnqualifiedName() const
Definition: MCSymbolXCOFF.h:47
llvm::MCSymbol::SymbolKindXCOFF
@ SymbolKindXCOFF
Definition: MCSymbol.h:51
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:189
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::MCSymbolXCOFF
Definition: MCSymbolXCOFF.h:20