LLVM: include/llvm/DebugInfo/LogicalView/Core/LVScope.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
16
21#include
22#include
23#include
24
25namespace llvm {
26namespace logicalview {
27
28
29using LVNameInfo = std::pair<LVAddress, uint64_t>;
32
34
61};
65
71
72
74 enum class Property {
76 CanHaveRanges,
77 CanHaveLines,
78 HasGlobals,
79 HasLocals,
80 HasLines,
81 HasScopes,
82 HasSymbols,
83 HasTypes,
84 IsComdat,
85 HasComdatScopes,
86 HasRanges,
87 AddedMissing,
89 };
90
91
95
96
97 unsigned CoverageFactor = 0;
98
99
100 void calculateCoverage() {
101 float CoveragePercentage = 0;
103 CoveragePercentage);
104 }
105
106
107
108 bool resolvePrinting() const;
109
110
112
113
114
117
118protected:
119
125
126
127
128
129
130
131
133
134
137
141
142
145
146public:
148 setIsScope();
149 setIncludeInPrint();
150 }
154
157 }
158
166 TransformName);
184
198
199 bool isCompileUnit() const override { return getIsCompileUnit(); }
200 bool isRoot() const override { return getIsRoot(); }
201
202 const char *kind() const override;
203
204
211
220
221
222
224
225
226
229
230
236
237
239
240
242 bool RecordInvalid = false);
244 bool RecordInvalid = false);
246
248
250 bool Full = true) const override;
251
252
254
255
257
258
260
263 }
264
265
266
268
271
275
276
278
281
283
284
285
286
289 bool TraverseChildren);
290
291
292
294
295
296
298
299
301
302
303
305
306
307
309
310
312
314
319
320#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
322#endif
323};
324
325
327 LVScope *Reference = nullptr;
328 size_t EncodedArgsIndex = 0;
329
330public:
335
336
340 setHasReference();
341 }
344 }
345
348 }
351 }
352
353
355
356
357
359
361};
362
363
365public:
367 setIsTemplateAlias();
368 setIsTemplate();
369 }
373
374
376
378};
379
380
382public:
387
389
390
392
394};
395
396
398
399 std::vector<size_t> Filenames;
400
401
402
403
404
406
407
408 size_t ProducerIndex = 0;
409
410
411 size_t CompilationDirectoryIndex = 0;
412
413
415
416
417
421
422
425
426
427
428
429
430 using LVAddressToLine = std::map<LVAddress, LVLine *>;
432
433
435
436
437
439
440
442
443
445
446
448
449
451
452
453 using LVSizesMap = std::map<const LVScope *, LVOffset>;
454 LVSizesMap Sizes;
455 LVOffset CUContributionSize = 0;
456
457
462 addItem<LVOffsetLocationsMap, LVOffset, LVLocation *>(Map, Offset,
464 }
465
466
467
468 const size_t TotalInitialSize = 8;
469 using LVTotalsEntry = std::pair<unsigned, float>;
471
472
473 LVLevel MaxSeenLevel = 0;
474
475
478
482 }
484
485protected:
488
489public:
491 setIsCompileUnit();
492 }
496
499 }
500
501
504
507 PublicNames.emplace(std::piecewise_construct, std::forward_as_tuple(Scope),
508 std::forward_as_tuple(LowPC, HighPC - LowPC));
509 }
511 LVPublicNames::iterator Iter = PublicNames.find(Scope);
512 return (Iter != PublicNames.end()) ? Iter->second : NameNone;
513 }
515
516
517
518
519
521 return Ranges ? Ranges->front()->getLowerAddress() : 0;
522 }
523
526 }
529 }
530
534 }
535
538 }
541 }
542
545
546
548
550
552
554
556
558
562 return InvalidLocations;
563 }
565 return InvalidCoverages;
566 }
569
570
573
574
578
581
584 const char *Header) const;
585
590
591
596
597
598
599
604
606
607
609
614};
615
616
618public:
623
624
626
628};
629
630
631
633public:
638
639
641
643};
644
645
647 LVScope *Reference = nullptr;
648 size_t LinkageNameIndex = 0;
649 size_t EncodedArgsIndex = 0;
650
651public:
656
657
661 setHasReference();
662 }
665 }
666
669 }
672 }
673
676 }
679 }
681
683
686
687
689
690
691
693
695};
696
697
699 size_t CallFilenameIndex = 0;
702
703public:
708
712 setHasDiscriminator();
713 }
714
719 CallFilenameIndex = Index;
720 }
721
722
723
726 }
727
729
730
732
733
734
736
738};
739
740
742public:
747
749};
750
751
753 LVScope *Reference = nullptr;
754
755public:
760
761
765 setHasReference();
766 }
769 }
770
771
773
774
775
777
779};
780
781
783 size_t FileFormatNameIndex = 0;
784
785public:
790
793 }
796 }
797
798
799
801
802
804
805
807
811 bool UseMatchedElements) const;
812};
813
814
815
817public:
822
823
825
827};
828
829}
830}
831
832#endif
Lightweight error class with error context and mandatory checking.
Pass interface - Implemented by all 'passes'.
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
virtual LVScope * getCompileUnitParent() const
StringRef getQualifiedName() const
LVSubclassID getSubclassID() const
static bool calculateCoverage(LVLocations *Locations, unsigned &Factor, float &Percentage)
std::string lineAsString(uint32_t LineNumber, LVHalf Discriminator, bool ShowZero) const
LVOffset getOffset() const
LVScopeAggregate & operator=(const LVScopeAggregate &)=delete
void setEncodedArgs(StringRef EncodedArgs) override
void printExtra(raw_ostream &OS, bool Full=true) const override
~LVScopeAggregate()=default
StringRef getEncodedArgs() const override
void setReference(LVScope *Scope) override
LVScope * getReference() const override
LVScopeAggregate(const LVScopeAggregate &)=delete
bool equals(const LVScope *Scope) const override
LVScope * findEqualScope(const LVScopes *Scopes) const override
void setReference(LVElement *Element) override
LVScopeAlias(const LVScopeAlias &)=delete
bool equals(const LVScope *Scope) const override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeAlias & operator=(const LVScopeAlias &)=delete
void resolveExtra() override
LVScopeArray(const LVScopeArray &)=delete
bool equals(const LVScope *Scope) const override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeArray & operator=(const LVScopeArray &)=delete
const LVScopes & getMatchedScopes() const
void propagatePatternMatch()
void addDebugTag(dwarf::Tag Target, LVOffset Offset)
void printSummary(raw_ostream &OS) const override
void addedElement(LVLine *Line)
const LVOffsetElementMap & getWarningOffsets() const
void addFilename(StringRef Name)
void printExtra(raw_ostream &OS, bool Full=true) const override
void printMatchedElements(raw_ostream &OS, bool UseMatchedElements) override
void setProducer(StringRef ProducerName) override
LVLineRange lineRange(LVLocation *Location) const
void addMapping(LVLine *Line, LVSectionIndex SectionIndex)
codeview::CPUType getCPUType()
void addMatched(LVElement *Element)
void addInvalidLocation(LVLocation *Location)
void incrementPrintedScopes()
void increment(LVLine *Line)
LVScopeCompileUnit & operator=(const LVScopeCompileUnit &)=delete
~LVScopeCompileUnit()=default
const LVOffsetLocationsMap & getInvalidRanges() const
const LVTagOffsetsMap & getDebugTags() const
void addLineZero(LVLine *Line)
LVScopeCompileUnit(const LVScopeCompileUnit &)=delete
void addMatched(LVScope *Scope)
const LVOffsetSymbolMap & getInvalidCoverages() const
const LVPublicNames & getPublicNames() const
void setCPUType(codeview::CPUType Type)
void addInvalidOffset(LVOffset Offset, LVElement *Element)
void setCompilationDirectory(StringRef CompilationDirectory)
LVAddress getBaseAddress() const
const LVElements & getMatchedElements() const
const LVOffsetLinesMap & getLinesZero() const
void addInvalidCoverage(LVSymbol *Symbol)
void addSize(LVScope *Scope, LVOffset Lower, LVOffset Upper)
void processRangeLocationCoverage(LVValidLocation ValidLocation=&LVLocation::validateRanges)
void incrementPrintedLines()
StringRef getCompilationDirectory() const
void addPublicName(LVScope *Scope, LVAddress LowPC, LVAddress HighPC)
StringRef getFilename(size_t Index) const
const LVOffsetLocationsMap & getInvalidLocations() const
void print(raw_ostream &OS, bool Full=true) const override
bool equals(const LVScope *Scope) const override
void printSizes(raw_ostream &OS) const override
void addInvalidRange(LVLocation *Location)
void printLocalNames(raw_ostream &OS, bool Full=true) const
StringRef getProducer() const override
const LVNameInfo & findPublicName(LVScope *Scope)
void incrementPrintedSymbols()
void incrementPrintedTypes()
void printWarnings(raw_ostream &OS, bool Full=true) const override
LVScope * getCompileUnitParent() const override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeEnumeration(const LVScopeEnumeration &)=delete
~LVScopeEnumeration()=default
LVScopeEnumeration & operator=(const LVScopeEnumeration &)=delete
bool equals(const LVScope *Scope) const override
LVScopeFormalPack(const LVScopeFormalPack &)=delete
~LVScopeFormalPack()=default
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeFormalPack & operator=(const LVScopeFormalPack &)=delete
bool equals(const LVScope *Scope) const override
LVScope * findEqualScope(const LVScopes *Scopes) const override
LVScopeFunctionInlined(const LVScopeFunctionInlined &)=delete
void setDiscriminator(uint32_t Value) override
LVScopeFunctionInlined & operator=(const LVScopeFunctionInlined &)=delete
uint32_t getCallLineNumber() const override
void setCallLineNumber(uint32_t Number) override
void resolveExtra() override
bool equals(const LVScope *Scope) const override
uint32_t getDiscriminator() const override
std::string lineNumberAsString(bool ShowZero=false) const override
size_t getCallFilenameIndex() const override
void printExtra(raw_ostream &OS, bool Full=true) const override
~LVScopeFunctionInlined()=default
void setCallFilenameIndex(size_t Index) override
LVScopeFunctionType(const LVScopeFunctionType &)=delete
void resolveExtra() override
LVScopeFunctionType & operator=(const LVScopeFunctionType &)=delete
~LVScopeFunctionType()=default
virtual ~LVScopeFunction()=default
void setLinkageName(StringRef LinkageName) override
void setName(StringRef ObjectName) override
LVScope * getReference() const override
void setEncodedArgs(StringRef EncodedArgs) override
LVScope * findEqualScope(const LVScopes *Scopes) const override
size_t getLinkageNameIndex() const override
LVScopeFunction(const LVScopeFunction &)=delete
void setReference(LVScope *Scope) override
StringRef getEncodedArgs() const override
LVScopeFunction & operator=(const LVScopeFunction &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
StringRef getLinkageName() const override
bool equals(const LVScope *Scope) const override
void resolveReferences() override
void setReference(LVElement *Element) override
void resolveExtra() override
LVScopeNamespace & operator=(const LVScopeNamespace &)=delete
LVScopeNamespace(const LVScopeNamespace &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
bool equals(const LVScope *Scope) const override
LVScope * findEqualScope(const LVScopes *Scopes) const override
~LVScopeNamespace()=default
LVScope * getReference() const override
void setReference(LVScope *Scope) override
void setReference(LVElement *Element) override
void processRangeInformation()
void transformScopedName()
LVScopeRoot & operator=(const LVScopeRoot &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
StringRef getFileFormatName() const
Error doPrintMatches(bool Split, raw_ostream &OS, bool UseMatchedElements) const
void print(raw_ostream &OS, bool Full=true) const override
void setFileFormatName(StringRef FileFormatName)
bool equals(const LVScope *Scope) const override
LVScopeRoot(const LVScopeRoot &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
bool equals(const LVScope *Scope) const override
~LVScopeTemplatePack()=default
LVScopeTemplatePack(const LVScopeTemplatePack &)=delete
LVScopeTemplatePack & operator=(const LVScopeTemplatePack &)=delete
virtual LVScope * getReference() const
void addElement(LVElement *Element)
void traverseParentsAndChildren(LVObjectGetFunction GetFunction, LVObjectSetFunction SetFunction)
LVScope & operator=(const LVScope &)=delete
static LVScopeDispatch & getDispatch()
const LVLines * getLines() const
virtual void printSummary(raw_ostream &OS) const
PROPERTY(Property, CanHaveLines)
StringRef resolveReferencesChain()
KIND_2(LVScopeKind, IsBlock, CanHaveRanges, CanHaveLines)
KIND_1(LVScopeKind, IsLexicalBlock, IsBlock)
bool isCompileUnit() const override
KIND(LVScopeKind, IsEnumeration)
void printExtra(raw_ostream &OS, bool Full=true) const override
void report(LVComparePass Pass) override
static bool classof(const LVElement *Element)
KIND(LVScopeKind, IsTemplatePack)
virtual ~LVScope()=default
const char * kind() const override
virtual LVScope * findEqualScope(const LVScopes *Scopes) const
PROPERTY(Property, HasLines)
PROPERTY(Property, HasTypes)
const LVScopes * getScopes() const
KIND_1(LVScopeKind, IsSubprogram, IsFunction)
void print(raw_ostream &OS, bool Full=true) const override
void resolveName() override
PROPERTY(Property, HasDiscriminator)
PROPERTY(Property, HasLocals)
PROPERTY(Property, HasGlobals)
void printActiveRanges(raw_ostream &OS, bool Full=true) const
size_t scopeCount() const
KIND_1(LVScopeKind, IsCallSite, IsFunction)
const LVSymbols * getSymbols() const
KIND(LVScopeKind, IsTemplate)
PROPERTY(Property, HasSymbols)
virtual void printMatchedElements(raw_ostream &OS, bool UseMatchedElements)
PROPERTY(Property, CanHaveRanges)
virtual void setEncodedArgs(StringRef EncodedArgs)
void printEncodedArgs(raw_ostream &OS, bool Full) const
PROPERTY(Property, IsComdat)
bool isRoot() const override
KIND(LVScopeKind, IsNamespace)
PROPERTY(Property, AddedMissing)
void updateLevel(LVScope *Parent, bool Moved) override
KIND(LVScopeKind, IsTemplateAlias)
PROPERTY(Property, HasScopes)
KIND_3(LVScopeKind, IsCompileUnit, CanHaveRanges, CanHaveLines, TransformName)
LVScope * outermostParent(LVAddress Address)
std::unique_ptr< LVLocations > Ranges
KIND_1(LVScopeKind, IsUnion, IsAggregate)
void addToChildren(LVElement *Element)
static void markMissingParents(const LVScopes *References, const LVScopes *Targets, bool TraverseChildren)
KIND(LVScopeKind, IsMember)
std::unique_ptr< LVSymbols > Symbols
const LVTypes * getTypes() const
void encodeTemplateArguments(std::string &Name) const
void addObject(LVLocation *Location)
const LVElements * getChildren() const
KIND_1(LVScopeKind, IsCatchBlock, IsBlock)
LVScope * getCompileUnitParent() const override
KIND_1(LVScopeKind, IsTryBlock, IsBlock)
virtual void printSizes(raw_ostream &OS) const
std::unique_ptr< LVElements > Children
std::unique_ptr< LVTypes > Types
LVScope(const LVScope &)=delete
virtual bool equals(const LVScope *Scope) const
KIND_1(LVScopeKind, IsStructure, IsAggregate)
bool getTemplateParameterTypes(LVTypes &Params)
virtual StringRef getEncodedArgs() const
std::unique_ptr< LVLines > Lines
KIND(LVScopeKind, IsAggregate)
void getLocations(LVLocations &LocationList, LVValidLocation ValidLocation, bool RecordInvalid=false)
unsigned getCoverageFactor() const
Error doPrint(bool Split, bool Match, bool Print, raw_ostream &OS, bool Full=true) const override
virtual bool equalNumberOfChildren(const LVScope *Scope) const
KIND_1(LVScopeKind, IsLabel, IsFunction)
void addMissingElements(LVScope *Reference)
virtual void printWarnings(raw_ostream &OS, bool Full=true) const
void resolveReferences() override
KIND_1(LVScopeKind, IsFunctionType, IsFunction)
std::unique_ptr< LVScopes > Scopes
const LVLocations * getRanges() const
PROPERTY(Property, HasComdatScopes)
KIND_1(LVScopeKind, IsRoot, TransformName)
KIND_1(LVScopeKind, IsClass, IsAggregate)
PROPERTY(Property, HasRanges)
KIND(LVScopeKind, IsArray)
size_t symbolCount() const
KIND_1(LVScopeKind, IsEntryPoint, IsFunction)
bool removeElement(LVElement *Element) override
size_t rangeCount() const
KIND_2(LVScopeKind, IsFunction, CanHaveRanges, CanHaveLines)
void dump() const override
KIND_2(LVScopeKind, IsInlinedFunction, IsFunction, IsInlined)
StringRef getString(size_t Index) const
size_t getIndex(StringRef Key)
This class implements an extremely fast bulk output stream that can only output to a stream.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
std::map< LVOffset, LVElement * > LVOffsetElementMap
std::set< LVScopeKind > LVScopeKindSet
LVStringPool & getStringPool()
std::pair< LVLine *, LVLine * > LVLineRange
std::pair< LVAddress, uint64_t > LVNameInfo
std::map< LVScopeKind, LVScopeGetFunction > LVScopeDispatch
std::map< LVScope *, LVNameInfo > LVPublicNames
std::map< LVOffset, LVLocations > LVOffsetLocationsMap
bool(LVObject::*)() const LVObjectGetFunction
std::map< dwarf::Tag, LVOffsets > LVTagOffsetsMap
bool(LVScope::*)() const LVScopeGetFunction
bool(LVLocation::*)() LVValidLocation
std::vector< LVScopeGetFunction > LVScopeRequest
std::map< LVOffset, LVSymbol * > LVOffsetSymbolMap
void(LVObject::*)() LVObjectSetFunction
std::map< LVOffset, LVLines > LVOffsetLinesMap
std::map< LVAddress, LVNameInfo > LVPublicAddresses
void(LVScope::*)() LVScopeSetFunction
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.