1321369Sdim//===- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h --------------*- C++ -*-===// 2303231Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6303231Sdim// 7303231Sdim//===----------------------------------------------------------------------===// 8303231Sdim// 9303231Sdim// This file contains support for writing Microsoft CodeView debug info. 10303231Sdim// 11303231Sdim//===----------------------------------------------------------------------===// 12303231Sdim 13303231Sdim#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 14303231Sdim#define LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 15303231Sdim 16321369Sdim#include "llvm/ADT/ArrayRef.h" 17303231Sdim#include "llvm/ADT/DenseMap.h" 18321369Sdim#include "llvm/ADT/DenseSet.h" 19321369Sdim#include "llvm/ADT/MapVector.h" 20353358Sdim#include "llvm/ADT/PointerUnion.h" 21321369Sdim#include "llvm/ADT/SetVector.h" 22321369Sdim#include "llvm/ADT/SmallVector.h" 23344779Sdim#include "llvm/CodeGen/DbgEntityHistoryCalculator.h" 24344779Sdim#include "llvm/CodeGen/DebugHandlerBase.h" 25321369Sdim#include "llvm/DebugInfo/CodeView/CodeView.h" 26327952Sdim#include "llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h" 27303231Sdim#include "llvm/DebugInfo/CodeView/TypeIndex.h" 28303231Sdim#include "llvm/IR/DebugLoc.h" 29321369Sdim#include "llvm/Support/Allocator.h" 30321369Sdim#include "llvm/Support/Compiler.h" 31321369Sdim#include <cstdint> 32321369Sdim#include <map> 33321369Sdim#include <string> 34321369Sdim#include <tuple> 35321369Sdim#include <unordered_map> 36321369Sdim#include <utility> 37321369Sdim#include <vector> 38303231Sdim 39303231Sdimnamespace llvm { 40303231Sdim 41321369Sdimstruct ClassInfo; 42303231Sdimclass StringRef; 43321369Sdimclass AsmPrinter; 44321369Sdimclass Function; 45321369Sdimclass GlobalVariable; 46321369Sdimclass MCSectionCOFF; 47321369Sdimclass MCStreamer; 48321369Sdimclass MCSymbol; 49321369Sdimclass MachineFunction; 50303231Sdim 51341825Sdim/// Collects and handles line tables information in a CodeView format. 52303231Sdimclass LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { 53303231Sdim MCStreamer &OS; 54321369Sdim BumpPtrAllocator Allocator; 55327952Sdim codeview::GlobalTypeTableBuilder TypeTable; 56303231Sdim 57344779Sdim /// Whether to emit type record hashes into .debug$H. 58344779Sdim bool EmitDebugGlobalHashes = false; 59344779Sdim 60344779Sdim /// The codeview CPU type used by the translation unit. 61344779Sdim codeview::CPUType TheCPU; 62344779Sdim 63303231Sdim /// Represents the most general definition range. 64303231Sdim struct LocalVarDefRange { 65303231Sdim /// Indicates that variable data is stored in memory relative to the 66303231Sdim /// specified register. 67303231Sdim int InMemory : 1; 68303231Sdim 69303231Sdim /// Offset of variable data in memory. 70303231Sdim int DataOffset : 31; 71303231Sdim 72314564Sdim /// Non-zero if this is a piece of an aggregate. 73314564Sdim uint16_t IsSubfield : 1; 74303231Sdim 75314564Sdim /// Offset into aggregate. 76314564Sdim uint16_t StructOffset : 15; 77314564Sdim 78303231Sdim /// Register containing the data or the register base of the memory 79303231Sdim /// location containing the data. 80303231Sdim uint16_t CVRegister; 81303231Sdim 82303231Sdim /// Compares all location fields. This includes all fields except the label 83303231Sdim /// ranges. 84303231Sdim bool isDifferentLocation(LocalVarDefRange &O) { 85303231Sdim return InMemory != O.InMemory || DataOffset != O.DataOffset || 86314564Sdim IsSubfield != O.IsSubfield || StructOffset != O.StructOffset || 87314564Sdim CVRegister != O.CVRegister; 88303231Sdim } 89303231Sdim 90303231Sdim SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 1> Ranges; 91303231Sdim }; 92303231Sdim 93303231Sdim static LocalVarDefRange createDefRangeMem(uint16_t CVRegister, int Offset); 94303231Sdim 95303231Sdim /// Similar to DbgVariable in DwarfDebug, but not dwarf-specific. 96303231Sdim struct LocalVariable { 97303231Sdim const DILocalVariable *DIVar = nullptr; 98303231Sdim SmallVector<LocalVarDefRange, 1> DefRanges; 99327952Sdim bool UseReferenceType = false; 100303231Sdim }; 101303231Sdim 102344779Sdim struct CVGlobalVariable { 103344779Sdim const DIGlobalVariable *DIGV; 104353358Sdim PointerUnion<const GlobalVariable *, const DIExpression *> GVInfo; 105344779Sdim }; 106344779Sdim 107303231Sdim struct InlineSite { 108303231Sdim SmallVector<LocalVariable, 1> InlinedLocals; 109303231Sdim SmallVector<const DILocation *, 1> ChildSites; 110303231Sdim const DISubprogram *Inlinee = nullptr; 111303231Sdim 112303231Sdim /// The ID of the inline site or function used with .cv_loc. Not a type 113303231Sdim /// index. 114303231Sdim unsigned SiteFuncId = 0; 115303231Sdim }; 116303231Sdim 117341825Sdim // Combines information from DILexicalBlock and LexicalScope. 118341825Sdim struct LexicalBlock { 119341825Sdim SmallVector<LocalVariable, 1> Locals; 120344779Sdim SmallVector<CVGlobalVariable, 1> Globals; 121341825Sdim SmallVector<LexicalBlock *, 1> Children; 122341825Sdim const MCSymbol *Begin; 123341825Sdim const MCSymbol *End; 124341825Sdim StringRef Name; 125341825Sdim }; 126341825Sdim 127303231Sdim // For each function, store a vector of labels to its instructions, as well as 128303231Sdim // to the end of the function. 129303231Sdim struct FunctionInfo { 130341825Sdim FunctionInfo() = default; 131341825Sdim 132341825Sdim // Uncopyable. 133341825Sdim FunctionInfo(const FunctionInfo &FI) = delete; 134341825Sdim 135303231Sdim /// Map from inlined call site to inlined instructions and child inlined 136303231Sdim /// call sites. Listed in program order. 137303231Sdim std::unordered_map<const DILocation *, InlineSite> InlineSites; 138303231Sdim 139303231Sdim /// Ordered list of top-level inlined call sites. 140303231Sdim SmallVector<const DILocation *, 1> ChildSites; 141303231Sdim 142303231Sdim SmallVector<LocalVariable, 1> Locals; 143344779Sdim SmallVector<CVGlobalVariable, 1> Globals; 144303231Sdim 145341825Sdim std::unordered_map<const DILexicalBlockBase*, LexicalBlock> LexicalBlocks; 146341825Sdim 147341825Sdim // Lexical blocks containing local variables. 148341825Sdim SmallVector<LexicalBlock *, 1> ChildBlocks; 149341825Sdim 150327952Sdim std::vector<std::pair<MCSymbol *, MDNode *>> Annotations; 151360661Sdim std::vector<std::tuple<const MCSymbol *, const MCSymbol *, const DIType *>> 152360661Sdim HeapAllocSites; 153327952Sdim 154303231Sdim const MCSymbol *Begin = nullptr; 155303231Sdim const MCSymbol *End = nullptr; 156303231Sdim unsigned FuncId = 0; 157303231Sdim unsigned LastFileId = 0; 158344779Sdim 159344779Sdim /// Number of bytes allocated in the prologue for all local stack objects. 160344779Sdim unsigned FrameSize = 0; 161344779Sdim 162344779Sdim /// Number of bytes of parameters on the stack. 163344779Sdim unsigned ParamSize = 0; 164344779Sdim 165344779Sdim /// Number of bytes pushed to save CSRs. 166344779Sdim unsigned CSRSize = 0; 167344779Sdim 168344779Sdim /// Adjustment to apply on x86 when using the VFRAME frame pointer. 169344779Sdim int OffsetAdjustment = 0; 170344779Sdim 171344779Sdim /// Two-bit value indicating which register is the designated frame pointer 172344779Sdim /// register for local variables. Included in S_FRAMEPROC. 173344779Sdim codeview::EncodedFramePtrReg EncodedLocalFramePtrReg = 174344779Sdim codeview::EncodedFramePtrReg::None; 175344779Sdim 176344779Sdim /// Two-bit value indicating which register is the designated frame pointer 177344779Sdim /// register for stack parameters. Included in S_FRAMEPROC. 178344779Sdim codeview::EncodedFramePtrReg EncodedParamFramePtrReg = 179344779Sdim codeview::EncodedFramePtrReg::None; 180344779Sdim 181344779Sdim codeview::FrameProcedureOptions FrameProcOpts; 182344779Sdim 183344779Sdim bool HasStackRealignment = false; 184344779Sdim 185303231Sdim bool HaveLineInfo = false; 186303231Sdim }; 187321369Sdim FunctionInfo *CurFn = nullptr; 188303231Sdim 189341825Sdim // Map used to seperate variables according to the lexical scope they belong 190341825Sdim // in. This is populated by recordLocalVariable() before 191341825Sdim // collectLexicalBlocks() separates the variables between the FunctionInfo 192341825Sdim // and LexicalBlocks. 193341825Sdim DenseMap<const LexicalScope *, SmallVector<LocalVariable, 1>> ScopeVariables; 194341825Sdim 195344779Sdim // Map to separate global variables according to the lexical scope they 196344779Sdim // belong in. A null local scope represents the global scope. 197344779Sdim typedef SmallVector<CVGlobalVariable, 1> GlobalVariableList; 198344779Sdim DenseMap<const DIScope*, std::unique_ptr<GlobalVariableList> > ScopeGlobals; 199344779Sdim 200344779Sdim // Array of global variables which need to be emitted into a COMDAT section. 201344779Sdim SmallVector<CVGlobalVariable, 1> ComdatVariables; 202344779Sdim 203344779Sdim // Array of non-COMDAT global variables. 204344779Sdim SmallVector<CVGlobalVariable, 1> GlobalVariables; 205344779Sdim 206303231Sdim /// The set of comdat .debug$S sections that we've seen so far. Each section 207303231Sdim /// must start with a magic version number that must only be emitted once. 208303231Sdim /// This set tracks which sections we've already opened. 209303231Sdim DenseSet<MCSectionCOFF *> ComdatDebugSections; 210303231Sdim 211303231Sdim /// Switch to the appropriate .debug$S section for GVSym. If GVSym, the symbol 212303231Sdim /// of an emitted global value, is in a comdat COFF section, this will switch 213303231Sdim /// to a new .debug$S section in that comdat. This method ensures that the 214303231Sdim /// section starts with the magic version number on first use. If GVSym is 215303231Sdim /// null, uses the main .debug$S section. 216303231Sdim void switchToDebugSectionForSymbol(const MCSymbol *GVSym); 217303231Sdim 218303231Sdim /// The next available function index for use with our .cv_* directives. Not 219303231Sdim /// to be confused with type indices for LF_FUNC_ID records. 220303231Sdim unsigned NextFuncId = 0; 221303231Sdim 222303231Sdim InlineSite &getInlineSite(const DILocation *InlinedAt, 223303231Sdim const DISubprogram *Inlinee); 224303231Sdim 225303231Sdim codeview::TypeIndex getFuncIdForSubprogram(const DISubprogram *SP); 226303231Sdim 227327952Sdim void calculateRanges(LocalVariable &Var, 228353358Sdim const DbgValueHistoryMap::Entries &Entries); 229327952Sdim 230303231Sdim static void collectInlineSiteChildren(SmallVectorImpl<unsigned> &Children, 231303231Sdim const FunctionInfo &FI, 232303231Sdim const InlineSite &Site); 233303231Sdim 234303231Sdim /// Remember some debug info about each function. Keep it in a stable order to 235303231Sdim /// emit at the end of the TU. 236341825Sdim MapVector<const Function *, std::unique_ptr<FunctionInfo>> FnDebugInfo; 237303231Sdim 238327952Sdim /// Map from full file path to .cv_file id. Full paths are built from DIFiles 239327952Sdim /// and are stored in FileToFilepathMap; 240327952Sdim DenseMap<StringRef, unsigned> FileIdMap; 241303231Sdim 242303231Sdim /// All inlined subprograms in the order they should be emitted. 243303231Sdim SmallSetVector<const DISubprogram *, 4> InlinedSubprograms; 244303231Sdim 245303231Sdim /// Map from a pair of DI metadata nodes and its DI type (or scope) that can 246303231Sdim /// be nullptr, to CodeView type indices. Primarily indexed by 247303231Sdim /// {DIType*, DIType*} and {DISubprogram*, DIType*}. 248303231Sdim /// 249303231Sdim /// The second entry in the key is needed for methods as DISubroutineType 250303231Sdim /// representing static method type are shared with non-method function type. 251303231Sdim DenseMap<std::pair<const DINode *, const DIType *>, codeview::TypeIndex> 252303231Sdim TypeIndices; 253303231Sdim 254303231Sdim /// Map from DICompositeType* to complete type index. Non-record types are 255303231Sdim /// always looked up in the normal TypeIndices map. 256303231Sdim DenseMap<const DICompositeType *, codeview::TypeIndex> CompleteTypeIndices; 257303231Sdim 258303231Sdim /// Complete record types to emit after all active type lowerings are 259303231Sdim /// finished. 260303231Sdim SmallVector<const DICompositeType *, 4> DeferredCompleteTypes; 261303231Sdim 262303231Sdim /// Number of type lowering frames active on the stack. 263303231Sdim unsigned TypeEmissionLevel = 0; 264303231Sdim 265303231Sdim codeview::TypeIndex VBPType; 266303231Sdim 267303231Sdim const DISubprogram *CurrentSubprogram = nullptr; 268303231Sdim 269303231Sdim // The UDTs we have seen while processing types; each entry is a pair of type 270303231Sdim // index and type name. 271327952Sdim std::vector<std::pair<std::string, const DIType *>> LocalUDTs; 272327952Sdim std::vector<std::pair<std::string, const DIType *>> GlobalUDTs; 273303231Sdim 274321369Sdim using FileToFilepathMapTy = std::map<const DIFile *, std::string>; 275303231Sdim FileToFilepathMapTy FileToFilepathMap; 276321369Sdim 277341825Sdim StringRef getFullFilepath(const DIFile *File); 278303231Sdim 279303231Sdim unsigned maybeRecordFile(const DIFile *F); 280303231Sdim 281303231Sdim void maybeRecordLocation(const DebugLoc &DL, const MachineFunction *MF); 282303231Sdim 283303231Sdim void clear(); 284303231Sdim 285303231Sdim void setCurrentSubprogram(const DISubprogram *SP) { 286303231Sdim CurrentSubprogram = SP; 287303231Sdim LocalUDTs.clear(); 288303231Sdim } 289303231Sdim 290303231Sdim /// Emit the magic version number at the start of a CodeView type or symbol 291341825Sdim /// section. Appears at the front of every .debug$S or .debug$T or .debug$P 292341825Sdim /// section. 293303231Sdim void emitCodeViewMagicVersion(); 294303231Sdim 295303231Sdim void emitTypeInformation(); 296303231Sdim 297327952Sdim void emitTypeGlobalHashes(); 298327952Sdim 299314564Sdim void emitCompilerInformation(); 300314564Sdim 301344779Sdim void emitBuildInfo(); 302344779Sdim 303303231Sdim void emitInlineeLinesSubsection(); 304303231Sdim 305341825Sdim void emitDebugInfoForThunk(const Function *GV, 306341825Sdim FunctionInfo &FI, 307341825Sdim const MCSymbol *Fn); 308341825Sdim 309303231Sdim void emitDebugInfoForFunction(const Function *GV, FunctionInfo &FI); 310303231Sdim 311303231Sdim void emitDebugInfoForRetainedTypes(); 312303231Sdim 313327952Sdim void 314327952Sdim emitDebugInfoForUDTs(ArrayRef<std::pair<std::string, const DIType *>> UDTs); 315303231Sdim 316344779Sdim void emitDebugInfoForGlobals(); 317344779Sdim void emitGlobalVariableList(ArrayRef<CVGlobalVariable> Globals); 318353358Sdim void emitDebugInfoForGlobal(const CVGlobalVariable &CVGV); 319303231Sdim 320303231Sdim /// Opens a subsection of the given kind in a .debug$S codeview section. 321303231Sdim /// Returns an end label for use with endCVSubsection when the subsection is 322303231Sdim /// finished. 323321369Sdim MCSymbol *beginCVSubsection(codeview::DebugSubsectionKind Kind); 324303231Sdim void endCVSubsection(MCSymbol *EndLabel); 325303231Sdim 326344779Sdim /// Opens a symbol record of the given kind. Returns an end label for use with 327344779Sdim /// endSymbolRecord. 328344779Sdim MCSymbol *beginSymbolRecord(codeview::SymbolKind Kind); 329344779Sdim void endSymbolRecord(MCSymbol *SymEnd); 330344779Sdim 331344779Sdim /// Emits an S_END, S_INLINESITE_END, or S_PROC_ID_END record. These records 332344779Sdim /// are empty, so we emit them with a simpler assembly sequence that doesn't 333344779Sdim /// involve labels. 334344779Sdim void emitEndSymbolRecord(codeview::SymbolKind EndKind); 335344779Sdim 336303231Sdim void emitInlinedCallSite(const FunctionInfo &FI, const DILocation *InlinedAt, 337303231Sdim const InlineSite &Site); 338303231Sdim 339344779Sdim using InlinedEntity = DbgValueHistoryMap::InlinedEntity; 340303231Sdim 341344779Sdim void collectGlobalVariableInfo(); 342303231Sdim void collectVariableInfo(const DISubprogram *SP); 343303231Sdim 344344779Sdim void collectVariableInfoFromMFTable(DenseSet<InlinedEntity> &Processed); 345303231Sdim 346341825Sdim // Construct the lexical block tree for a routine, pruning emptpy lexical 347341825Sdim // scopes, and populate it with local variables. 348341825Sdim void collectLexicalBlockInfo(SmallVectorImpl<LexicalScope *> &Scopes, 349341825Sdim SmallVectorImpl<LexicalBlock *> &Blocks, 350344779Sdim SmallVectorImpl<LocalVariable> &Locals, 351344779Sdim SmallVectorImpl<CVGlobalVariable> &Globals); 352341825Sdim void collectLexicalBlockInfo(LexicalScope &Scope, 353341825Sdim SmallVectorImpl<LexicalBlock *> &ParentBlocks, 354344779Sdim SmallVectorImpl<LocalVariable> &ParentLocals, 355344779Sdim SmallVectorImpl<CVGlobalVariable> &ParentGlobals); 356341825Sdim 357303231Sdim /// Records information about a local variable in the appropriate scope. In 358303231Sdim /// particular, locals from inlined code live inside the inlining site. 359341825Sdim void recordLocalVariable(LocalVariable &&Var, const LexicalScope *LS); 360303231Sdim 361303231Sdim /// Emits local variables in the appropriate order. 362344779Sdim void emitLocalVariableList(const FunctionInfo &FI, 363344779Sdim ArrayRef<LocalVariable> Locals); 364303231Sdim 365303231Sdim /// Emits an S_LOCAL record and its associated defined ranges. 366344779Sdim void emitLocalVariable(const FunctionInfo &FI, const LocalVariable &Var); 367303231Sdim 368341825Sdim /// Emits a sequence of lexical block scopes and their children. 369341825Sdim void emitLexicalBlockList(ArrayRef<LexicalBlock *> Blocks, 370341825Sdim const FunctionInfo& FI); 371341825Sdim 372341825Sdim /// Emit a lexical block scope and its children. 373341825Sdim void emitLexicalBlock(const LexicalBlock &Block, const FunctionInfo& FI); 374341825Sdim 375303231Sdim /// Translates the DIType to codeview if necessary and returns a type index 376303231Sdim /// for it. 377353358Sdim codeview::TypeIndex getTypeIndex(const DIType *Ty, 378353358Sdim const DIType *ClassTy = nullptr); 379303231Sdim 380344779Sdim codeview::TypeIndex 381344779Sdim getTypeIndexForThisPtr(const DIDerivedType *PtrTy, 382344779Sdim const DISubroutineType *SubroutineTy); 383344779Sdim 384353358Sdim codeview::TypeIndex getTypeIndexForReferenceTo(const DIType *Ty); 385327952Sdim 386303231Sdim codeview::TypeIndex getMemberFunctionType(const DISubprogram *SP, 387303231Sdim const DICompositeType *Class); 388303231Sdim 389303231Sdim codeview::TypeIndex getScopeIndex(const DIScope *Scope); 390303231Sdim 391303231Sdim codeview::TypeIndex getVBPTypeIndex(); 392303231Sdim 393327952Sdim void addToUDTs(const DIType *Ty); 394303231Sdim 395341825Sdim void addUDTSrcLine(const DIType *Ty, codeview::TypeIndex TI); 396341825Sdim 397303231Sdim codeview::TypeIndex lowerType(const DIType *Ty, const DIType *ClassTy); 398303231Sdim codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty); 399303231Sdim codeview::TypeIndex lowerTypeArray(const DICompositeType *Ty); 400303231Sdim codeview::TypeIndex lowerTypeBasic(const DIBasicType *Ty); 401341825Sdim codeview::TypeIndex lowerTypePointer( 402341825Sdim const DIDerivedType *Ty, 403341825Sdim codeview::PointerOptions PO = codeview::PointerOptions::None); 404341825Sdim codeview::TypeIndex lowerTypeMemberPointer( 405341825Sdim const DIDerivedType *Ty, 406341825Sdim codeview::PointerOptions PO = codeview::PointerOptions::None); 407303231Sdim codeview::TypeIndex lowerTypeModifier(const DIDerivedType *Ty); 408303231Sdim codeview::TypeIndex lowerTypeFunction(const DISubroutineType *Ty); 409314564Sdim codeview::TypeIndex lowerTypeVFTableShape(const DIDerivedType *Ty); 410344779Sdim codeview::TypeIndex lowerTypeMemberFunction( 411344779Sdim const DISubroutineType *Ty, const DIType *ClassTy, int ThisAdjustment, 412344779Sdim bool IsStaticMethod, 413344779Sdim codeview::FunctionOptions FO = codeview::FunctionOptions::None); 414303231Sdim codeview::TypeIndex lowerTypeEnum(const DICompositeType *Ty); 415303231Sdim codeview::TypeIndex lowerTypeClass(const DICompositeType *Ty); 416303231Sdim codeview::TypeIndex lowerTypeUnion(const DICompositeType *Ty); 417303231Sdim 418303231Sdim /// Symbol records should point to complete types, but type records should 419303231Sdim /// always point to incomplete types to avoid cycles in the type graph. Only 420303231Sdim /// use this entry point when generating symbol records. The complete and 421303231Sdim /// incomplete type indices only differ for record types. All other types use 422303231Sdim /// the same index. 423353358Sdim codeview::TypeIndex getCompleteTypeIndex(const DIType *Ty); 424303231Sdim 425303231Sdim codeview::TypeIndex lowerCompleteTypeClass(const DICompositeType *Ty); 426303231Sdim codeview::TypeIndex lowerCompleteTypeUnion(const DICompositeType *Ty); 427303231Sdim 428303231Sdim struct TypeLoweringScope; 429303231Sdim 430303231Sdim void emitDeferredCompleteTypes(); 431303231Sdim 432303231Sdim void collectMemberInfo(ClassInfo &Info, const DIDerivedType *DDTy); 433303231Sdim ClassInfo collectClassInfo(const DICompositeType *Ty); 434303231Sdim 435303231Sdim /// Common record member lowering functionality for record types, which are 436303231Sdim /// structs, classes, and unions. Returns the field list index and the member 437303231Sdim /// count. 438303231Sdim std::tuple<codeview::TypeIndex, codeview::TypeIndex, unsigned, bool> 439303231Sdim lowerRecordFieldList(const DICompositeType *Ty); 440303231Sdim 441303231Sdim /// Inserts {{Node, ClassTy}, TI} into TypeIndices and checks for duplicates. 442303231Sdim codeview::TypeIndex recordTypeIndexForDINode(const DINode *Node, 443303231Sdim codeview::TypeIndex TI, 444303231Sdim const DIType *ClassTy = nullptr); 445303231Sdim 446303231Sdim unsigned getPointerSizeInBytes(); 447303231Sdim 448321369Sdimprotected: 449341825Sdim /// Gather pre-function debug information. 450321369Sdim void beginFunctionImpl(const MachineFunction *MF) override; 451321369Sdim 452341825Sdim /// Gather post-function debug information. 453321369Sdim void endFunctionImpl(const MachineFunction *) override; 454321369Sdim 455303231Sdimpublic: 456341825Sdim CodeViewDebug(AsmPrinter *AP); 457303231Sdim 458321369Sdim void setSymbolSize(const MCSymbol *, uint64_t) override {} 459303231Sdim 460341825Sdim /// Emit the COFF section that holds the line table information. 461303231Sdim void endModule() override; 462303231Sdim 463341825Sdim /// Process beginning of an instruction. 464303231Sdim void beginInstruction(const MachineInstr *MI) override; 465303231Sdim}; 466303231Sdim 467321369Sdim} // end namespace llvm 468321369Sdim 469321369Sdim#endif // LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 470