LLVM: include/llvm/DebugInfo/LogicalView/Core/LVReader.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H
16
23#include
24
25namespace llvm {
26namespace logicalview {
27
29
32
34 std::unique_ptr OutputFile;
35 std::string Location;
36
37public:
42
47 if (OutputFile) {
48 OutputFile->os().close();
49 OutputFile = nullptr;
50 }
51 }
52
55};
56
57
58
59
62
63
65
66
67 using LVCompileUnits = std::map<LVOffset, LVScopeCompileUnit *>;
68 LVCompileUnits CompileUnits;
69
70
75
76
77 Error createSplitFolder();
78 bool OutputSplit = false;
79
80
81#define LV_OBJECT_ALLOCATOR(KIND) \
82 llvm::SpecificBumpPtrAllocator<LV##KIND> Allocated##KIND;
83
84
88
89
92
93
95
96
110
111
113
114
121
122#undef LV_OBJECT_ALLOCATOR
123
124protected:
131
132
134
135
138 }
139
140
142 Root = createScopeRoot();
144 if (options().getAttributeFormat())
147 }
148
149
150
151
152
153
154
156
157
163 return std::string(Path);
164 }
165
169
170public:
174 : BinaryType(BinaryType), OutputSplit(options().getOutputSplit()),
180
181
182
183
184
185
186
187
188#define LV_CREATE_OBJECT(KIND) \
189 LV##KIND *create##KIND() { \
190 return new (Allocated##KIND.Allocate()) LV##KIND(); \
191 }
192
193
197
198
201
202
216
217
219
220
227
228#undef LV_CREATE_OBJECT
229
230
232 return new (AllocatedOperation.Allocate()) LVOperation(OpCode, Operands);
233 }
234
239
241
245
248 assert(Scope && Scope->isCompileUnit() && "Scope is not a compile unit");
250 }
253 }
256 }
257
258
260
263
267 return {};
268 }
269
273 }
274
276 return false;
277 };
278
279
281
282
284 if (().getCompareContext() && options().getCompareLines())
286 }
288 if (().getCompareContext() && options().getCompareScopes())
289 Scopes.push_back(Scope);
290 }
292 if (().getCompareContext() && options().getCompareSymbols())
293 Symbols.push_back(Symbol);
294 }
296 if (().getCompareContext() && options().getCompareTypes())
298 }
299
304
305
308 }
311 }
314 }
317 }
320 }
321
324
327
328#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
330#endif
331};
332
336}
339}
340
341}
342}
343
344#endif
BlockVerifier::State From
#define LV_CREATE_OBJECT(KIND)
#define LV_OBJECT_ALLOCATOR(KIND)
mir Rename Register Operands
PowerPC Reduce CR logical Operation
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
void setName(StringRef ElementName) override
bool printObject(const LVLocation *Location) const
bool printElement(const LVLine *Line) const
The logical reader owns of all the logical elements created during the debug information parsing.
virtual void sortScopes()
StringRef getFileFormatName() const
void addCompileUnitOffset(LVOffset Offset, LVScopeCompileUnit *CompileUnit)
bool doPrintLine(const LVLine *Line) const
void print(raw_ostream &OS) const
const LVTypes & getTypes() const
std::string FileFormatName
void notifyAddedElement(LVType *Type)
void notifyAddedElement(LVLine *Line)
virtual std::string getRegisterName(LVSmall Opcode, ArrayRef< uint64_t > Operands)
const LVSymbols & getSymbols() const
void notifyAddedElement(LVSymbol *Symbol)
raw_ostream & outputStream()
codeview::CPUType getCompileUnitCPUType()
std::string createAlternativePath(StringRef From)
const LVLines & getLines() const
LVReader(const LVReader &)=delete
bool doPrintSymbol(const LVSymbol *Symbol) const
void setFilename(std::string Name)
bool isBinaryTypeCOFF() const
bool isBinaryTypeNone() const
LVSectionIndex getDotTextSectionIndex() const
void setCompileUnitCPUType(codeview::CPUType Type)
LVReader & operator=(const LVReader &)=delete
bool doPrintLocation(const LVLocation *Location) const
virtual bool isSystemEntry(LVElement *Element, StringRef Name={}) const
std::string InputFilename
LVSplitContext & getSplitContext()
bool isBinaryTypeELF() const
virtual ~LVReader()=default
StringRef getFilename() const
static LVReader & getInstance()
const LVScopes & getScopes() const
LVScopeCompileUnit * CompileUnit
static void setInstance(LVReader *Reader)
LVReader(StringRef InputFilename, StringRef FileFormatName, ScopedPrinter &W, LVBinaryType BinaryType=LVBinaryType::NONE)
LVScopeCompileUnit * getCompileUnit() const
LVScopeRoot * getScopesRoot() const
virtual LVSectionIndex getSectionIndex(LVScope *Scope)
LVSectionIndex DotTextSectionIndex
void setCompileUnit(LVScope *Scope)
LVOperation * createOperation(LVSmall OpCode, ArrayRef< LVUnsigned > Operands)
bool doPrintType(const LVType *Type) const
virtual Error printMatchedElements(bool UseMatchedElements)
virtual Error printScopes()
virtual Error createScopes()
bool doPrintScope(const LVScope *Scope) const
void notifyAddedElement(LVScope *Scope)
virtual void printRecords(raw_ostream &OS) const
void setFileFormatName(StringRef FileFormatName)
std::string getLocation() const
LVSplitContext(const LVSplitContext &)=delete
LVSplitContext & operator=(const LVSplitContext &)=delete
Error createSplitFolder(StringRef Where)
std::error_code open(std::string Name, std::string Extension, raw_ostream &OS)
~LVSplitContext()=default
A raw_ostream that writes to a file descriptor.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
constexpr LVSectionIndex UndefinedSectionIndex
LVScopeCompileUnit * getReaderCompileUnit()
LVSplitContext & getReaderSplitContext()
StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get parent path.
StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
std::string convert_to_slash(StringRef path, Style style=Style::native)
Replaces backslashes with slashes if Windows.
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.