14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 15 #define LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 35 #include <unordered_map> 49 class MachineFunction;
58 struct LocalVarDefRange {
67 uint16_t IsSubfield : 1;
70 uint16_t StructOffset : 15;
78 bool isDifferentLocation(LocalVarDefRange &
O) {
79 return InMemory != O.InMemory || DataOffset != O.DataOffset ||
80 IsSubfield != O.IsSubfield || StructOffset != O.StructOffset ||
81 CVRegister != O.CVRegister;
87 static LocalVarDefRange createDefRangeMem(uint16_t CVRegister,
int Offset);
88 static LocalVarDefRange createDefRangeGeneral(uint16_t CVRegister,
89 bool InMemory,
int Offset,
91 uint16_t StructOffset);
94 struct LocalVariable {
97 bool UseReferenceType =
false;
107 unsigned SiteFuncId = 0;
111 struct LexicalBlock {
121 struct FunctionInfo {
122 FunctionInfo() =
default;
125 FunctionInfo(
const FunctionInfo &FI) =
delete;
129 std::unordered_map<const DILocation *, InlineSite> InlineSites;
136 std::unordered_map<const DILexicalBlockBase*, LexicalBlock> LexicalBlocks;
141 std::vector<std::pair<MCSymbol *, MDNode *>> Annotations;
146 unsigned LastFileId = 0;
147 bool HaveLineInfo =
false;
149 FunctionInfo *CurFn =
nullptr;
167 void switchToDebugSectionForSymbol(
const MCSymbol *GVSym);
171 unsigned NextFuncId = 0;
173 InlineSite &getInlineSite(
const DILocation *InlinedAt,
178 void calculateRanges(LocalVariable &Var,
182 const FunctionInfo &FI,
183 const InlineSite &Site);
214 unsigned TypeEmissionLevel = 0;
222 std::vector<std::pair<std::string, const DIType *>> LocalUDTs;
223 std::vector<std::pair<std::string, const DIType *>> GlobalUDTs;
225 using FileToFilepathMapTy = std::map<const DIFile *, std::string>;
226 FileToFilepathMapTy FileToFilepathMap;
230 unsigned maybeRecordFile(
const DIFile *
F);
237 CurrentSubprogram = SP;
244 void emitCodeViewMagicVersion();
246 void emitTypeInformation();
248 void emitTypeGlobalHashes();
250 void emitCompilerInformation();
252 void emitInlineeLinesSubsection();
254 void emitDebugInfoForThunk(
const Function *GV,
258 void emitDebugInfoForFunction(
const Function *GV, FunctionInfo &FI);
260 void emitDebugInfoForGlobals();
262 void emitDebugInfoForRetainedTypes();
265 emitDebugInfoForUDTs(
ArrayRef<std::pair<std::string, const DIType *>> UDTs);
275 void endCVSubsection(
MCSymbol *EndLabel);
277 void emitInlinedCallSite(
const FunctionInfo &FI,
const DILocation *InlinedAt,
278 const InlineSite &Site);
297 void recordLocalVariable(LocalVariable &&Var,
const LexicalScope *
LS);
303 void emitLocalVariable(
const LocalVariable &Var);
307 const FunctionInfo& FI);
310 void emitLexicalBlock(
const LexicalBlock &Block,
const FunctionInfo& FI);
326 void addToUDTs(
const DIType *Ty);
346 bool IsStaticMethod);
363 void emitDeferredCompleteTypes();
371 std::tuple<codeview::TypeIndex, codeview::TypeIndex, unsigned, bool>
377 const DIType *ClassTy =
nullptr);
379 unsigned getPointerSizeInBytes();
394 void endModule()
override;
402 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
Compute iterated dominance frontiers using a linear time algorithm.
std::pair< const DILocalVariable *, const DILocation * > InlinedVariable
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Implements a dense probed hash-table based set.
This class implements a map that also provides access to all stored values in a deterministic order...
LexicalScope - This class is used to track scope information.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
Tagged DWARF-like metadata node.
void setSymbolSize(const MCSymbol *, uint64_t) override
For symbols that have a size designated (e.g.
Holds a subclass of DINode.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Streaming machine code generation interface.
Allocate memory in an ever growing pool, as if by bump-pointer.
This class is intended to be used as a driving class for all asm writers.
Base class for scope-like contexts.
PointerOptions
Equivalent to misc lfPointerAttr bitfields.
A SetVector that performs no allocations if smaller than a certain size.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Collects and handles line tables information in a CodeView format.
static void clear(coro::Shape &Shape)
Type array for a subprogram.
Representation of each machine instruction.
Base class for debug information backends.
StringRef - Represent a constant reference to a string, i.e.
TypedDINodeRef< DIType > DITypeRef
Basic type, like 'int' or 'float'.