LLVM 19.0.0git
DWP.h
Go to the documentation of this file.
1#ifndef LLVM_DWP_DWP_H
2#define LLVM_DWP_DWP_H
3
4#include "DWPStringPool.h"
5#include "llvm/ADT/ArrayRef.h"
10#include "llvm/MC/MCSection.h"
11#include "llvm/MC/MCStreamer.h"
13#include "llvm/Support/Error.h"
14#include <deque>
15#include <vector>
16
17namespace llvm {
22};
23
26 std::string Name;
27 std::string DWOName;
29};
30
31// Holds data for Skeleton, Split Compilation, and Type Unit Headers (only in
32// v5) as defined in Dwarf 5 specification, 7.5.1.2, 7.5.1.3 and Dwarf 4
33// specification 7.5.1.1.
35 // unit_length field. Note that the type is uint64_t even in 32-bit dwarf.
37
38 // version field.
40
41 // unit_type field. Initialized only if Version >= 5.
42 uint8_t UnitType = 0;
43
44 // address_size field.
45 uint8_t AddrSize = 0;
46
47 // debug_abbrev_offset field. Note that the type is uint64_t even in 32-bit
48 // dwarf. It is assumed to be 0.
50
51 // dwo_id field. This resides in the header only if Version >= 5.
52 // In earlier versions, it is read from DW_AT_GNU_dwo_id.
53 std::optional<uint64_t> Signature;
54
55 // Derived from the length of Length field.
57
58 // The size of the Header in bytes. This is derived while parsing the header,
59 // and is stored as a convenience.
60 uint8_t HeaderSize = 0;
61};
62
65 const char *Name = "";
66 const char *DWOName = "";
67};
68
70 OnCuIndexOverflow OverflowOptValue);
71
72unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion);
73
75 const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
76 const MCSection *StrSection, const MCSection *StrOffsetSection,
77 const MCSection *TypesSection, const MCSection *CUIndexSection,
78 const MCSection *TUIndexSection, const MCSection *InfoSection,
79 const object::SectionRef &Section, MCStreamer &Out,
80 std::deque<SmallString<32>> &UncompressedSections,
81 uint32_t (&ContributionOffsets)[8], UnitIndexEntry &CurEntry,
82 StringRef &CurStrSection, StringRef &CurStrOffsetSection,
83 std::vector<StringRef> &CurTypesSection,
84 std::vector<StringRef> &CurInfoSection, StringRef &AbbrevSection,
85 StringRef &CurCUIndexSection, StringRef &CurTUIndexSection,
86 std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength);
87
89
91 MCSection *StrOffsetSection,
92 StringRef CurStrSection,
93 StringRef CurStrOffsetSection, uint16_t Version);
94
95Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
96 const CompileUnitIdentifiers &ID, StringRef DWPName);
97
98void writeIndex(MCStreamer &Out, MCSection *Section,
99 ArrayRef<unsigned> ContributionOffsets,
100 const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
101 uint32_t IndexVersion);
102
103} // namespace llvm
104#endif // LLVM_DWP_DWP_H
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
This file implements a map that provides insertion order iteration.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Tagged union holding either a T or a Error.
Definition: Error.h:474
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
Streaming machine code generation interface.
Definition: MCStreamer.h:212
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:36
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:81
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:551
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:91
@ DWARF32
Definition: Dwarf.h:91
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Error buildDuplicateError(const std::pair< uint64_t, UnitIndexEntry > &PrevE, const CompileUnitIdentifiers &ID, StringRef DWPName)
Definition: DWP.cpp:523
void writeIndex(MCStreamer &Out, MCSection *Section, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, uint32_t IndexVersion)
Definition: DWP.cpp:469
void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings, MCSection *StrOffsetSection, StringRef CurStrSection, StringRef CurStrOffsetSection, uint16_t Version)
Definition: DWP.cpp:418
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
Definition: DWP.cpp:601
Error handleSection(const StringMap< std::pair< MCSection *, DWARFSectionKind > > &KnownSections, const MCSection *StrSection, const MCSection *StrOffsetSection, const MCSection *TypesSection, const MCSection *CUIndexSection, const MCSection *TUIndexSection, const MCSection *InfoSection, const object::SectionRef &Section, MCStreamer &Out, std::deque< SmallString< 32 > > &UncompressedSections, uint32_t(&ContributionOffsets)[8], UnitIndexEntry &CurEntry, StringRef &CurStrSection, StringRef &CurStrOffsetSection, std::vector< StringRef > &CurTypesSection, std::vector< StringRef > &CurInfoSection, StringRef &AbbrevSection, StringRef &CurCUIndexSection, StringRef &CurTUIndexSection, std::vector< std::pair< DWARFSectionKind, uint32_t > > &SectionLength)
Definition: DWP.cpp:532
unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion)
Definition: DWP.cpp:162
Expected< InfoSectionUnitHeader > parseInfoSectionUnitHeader(StringRef Info)
Definition: DWP.cpp:359
OnCuIndexOverflow
Definition: DWP.h:18
@ SoftStop
Definition: DWP.h:20
@ HardStop
Definition: DWP.h:19
@ Continue
Definition: DWP.h:21
const char * DWOName
Definition: DWP.h:66
const char * Name
Definition: DWP.h:65
dwarf::DwarfFormat Format
Definition: DWP.h:56
std::optional< uint64_t > Signature
Definition: DWP.h:53
uint64_t DebugAbbrevOffset
Definition: DWP.h:49
StringRef DWPName
Definition: DWP.h:28
std::string DWOName
Definition: DWP.h:27
DWARFUnitIndex::Entry::SectionContribution Contributions[8]
Definition: DWP.h:25
std::string Name
Definition: DWP.h:26