LLVM
8.0.1
lib
CodeGen
AsmPrinter
DwarfStringPool.h
Go to the documentation of this file.
1
//===- llvm/CodeGen/DwarfStringPool.h - Dwarf Debug Framework ---*- 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_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
11
#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
12
13
#include "
llvm/ADT/StringMap.h
"
14
#include "
llvm/ADT/StringRef.h
"
15
#include "
llvm/CodeGen/DwarfStringPoolEntry.h
"
16
#include "
llvm/Support/Allocator.h
"
17
18
namespace
llvm
{
19
20
class
AsmPrinter;
21
class
MCSection;
22
class
MCSymbol
;
23
24
// Collection of strings for this unit and assorted symbols.
25
// A String->Symbol mapping of strings used by indirect
26
// references.
27
class
DwarfStringPool
{
28
using
EntryTy
=
DwarfStringPoolEntry
;
29
30
StringMap<EntryTy, BumpPtrAllocator &>
Pool;
31
StringRef
Prefix;
32
unsigned
NumBytes = 0;
33
unsigned
NumIndexedStrings = 0;
34
bool
ShouldCreateSymbols;
35
36
StringMapEntry<EntryTy>
&getEntryImpl(
AsmPrinter
&
Asm
,
StringRef
Str);
37
38
public
:
39
using
EntryRef
=
DwarfStringPoolEntryRef
;
40
41
DwarfStringPool
(
BumpPtrAllocator
&A,
AsmPrinter
&Asm,
StringRef
Prefix);
42
43
void
emitStringOffsetsTableHeader
(
AsmPrinter
&Asm,
MCSection
*OffsetSection,
44
MCSymbol
*StartSym);
45
46
void
emit
(
AsmPrinter
&Asm,
MCSection
*StrSection,
47
MCSection
*OffsetSection =
nullptr
,
48
bool
UseRelativeOffsets =
false
);
49
50
bool
empty
()
const
{
return
Pool.
empty
(); }
51
52
unsigned
size
()
const
{
return
Pool.
size
(); }
53
54
unsigned
getNumIndexedStrings
()
const
{
return
NumIndexedStrings; }
55
56
/// Get a reference to an entry in the string pool.
57
EntryRef
getEntry
(
AsmPrinter
&Asm,
StringRef
Str);
58
59
/// Same as getEntry, except that you can use EntryRef::getIndex to obtain a
60
/// unique ID of this entry (e.g., for use in indexed forms like
61
/// DW_FORM_strx).
62
EntryRef
getIndexedEntry
(
AsmPrinter
&Asm,
StringRef
Str);
63
};
64
65
}
// end namespace llvm
66
67
#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition:
MCSection.h:39
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:24
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition:
StringMap.h:126
llvm::DwarfStringPool::getNumIndexedStrings
unsigned getNumIndexedStrings() const
Definition:
DwarfStringPool.h:54
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:
MCSymbol.h:42
llvm::DwarfStringPool::emit
void emit(AsmPrinter &Asm, MCSection *StrSection, MCSection *OffsetSection=nullptr, bool UseRelativeOffsets=false)
Definition:
DwarfStringPool.cpp:78
llvm::ISD::MCSymbol
Definition:
ISDOpcodes.h:139
Allocator.h
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
llvm::StringMapImpl::size
unsigned size() const
Definition:
StringMap.h:112
llvm::DwarfStringPool
Definition:
DwarfStringPool.h:27
llvm::HexStyle::Asm
0ffh
Definition:
MCInstPrinter.h:33
llvm::DwarfStringPool::getIndexedEntry
EntryRef getIndexedEntry(AsmPrinter &Asm, StringRef Str)
Same as getEntry, except that you can use EntryRef::getIndex to obtain a unique ID of this entry (e...
Definition:
DwarfStringPool.cpp:48
llvm::DwarfStringPoolEntry
Data for a string pool entry.
Definition:
DwarfStringPoolEntry.h:21
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition:
Allocator.h:141
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition:
AsmPrinter.h:79
llvm::DwarfStringPool::size
unsigned size() const
Definition:
DwarfStringPool.h:52
StringMap.h
DwarfStringPoolEntry.h
StringRef.h
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Definition:
StringMap.h:220
llvm::DwarfStringPoolEntryRef
String pool entry reference.
Definition:
DwarfStringPoolEntry.h:32
llvm::DwarfStringPool::emitStringOffsetsTableHeader
void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection, MCSymbol *StartSym)
Definition:
DwarfStringPool.cpp:56
llvm::DwarfStringPool::getEntry
EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
Definition:
DwarfStringPool.cpp:42
llvm::StringMapImpl::empty
bool empty() const
Definition:
StringMap.h:111
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:49
llvm::DwarfStringPool::empty
bool empty() const
Definition:
DwarfStringPool.h:50
llvm::DwarfStringPool::DwarfStringPool
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
Definition:
DwarfStringPool.cpp:22
Generated on Sun Dec 20 2020 13:54:04 for LLVM by
1.8.13