LLVM  8.0.0svn
DwarfStringPoolEntry.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/DwarfStringPoolEntry.h - String pool entry --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CODEGEN_DWARFSTRINGPOOLENTRY_H
11 #define LLVM_CODEGEN_DWARFSTRINGPOOLENTRY_H
12 
14 #include "llvm/ADT/StringMap.h"
15 
16 namespace llvm {
17 
18 class MCSymbol;
19 
20 /// Data for a string pool entry.
22  static constexpr unsigned NotIndexed = -1;
23 
25  unsigned Offset;
26  unsigned Index;
27 
28  bool isIndexed() const { return Index != NotIndexed; }
29 };
30 
31 /// String pool entry reference.
34  MapEntryAndIndexed;
35 
36  const StringMapEntry<DwarfStringPoolEntry> *getMapEntry() const {
37  return MapEntryAndIndexed.getPointer();
38  }
39 
40 public:
41  DwarfStringPoolEntryRef() = default;
43  bool Indexed)
44  : MapEntryAndIndexed(&Entry, Indexed) {}
45 
46  explicit operator bool() const { return getMapEntry(); }
47  MCSymbol *getSymbol() const {
48  assert(getMapEntry()->second.Symbol && "No symbol available!");
49  return getMapEntry()->second.Symbol;
50  }
51  unsigned getOffset() const { return getMapEntry()->second.Offset; }
52  bool isIndexed() const { return MapEntryAndIndexed.getInt(); }
53  unsigned getIndex() const {
54  assert(isIndexed());
55  assert(getMapEntry()->getValue().isIndexed());
56  return getMapEntry()->second.Index;
57  }
58  StringRef getString() const { return getMapEntry()->first(); }
59  /// Return the entire string pool entry for convenience.
60  DwarfStringPoolEntry getEntry() const { return getMapEntry()->getValue(); }
61 
62  bool operator==(const DwarfStringPoolEntryRef &X) const {
63  return getMapEntry() == X.getMapEntry();
64  }
65  bool operator!=(const DwarfStringPoolEntryRef &X) const {
66  return getMapEntry() != X.getMapEntry();
67  }
68 };
69 
70 } // end namespace llvm
71 
72 #endif
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
PointerTy getPointer() const
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMap.h:126
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
unsigned second
DwarfStringPoolEntry getEntry() const
Return the entire string pool entry for convenience.
DwarfStringPoolEntryRef(const StringMapEntry< DwarfStringPoolEntry > &Entry, bool Indexed)
static constexpr unsigned NotIndexed
IntType getInt() const
Data for a string pool entry.
PointerIntPair - This class implements a pair of a pointer and small integer.
bool operator==(const DwarfStringPoolEntryRef &X) const
bool operator!=(const DwarfStringPoolEntryRef &X) const
String pool entry reference.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49