LLVM  10.0.0svn
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"
13 #include "llvm/MC/MCSymbol.h"
14 
15 namespace llvm {
16 
17 class MCSectionXCOFF;
18 
19 class MCSymbolXCOFF : public MCSymbol {
20 public:
22  : MCSymbol(SymbolKindXCOFF, Name, isTemporary) {}
23 
24  static bool classof(const MCSymbol *S) { return S->isXCOFF(); }
25 
27  assert((!StorageClass.hasValue() || StorageClass.getValue() == SC) &&
28  "Redefining StorageClass of XCOFF MCSymbol.");
29  StorageClass = SC;
30  };
31 
33  assert(StorageClass.hasValue() &&
34  "StorageClass not set on XCOFF MCSymbol.");
35  return StorageClass.getValue();
36  }
37 
39  assert((!ContainingCsect || ContainingCsect == C) &&
40  "Trying to set a containing csect that doesn't match the one that"
41  "this symbol is already mapped to.");
42  ContainingCsect = C;
43  }
44 
46  assert(ContainingCsect &&
47  "Trying to get containing csect but none was set.");
48  return ContainingCsect;
49  }
50 
51 private:
52  Optional<XCOFF::StorageClass> StorageClass;
53  const MCSectionXCOFF *ContainingCsect = nullptr;
54 };
55 
56 } // end namespace llvm
57 
58 #endif // LLVM_MC_MCSYMBOLXCOFF_H
uint64_t CallInst * C
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMap.h:125
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
const MCSectionXCOFF * getContainingCsect() const
Definition: MCSymbolXCOFF.h:45
StorageClass
Definition: XCOFF.h:76
static bool classof(const MCSymbol *S)
Definition: MCSymbolXCOFF.h:24
const T & getValue() const LLVM_LVALUE_FUNCTION
Definition: Optional.h:255
MCSymbolXCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolXCOFF.h:21
void setContainingCsect(const MCSectionXCOFF *C)
Definition: MCSymbolXCOFF.h:38
bool isXCOFF() const
Definition: MCSymbol.h:290
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:221
void setStorageClass(XCOFF::StorageClass SC)
Definition: MCSymbolXCOFF.h:26
CHAIN = SC CHAIN, Imm128 - System call.
bool hasValue() const
Definition: Optional.h:259
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
XCOFF::StorageClass getStorageClass() const
Definition: MCSymbolXCOFF.h:32