14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H
27namespace logicalview {
35 std::unique_ptr<ToolOutputFile> OutputFile;
49 OutputFile->os().close();
68 using LVCompileUnits = std::map<LVOffset, LVScopeCompileUnit *>;
69 LVCompileUnits CompileUnits;
78 Error createSplitFolder();
79 bool OutputSplit =
false;
82#define LV_OBJECT_ALLOCATOR(KIND) \
83 llvm::SpecificBumpPtrAllocator<LV##KIND> Allocated##KIND;
124#undef LV_OBJECT_ALLOCATOR
129 using LVSectionRanges = std::map<LVSectionIndex, std::unique_ptr<LVRange>>;
130 LVSectionRanges SectionRanges;
168 Root = createScopeRoot();
170 if (
options().getAttributeFormat())
172 return Error::success();
185 sys::path::append(Path, sys::path::Style::posix,
187 sys::path::filename(sys::path::convert_to_slash(
188 From, sys::path::Style::windows)));
189 return std::string(Path);
192 virtual Error printScopes();
193 virtual Error printMatchedElements(
bool UseMatchedElements);
200 : BinaryType(BinaryType), OutputSplit(
options().getOutputSplit()),
202 OS(W.getOStream()) {}
214#define LV_CREATE_OBJECT(KIND) \
215 LV##KIND *create##KIND() { \
216 return new (Allocated##KIND.Allocate()) LV##KIND(); \
255#undef LV_CREATE_OBJECT
275 assert(Scope && Scope->isCompileUnit() &&
"Scope is not a compile unit");
299 return getDotTextSectionIndex();
311 if (!
options().getCompareContext() &&
options().getCompareLines())
315 if (!
options().getCompareContext() &&
options().getCompareScopes())
319 if (!
options().getCompareContext() &&
options().getCompareSymbols())
320 Symbols.push_back(Symbol);
323 if (!
options().getCompareContext() &&
options().getCompareTypes())
350 static void setInstance(
LVReader *Reader);
355#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
BlockVerifier::State From
static SmallString< 128 > getFilename(const DIScope *SP)
Extract a filename for a DIScope.
#define LV_CREATE_OBJECT(KIND)
#define LV_OBJECT_ALLOCATOR(KIND)
mir Rename Register Operands
static cl::opt< std::string > InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"))
PowerPC Reduce CR logical Operation
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
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
LLVM_ABI bool printObject(const LVLocation *Location) const
LLVM_ABI 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
std::vector< LVAddressRange > CurrentRanges
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
LVReader(StringRef InputFilename, StringRef FileFormatName, ScopedPrinter &W, LVBinaryType BinaryType=LVBinaryType::NONE)
LVScopeCompileUnit * getCompileUnit() const
LVScopeRoot * getScopesRoot() const
virtual LVSectionIndex getSectionIndex(LVScope *Scope)
void setCompileUnit(LVScope *Scope)
LVOperation * createOperation(LVSmall OpCode, ArrayRef< LVUnsigned > Operands)
bool doPrintType(const LVType *Type) const
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
LLVM_ABI Error createSplitFolder(StringRef Where)
LLVM_ABI 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()
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.