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

24#include

25

26namespace llvm {

28

30

33

35 std::unique_ptr OutputFile;

36 std::string Location;

37

38public:

43

48 if (OutputFile) {

49 OutputFile->os().close();

50 OutputFile = nullptr;

51 }

52 }

53

54 std::string getLocation() const { return Location; }

56};

57

58

59

60

63

64

66

67

68 using LVCompileUnits = std::map<LVOffset, LVScopeCompileUnit *>;

69 LVCompileUnits CompileUnits;

70

71

76

77

78 Error createSplitFolder();

79 bool OutputSplit = false;

80

81

82#define LV_OBJECT_ALLOCATOR(KIND) \

83 llvm::SpecificBumpPtrAllocator<LV##KIND> Allocated##KIND;

84

85

89

90

93

94

96

97

112

113

115

116

123

124#undef LV_OBJECT_ALLOCATOR

125

126

127

128

129 using LVSectionRanges = std::map<LVSectionIndex, std::unique_ptr>;

130 LVSectionRanges SectionRanges;

131

132protected:

133

140

141

143

150

151

153

158

159

163

165

166

168 Root = createScopeRoot();

170 if (options().getAttributeFormat())

173 }

174

175

176

177

178

179

180

182

183

189 return std::string(Path);

190 }

191

192 virtual Error printScopes();

193 virtual Error printMatchedElements(bool UseMatchedElements);

195

196public:

200 : BinaryType(BinaryType), OutputSplit(options().getOutputSplit()),

202 OS(W.getOStream()) {}

206

207

208

209

210

211

212

213

214#define LV_CREATE_OBJECT(KIND) \

215 LV##KIND *create##KIND() { \

216 return new (Allocated##KIND.Allocate()) LV##KIND(); \

217 }

218

219

223

224

227

228

243

244

246

247

254

255#undef LV_CREATE_OBJECT

256

257

259 return new (AllocatedOperation.Allocate()) LVOperation(OpCode, Operands);

260 }

261

266

268

272

275 assert(Scope && Scope->isCompileUnit() && "Scope is not a compile unit");

277 }

284

285

287

290

296

301

305

306

308

309

311 if (options().getCompareContext() && options().getCompareLines())

312 Lines.push_back(Line);

313 }

315 if (options().getCompareContext() && options().getCompareScopes())

316 Scopes.push_back(Scope);

317 }

319 if (options().getCompareContext() && options().getCompareSymbols())

320 Symbols.push_back(Symbol);

321 }

323 if (options().getCompareContext() && options().getCompareTypes())

324 Types.push_back(Type);

325 }

326

331

332

340 return patterns().printElement(Scope);

341 }

343 return patterns().printElement(Symbol);

344 }

348

349 static LVReader &getInstance();

350 static void setInstance(LVReader *Reader);

351

354

355#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

357#endif

358};

359

367

368}

369}

370

371#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)

static SmallString< 128 > getFilename(const DIScope *SP, vfs::FileSystem &VFS)

Extract a filename for a DIScope.

#define LV_CREATE_OBJECT(KIND)

Definition LVReader.h:214

#define LV_OBJECT_ALLOCATOR(KIND)

Definition LVReader.h:82

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.

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.

The logical reader owns of all the logical elements created during the debug information parsing.

Definition LVReader.h:61

ScopedPrinter & W

Definition LVReader.h:147

virtual void sortScopes()

Definition LVReader.h:194

StringRef getFileFormatName() const

Definition LVReader.h:265

LVRange * getSectionRanges(LVSectionIndex SectionIndex)

void addCompileUnitOffset(LVOffset Offset, LVScopeCompileUnit *CompileUnit)

Definition LVReader.h:160

bool doPrintLine(const LVLine *Line) const

Definition LVReader.h:333

LVSymbol * CurrentSymbol

Definition LVReader.h:136

LVType * CurrentType

Definition LVReader.h:137

std::vector< LVAddressRange > CurrentRanges

Definition LVReader.h:142

const LVTypes & getTypes() const

Definition LVReader.h:330

std::string FileFormatName

Definition LVReader.h:146

void notifyAddedElement(LVType *Type)

Definition LVReader.h:322

void notifyAddedElement(LVLine *Line)

Definition LVReader.h:310

virtual std::string getRegisterName(LVSmall Opcode, ArrayRef< uint64_t > Operands)

Definition LVReader.h:291

const LVSymbols & getSymbols() const

Definition LVReader.h:329

void notifyAddedElement(LVSymbol *Symbol)

Definition LVReader.h:318

raw_ostream & outputStream()

Definition LVReader.h:267

codeview::CPUType getCompileUnitCPUType()

Definition LVReader.h:281

std::string createAlternativePath(StringRef From)

Definition LVReader.h:181

const LVLines & getLines() const

Definition LVReader.h:327

LVElement * CurrentElement

Definition LVReader.h:134

LVReader(const LVReader &)=delete

bool doPrintSymbol(const LVSymbol *Symbol) const

Definition LVReader.h:342

void setFilename(std::string Name)

Definition LVReader.h:264

bool isBinaryTypeCOFF() const

Definition LVReader.h:271

bool isBinaryTypeNone() const

Definition LVReader.h:269

LVSectionIndex getDotTextSectionIndex() const

Definition LVReader.h:297

void setCompileUnitCPUType(codeview::CPUType Type)

Definition LVReader.h:278

LVReader & operator=(const LVReader &)=delete

bool doPrintLocation(const LVLocation *Location) const

Definition LVReader.h:336

virtual bool isSystemEntry(LVElement *Element, StringRef Name={}) const

Definition LVReader.h:302

std::string InputFilename

Definition LVReader.h:145

LVSplitContext & getSplitContext()

Definition LVReader.h:307

LVScope * CurrentScope

Definition LVReader.h:135

bool isBinaryTypeELF() const

Definition LVReader.h:270

virtual ~LVReader()=default

StringRef getFilename() const

Definition LVReader.h:263

static LVReader & getInstance()

const LVScopes & getScopes() const

Definition LVReader.h:328

LVScopeCompileUnit * CompileUnit

Definition LVReader.h:149

LVReader(StringRef InputFilename, StringRef FileFormatName, ScopedPrinter &W, LVBinaryType BinaryType=LVBinaryType::NONE)

Definition LVReader.h:198

LVScopeCompileUnit * getCompileUnit() const

Definition LVReader.h:273

LVLine * CurrentLine

Definition LVReader.h:138

LVScopeRoot * getScopesRoot() const

Definition LVReader.h:286

virtual LVSectionIndex getSectionIndex(LVScope *Scope)

Definition LVReader.h:298

LVSectionIndex DotTextSectionIndex

Definition LVReader.h:152

LVScopeRoot * Root

Definition LVReader.h:144

void setCompileUnit(LVScope *Scope)

Definition LVReader.h:274

LVOperation * createOperation(LVSmall OpCode, ArrayRef< LVUnsigned > Operands)

Definition LVReader.h:258

bool doPrintType(const LVType *Type) const

Definition LVReader.h:345

void addSectionRange(LVSectionIndex SectionIndex, LVScope *Scope)

LVOffset CurrentOffset

Definition LVReader.h:139

raw_ostream & OS

Definition LVReader.h:148

void dump() const

Definition LVReader.h:356

virtual Error createScopes()

Definition LVReader.h:167

bool doPrintScope(const LVScope *Scope) const

Definition LVReader.h:339

void notifyAddedElement(LVScope *Scope)

Definition LVReader.h:314

virtual void printRecords(raw_ostream &OS) const

Definition LVReader.h:353

std::string getLocation() const

Definition LVReader.h:54

raw_fd_ostream & os()

Definition LVReader.h:55

void close()

Definition LVReader.h:47

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....

LVReader & getReader()

Definition LVReader.h:360

constexpr LVSectionIndex UndefinedSectionIndex

Definition LVReader.h:29

LVScopeCompileUnit * getReaderCompileUnit()

Definition LVReader.h:364

SmallVector< LVScope *, 8 > LVScopes

SmallVector< LVSymbol *, 8 > LVSymbols

LVSplitContext & getReaderSplitContext()

Definition LVReader.h:361

SmallVector< LVLine *, 8 > LVLines

SmallVector< LVType *, 8 > LVTypes

LLVM_ABI StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get parent path.

LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get filename.

LLVM_ABI std::string convert_to_slash(StringRef path, Style style=Style::native)

Replaces backslashes with slashes if Windows.

LLVM_ABI 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.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.