LLVM: include/llvm/DebugInfo/LogicalView/Core/LVOptions.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOPTIONS_H

15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOPTIONS_H

16

24#include

25#include

26

27namespace llvm {

29

30

31#define BOOL_FUNCTION(FAMILY, FIELD) \

32 bool get##FAMILY##FIELD() const { return FAMILY.FIELD; } \

33 void set##FAMILY##FIELD() { FAMILY.FIELD = true; } \

34 void reset##FAMILY##FIELD() { FAMILY.FIELD = false; }

35

36

37#define UNSIGNED_FUNCTION(FAMILY, FIELD) \

38 unsigned get##FAMILY##FIELD() const { return FAMILY.FIELD; } \

39 void set##FAMILY##FIELD(unsigned Value) { FAMILY.FIELD = Value; } \

40 void reset##FAMILY##FIELD() { FAMILY.FIELD = -1U; }

41

42

43#define STD_STRING_FUNCTION(FAMILY, FIELD) \

44 std::string get##FAMILY##FIELD() const { return FAMILY.FIELD; } \

45 void set##FAMILY##FIELD(std::string FIELD) { \

46 FAMILY.FIELD = std::move(FIELD); \

47 } \

48 void reset##FAMILY##FIELD() { FAMILY.FIELD = ""; }

49

50

51#define STDSET_FUNCTION_4(FAMILY, FIELD, TYPE, SET) \

52 bool get##FAMILY##FIELD() const { \

53 return FAMILY.SET.find(TYPE::FIELD) != FAMILY.SET.end(); \

54 } \

55 void set##FAMILY##FIELD() { FAMILY.SET.insert(TYPE::FIELD); } \

56 void reset##FAMILY##FIELD() { FAMILY.SET.erase(TYPE::FIELD); }

57

58#define STDSET_FUNCTION_5(FAMILY, FIELD, ENTRY, TYPE, SET) \

59 bool get##FAMILY##FIELD##ENTRY() const { \

60 return FAMILY.SET.find(TYPE::ENTRY) != FAMILY.SET.end(); \

61 } \

62 void set##FAMILY##FIELD##ENTRY() { FAMILY.SET.insert(TYPE::ENTRY); }

63

64

65#define ATTRIBUTE_OPTION(FIELD) \

66 STDSET_FUNCTION_4(Attribute, FIELD, LVAttributeKind, Kinds)

67

68

69#define OUTPUT_OPTION(FIELD) \

70 STDSET_FUNCTION_4(Output, FIELD, LVOutputKind, Kinds)

71

72

73#define PRINT_OPTION(FIELD) STDSET_FUNCTION_4(Print, FIELD, LVPrintKind, Kinds)

74

75

76#define WARNING_OPTION(FIELD) \

77 STDSET_FUNCTION_4(Warning, FIELD, LVWarningKind, Kinds)

78

79

80#define COMPARE_OPTION(FIELD) \

81 STDSET_FUNCTION_4(Compare, FIELD, LVCompareKind, Elements)

82

83

84#define REPORT_OPTION(FIELD) \

85 STDSET_FUNCTION_4(Report, FIELD, LVReportKind, Kinds)

86

87

88#define INTERNAL_OPTION(FIELD) \

89 STDSET_FUNCTION_4(Internal, FIELD, LVInternalKind, Kinds)

90

92

133

142

150

164

173

182

192

193

194

195

196

197

199 class LVAttribute {

200 public:

202 bool Added = false;

203 bool AnyLocation = false;

204 bool AnySource = false;

205 bool Missing = false;

206 };

207

208 class LVCompare {

209 public:

211 bool Context = false;

212 bool Execute = false;

213 bool Print = false;

214 };

215

216 class LVPrint {

217 public:

219 bool AnyElement = false;

220 bool AnyLine = false;

221 bool Execute = false;

222 bool Formatting = true;

223 bool Offset = false;

224 bool SizesSummary = false;

225 };

226

227 class LVReport {

228 public:

230 bool AnyView = false;

231 bool Execute = false;

232 };

233

234 class LVSelect {

235 public:

236 bool IgnoreCase = false;

237 bool UseRegex = false;

238 bool Execute = false;

239 bool GenericKind = false;

240 bool GenericPattern = false;

241 bool OffsetPattern = false;

243 LVOffsetSet Offsets;

249 };

250

251 class LVOutput {

252 public:

255 std::string Folder;

256 unsigned Level = -1U;

257 };

258

259 class LVWarning {

260 public:

262 };

263

264 class LVInternal {

265 public:

267 };

268

269 class LVGeneral {

270 public:

271 bool CollectRanges = false;

272 };

273

274

275

276

277

278 size_t LastFilenameIndex = 0;

279

280

281

282 size_t IndentationSize = 0;

283

284

285

286 void calculateIndentationSize();

287

288public:

291 bool IndexChanged = (Index != LastFilenameIndex);

292 if (IndexChanged)

293 LastFilenameIndex = Index;

294 return IndexChanged;

295 }

296

297

300

305

306

307

308

309

310

311

314

324

325

367

368

377

378

387

388

405

406

414

415

422

423

429

430

437

438

440

442

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

445#endif

446};

447

450

452

453 enum class LVMatchMode {

454 None = 0,

455 Match,

456 NoCase,

457 Regex

458 };

459

460

461 struct LVMatch {

462 std::string Pattern;

463 std::shared_ptr RE;

464 LVMatchMode Mode = LVMatchMode::None;

465 };

466

467 using LVMatchInfo = std::vector;

468 LVMatchInfo GenericMatchInfo;

469 using LVMatchOffsets = std::vector<uint64_t>;

470 LVMatchOffsets OffsetMatchInfo;

471

472

478

479

485

486

487 template <typename T, typename U>

488 bool checkElementRequest(const T *Element, const U &Requests) const {

489 assert(Element && "Element must not be nullptr");

490 for (const auto &Request : Requests)

491 if ((Element->*Request)())

492 return true;

493

495 if ((Element->*Request)())

496 return true;

497 return false;

498 }

499

500

501 template <typename T, typename U, typename V>

502 void addRequest(const T &Selection, const U &Dispatch, V &Request) const {

503 for (const auto &Entry : Selection) {

504

505 typename U::const_iterator Iter = Dispatch.find(Entry);

506 if (Iter != Dispatch.end())

507 Request.push_back(Iter->second);

508 }

509 }

510

512

513 template <typename T, typename U>

514 void resolveGenericPatternMatch(T *Element, const U &Requests) {

515 assert(Element && "Element must not be nullptr");

516 auto CheckPattern = [this, Element]() -> bool {

517 return (Element->isNamed() &&

520 (Element->isTyped() &&

522 };

523 auto CheckOffset = [this, Element]() -> bool {

525 };

526 if ((options().getSelectGenericPattern() && CheckPattern()) ||

527 (options().getSelectOffsetPattern() && CheckOffset()) ||

528 ((Requests.size() || ElementRequest.size()) &&

529 checkElementRequest(Element, Requests)))

530 addElement(Element);

531 }

532

533 template

534 void resolveGenericPatternMatch(LVLine *Line, const U &Requests) {

535 assert(Line && "Line must not be nullptr");

536 auto CheckPattern = [this, Line]() -> bool {

540 };

541 auto CheckOffset = [this, Line]() -> bool {

543 };

544 if ((options().getSelectGenericPattern() && CheckPattern()) ||

545 (options().getSelectOffsetPattern() && CheckOffset()) ||

546 (Requests.size() && checkElementRequest(Line, Requests)))

547 addElement(Line);

548 }

549

551 bool IgnoreCase, bool UseRegex);

552

553public:

555

566

567

569 GenericMatchInfo.clear();

570 OffsetMatchInfo.clear();

571 ElementRequest.clear();

572 LineRequest.clear();

573 ScopeRequest.clear();

574 SymbolRequest.clear();

575 TypeRequest.clear();

576

577 options().resetSelectGenericKind();

578 options().resetSelectGenericPattern();

579 options().resetSelectOffsetPattern();

580 }

581

583 addRequest(Selection, ElementDispatch, ElementRequest);

584 }

586 addRequest(Selection, LineDispatch, LineRequest);

587 }

589 addRequest(Selection, ScopeDispatch, ScopeRequest);

590 }

592 addRequest(Selection, SymbolDispatch, SymbolRequest);

593 }

595 addRequest(Selection, TypeDispatch, TypeRequest);

596 }

597

599

601

608

610 resolveGenericPatternMatch(Line, LineRequest);

611 }

612

614 resolveGenericPatternMatch(Scope, ScopeRequest);

615 }

616

618 resolveGenericPatternMatch(Symbol, SymbolRequest);

619 }

620

622 resolveGenericPatternMatch(Type, TypeRequest);

623 }

624

626

627

630

631

637

639

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

642#endif

643};

644

646

647}

648}

649

650#endif

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

amdgpu AMDGPU DAG DAG Pattern Instruction Selection

static bool Execute(ProcessInfo &PI, StringRef Program, ArrayRef< StringRef > Args, std::optional< ArrayRef< StringRef > > Env, ArrayRef< std::optional< StringRef > > Redirects, unsigned MemoryLimit, std::string *ErrMsg, BitVector *AffinityMask, bool DetachProcess)

static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))

StringSet - A set-like wrapper for the StringMap.

The Input class is used to parse a yaml document into in-memory structs and vectors.

Lightweight error class with error context and mandatory checking.

StringRef - Represent a constant reference to a string, i.e.

StringSet - A wrapper for StringMap that provides set-like functionality.

The instances of the Type class are immutable: once they are created, they are never changed.

static LVElementDispatch & getDispatch()

static LVLineDispatch & getDispatch()

Definition LVOptions.h:198

LVReport Report

Definition LVOptions.h:319

PRINT_OPTION(Instructions)

ATTRIBUTE_OPTION(Directories)

size_t indentationSize() const

Definition LVOptions.h:313

LVOptions & operator=(const LVOptions &)=default

BOOL_FUNCTION(Attribute, Missing)

LVSortMode getSortMode() const

Definition LVOptions.h:385

WARNING_OPTION(Locations)

ATTRIBUTE_OPTION(Discriminator)

BOOL_FUNCTION(Select, Execute)

BOOL_FUNCTION(Select, GenericPattern)

static LLVM_ABI void setOptions(LVOptions *Options)

ATTRIBUTE_OPTION(Publics)

ATTRIBUTE_OPTION(Producer)

void resetFilenameIndex()

Definition LVOptions.h:289

BOOL_FUNCTION(Select, GenericKind)

LLVM_ABI void resolveDependencies()

LVInternal Internal

Definition LVOptions.h:322

ATTRIBUTE_OPTION(Linkage)

BOOL_FUNCTION(Print, Formatting)

STD_STRING_FUNCTION(Output, Folder)

ATTRIBUTE_OPTION(Underlying)

ATTRIBUTE_OPTION(Reference)

BOOL_FUNCTION(Compare, Execute)

ATTRIBUTE_OPTION(Qualifier)

UNSIGNED_FUNCTION(Output, Level)

BOOL_FUNCTION(Select, OffsetPattern)

LVWarning Warning

Definition LVOptions.h:321

BOOL_FUNCTION(Select, UseRegex)

static LLVM_ABI LVOptions * getOptions()

BOOL_FUNCTION(Print, AnyLine)

void dump() const

Definition LVOptions.h:444

INTERNAL_OPTION(Integrity)

LVAttribute Attribute

Definition LVOptions.h:315

BOOL_FUNCTION(Print, SizesSummary)

ATTRIBUTE_OPTION(Pathname)

ATTRIBUTE_OPTION(Extended)

ATTRIBUTE_OPTION(Qualified)

LVPrint Print

Definition LVOptions.h:318

LVGeneral General

Definition LVOptions.h:323

LLVM_ABI void print(raw_ostream &OS) const

BOOL_FUNCTION(Report, Execute)

bool changeFilenameIndex(size_t Index)

Definition LVOptions.h:290

BOOL_FUNCTION(Compare, Context)

BOOL_FUNCTION(Attribute, AnyLocation)

ATTRIBUTE_OPTION(Language)

BOOL_FUNCTION(Print, Offset)

ATTRIBUTE_OPTION(Filename)

ATTRIBUTE_OPTION(Location)

BOOL_FUNCTION(Print, AnyElement)

ATTRIBUTE_OPTION(Generated)

ATTRIBUTE_OPTION(Discarded)

ATTRIBUTE_OPTION(Encoded)

LVCompare Compare

Definition LVOptions.h:316

ATTRIBUTE_OPTION(Inserted)

void setSortMode(LVSortMode SortMode)

Definition LVOptions.h:386

ATTRIBUTE_OPTION(Standard)

WARNING_OPTION(Coverages)

ATTRIBUTE_OPTION(Coverage)

ATTRIBUTE_OPTION(Argument)

BOOL_FUNCTION(Report, AnyView)

LVOptions(const LVOptions &)=default

BOOL_FUNCTION(Select, IgnoreCase)

ATTRIBUTE_OPTION(Typename)

BOOL_FUNCTION(Attribute, Added)

ATTRIBUTE_OPTION(Subrange)

BOOL_FUNCTION(Attribute, AnySource)

ATTRIBUTE_OPTION(Register)

LVOutput Output

Definition LVOptions.h:317

BOOL_FUNCTION(General, CollectRanges)

LVSelect Select

Definition LVOptions.h:320

BOOL_FUNCTION(Compare, Print)

BOOL_FUNCTION(Print, Execute)

Definition LVOptions.h:451

LLVM_ABI void addGenericPatterns(StringSet<> &Patterns)

void resolvePatternMatch(LVType *Type)

Definition LVOptions.h:621

void resolvePatternMatch(LVLine *Line)

Definition LVOptions.h:609

LVPatterns()

Definition LVOptions.h:556

void addRequest(LVTypeKindSelection &Selection)

Definition LVOptions.h:594

bool matchOffsetPattern(LVOffset Offset)

Definition LVOptions.h:605

void resolvePatternMatch(LVScope *Scope)

Definition LVOptions.h:613

LLVM_ABI bool matchPattern(StringRef Input, const LVMatchInfo &MatchInfo)

void addRequest(LVElementKindSet &Selection)

Definition LVOptions.h:582

void addRequest(LVLineKindSet &Selection)

Definition LVOptions.h:585

LLVM_ABI bool printObject(const LVLocation *Location) const

LLVM_ABI void print(raw_ostream &OS) const

LLVM_ABI bool printElement(const LVLine *Line) const

LVPatterns(const LVPatterns &)=delete

LLVM_ABI void addPatterns(StringSet<> &Patterns, LVMatchInfo &Filters)

LLVM_ABI void updateReportOptions()

bool matchGenericPattern(StringRef Input)

Definition LVOptions.h:602

LLVM_ABI void addOffsetPatterns(const LVOffsetSet &Patterns)

void clear()

Definition LVOptions.h:568

void dump() const

Definition LVOptions.h:641

void resolvePatternMatch(LVSymbol *Symbol)

Definition LVOptions.h:617

void addRequest(LVSymbolKindSet &Selection)

Definition LVOptions.h:591

LVPatterns & operator=(const LVPatterns &)=delete

void addRequest(LVScopeKindSet &Selection)

Definition LVOptions.h:588

static LLVM_ABI LVPatterns * getPatterns()

static LVScopeDispatch & getDispatch()

static LVSymbolDispatch & getDispatch()

static LVTypeDispatch & getDispatch()

This class implements an extremely fast bulk output stream that can only output to a stream.

LVOutputKind

Definition LVOptions.h:143

@ Split

Definition LVOptions.h:145

@ Text

Definition LVOptions.h:147

@ Json

Definition LVOptions.h:146

std::set< LVInternalKind > LVInternalKindSet

Definition LVOptions.h:191

std::set< LVSymbolKind > LVSymbolKindSet

std::set< LVReportKind > LVReportKindSet

Definition LVOptions.h:172

std::map< LVLineKind, LVLineGetFunction > LVLineDispatch

std::vector< LVLineGetFunction > LVLineRequest

std::set< LVPrintKind > LVPrintKindSet

Definition LVOptions.h:163

void setOptions(LVOptions *Options)

Definition LVOptions.h:449

std::map< LVSymbolKind, LVSymbolGetFunction > LVSymbolDispatch

std::set< LVOutputKind > LVOutputKindSet

Definition LVOptions.h:149

std::vector< LVSymbolGetFunction > LVSymbolRequest

LVInternalKind

Definition LVOptions.h:183

@ Cmdline

Definition LVOptions.h:185

@ ID

Definition LVOptions.h:186

@ Tag

Definition LVOptions.h:189

@ Integrity

Definition LVOptions.h:187

LVPatterns & patterns()

Definition LVOptions.h:645

std::map< LVTypeKind, LVTypeGetFunction > LVTypeDispatch

std::map< LVScopeKind, LVScopeGetFunction > LVScopeDispatch

std::set< LVWarningKind > LVWarningKindSet

Definition LVOptions.h:181

std::vector< LVElementGetFunction > LVElementRequest

std::set< LVAttributeKind > LVAttributeKindSet

Definition LVOptions.h:132

std::vector< LVTypeGetFunction > LVTypeRequest

LVWarningKind

Definition LVOptions.h:174

@ Coverages

Definition LVOptions.h:176

@ Ranges

Definition LVOptions.h:179

@ Locations

Definition LVOptions.h:178

LVPrintKind

Definition LVOptions.h:151

@ Summary

Definition LVOptions.h:159

@ Instructions

Definition LVOptions.h:154

@ Sizes

Definition LVOptions.h:157

@ Elements

Definition LVOptions.h:153

@ Warnings

Definition LVOptions.h:161

std::set< LVTypeKind > LVTypeKindSelection

LVCompareKind

Definition LVOptions.h:134

@ Scopes

Definition LVOptions.h:137

@ Types

Definition LVOptions.h:139

LVReportKind

Definition LVOptions.h:165

@ View

Definition LVOptions.h:170

@ List

Definition LVOptions.h:168

@ Children

Definition LVOptions.h:167

@ Parents

Definition LVOptions.h:169

LVAttributeKind

Definition LVOptions.h:93

@ Underlying

Definition LVOptions.h:129

@ Base

Definition LVOptions.h:96

@ Register

Definition LVOptions.h:123

@ Pathname

Definition LVOptions.h:116

@ Filename

Definition LVOptions.h:103

@ Inserted

Definition LVOptions.h:109

@ Argument

Definition LVOptions.h:95

@ Discriminator

Definition LVOptions.h:100

@ Gaps

Definition LVOptions.h:106

@ Language

Definition LVOptions.h:110

@ Local

Definition LVOptions.h:113

@ Format

Definition LVOptions.h:105

@ Generated

Definition LVOptions.h:107

@ Publics

Definition LVOptions.h:118

@ Reference

Definition LVOptions.h:122

@ Size

Definition LVOptions.h:124

@ Qualified

Definition LVOptions.h:119

@ Qualifier

Definition LVOptions.h:120

@ Linkage

Definition LVOptions.h:112

@ Range

Definition LVOptions.h:121

@ Subrange

Definition LVOptions.h:126

@ Files

Definition LVOptions.h:104

@ Coverage

Definition LVOptions.h:97

@ Level

Definition LVOptions.h:111

@ System

Definition LVOptions.h:127

@ Producer

Definition LVOptions.h:117

@ Encoded

Definition LVOptions.h:101

@ All

Definition LVOptions.h:94

@ Location

Definition LVOptions.h:114

@ Zero

Definition LVOptions.h:130

@ Offset

Definition LVOptions.h:115

@ Typename

Definition LVOptions.h:128

@ Extended

Definition LVOptions.h:102

@ Directories

Definition LVOptions.h:98

std::set< LVScopeKind > LVScopeKindSet

bool(LVElement::*)() const LVElementGetFunction

std::vector< LVScopeGetFunction > LVScopeRequest

std::set< uint64_t > LVOffsetSet

Definition LVOptions.h:91

std::map< LVElementKind, LVElementGetFunction > LVElementDispatch

LVOptions & options()

Definition LVOptions.h:448

std::set< LVLineKind > LVLineKindSet

std::set< LVCompareKind > LVCompareKindSet

Definition LVOptions.h:141

std::set< LVElementKind > LVElementKindSet

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.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.