1*9880d681SAndroid Build Coastguard Worker //===-- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h ----*- C++ -*--===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file contains support for writing Microsoft CodeView debug info. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "DebugHandlerBase.h" 18*9880d681SAndroid Build Coastguard Worker #include "llvm/ADT/DenseMap.h" 19*9880d681SAndroid Build Coastguard Worker #include "llvm/ADT/StringMap.h" 20*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/AsmPrinter.h" 21*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineFunction.h" 22*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineModuleInfo.h" 23*9880d681SAndroid Build Coastguard Worker #include "llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h" 24*9880d681SAndroid Build Coastguard Worker #include "llvm/DebugInfo/CodeView/TypeIndex.h" 25*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/DebugInfo.h" 26*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/DebugLoc.h" 27*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCStreamer.h" 28*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetLoweringObjectFile.h" 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker namespace llvm { 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker class StringRef; 33*9880d681SAndroid Build Coastguard Worker class LexicalScope; 34*9880d681SAndroid Build Coastguard Worker struct ClassInfo; 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Worker /// \brief Collects and handles line tables information in a CodeView format. 37*9880d681SAndroid Build Coastguard Worker class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { 38*9880d681SAndroid Build Coastguard Worker MCStreamer &OS; 39*9880d681SAndroid Build Coastguard Worker codeview::MemoryTypeTableBuilder TypeTable; 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker /// Represents the most general definition range. 42*9880d681SAndroid Build Coastguard Worker struct LocalVarDefRange { 43*9880d681SAndroid Build Coastguard Worker /// Indicates that variable data is stored in memory relative to the 44*9880d681SAndroid Build Coastguard Worker /// specified register. 45*9880d681SAndroid Build Coastguard Worker int InMemory : 1; 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker /// Offset of variable data in memory. 48*9880d681SAndroid Build Coastguard Worker int DataOffset : 31; 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Worker /// Offset of the data into the user level struct. If zero, no splitting 51*9880d681SAndroid Build Coastguard Worker /// occurred. 52*9880d681SAndroid Build Coastguard Worker uint16_t StructOffset; 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker /// Register containing the data or the register base of the memory 55*9880d681SAndroid Build Coastguard Worker /// location containing the data. 56*9880d681SAndroid Build Coastguard Worker uint16_t CVRegister; 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Worker /// Compares all location fields. This includes all fields except the label 59*9880d681SAndroid Build Coastguard Worker /// ranges. isDifferentLocationLocalVarDefRange60*9880d681SAndroid Build Coastguard Worker bool isDifferentLocation(LocalVarDefRange &O) { 61*9880d681SAndroid Build Coastguard Worker return InMemory != O.InMemory || DataOffset != O.DataOffset || 62*9880d681SAndroid Build Coastguard Worker StructOffset != O.StructOffset || CVRegister != O.CVRegister; 63*9880d681SAndroid Build Coastguard Worker } 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Worker SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 1> Ranges; 66*9880d681SAndroid Build Coastguard Worker }; 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker static LocalVarDefRange createDefRangeMem(uint16_t CVRegister, int Offset); 69*9880d681SAndroid Build Coastguard Worker static LocalVarDefRange createDefRangeReg(uint16_t CVRegister); 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Worker /// Similar to DbgVariable in DwarfDebug, but not dwarf-specific. 72*9880d681SAndroid Build Coastguard Worker struct LocalVariable { 73*9880d681SAndroid Build Coastguard Worker const DILocalVariable *DIVar = nullptr; 74*9880d681SAndroid Build Coastguard Worker SmallVector<LocalVarDefRange, 1> DefRanges; 75*9880d681SAndroid Build Coastguard Worker }; 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker struct InlineSite { 78*9880d681SAndroid Build Coastguard Worker SmallVector<LocalVariable, 1> InlinedLocals; 79*9880d681SAndroid Build Coastguard Worker SmallVector<const DILocation *, 1> ChildSites; 80*9880d681SAndroid Build Coastguard Worker const DISubprogram *Inlinee = nullptr; 81*9880d681SAndroid Build Coastguard Worker unsigned SiteFuncId = 0; 82*9880d681SAndroid Build Coastguard Worker }; 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker // For each function, store a vector of labels to its instructions, as well as 85*9880d681SAndroid Build Coastguard Worker // to the end of the function. 86*9880d681SAndroid Build Coastguard Worker struct FunctionInfo { 87*9880d681SAndroid Build Coastguard Worker /// Map from inlined call site to inlined instructions and child inlined 88*9880d681SAndroid Build Coastguard Worker /// call sites. Listed in program order. 89*9880d681SAndroid Build Coastguard Worker std::unordered_map<const DILocation *, InlineSite> InlineSites; 90*9880d681SAndroid Build Coastguard Worker 91*9880d681SAndroid Build Coastguard Worker /// Ordered list of top-level inlined call sites. 92*9880d681SAndroid Build Coastguard Worker SmallVector<const DILocation *, 1> ChildSites; 93*9880d681SAndroid Build Coastguard Worker 94*9880d681SAndroid Build Coastguard Worker SmallVector<LocalVariable, 1> Locals; 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker DebugLoc LastLoc; 97*9880d681SAndroid Build Coastguard Worker const MCSymbol *Begin = nullptr; 98*9880d681SAndroid Build Coastguard Worker const MCSymbol *End = nullptr; 99*9880d681SAndroid Build Coastguard Worker unsigned FuncId = 0; 100*9880d681SAndroid Build Coastguard Worker unsigned LastFileId = 0; 101*9880d681SAndroid Build Coastguard Worker bool HaveLineInfo = false; 102*9880d681SAndroid Build Coastguard Worker }; 103*9880d681SAndroid Build Coastguard Worker FunctionInfo *CurFn; 104*9880d681SAndroid Build Coastguard Worker 105*9880d681SAndroid Build Coastguard Worker /// The set of comdat .debug$S sections that we've seen so far. Each section 106*9880d681SAndroid Build Coastguard Worker /// must start with a magic version number that must only be emitted once. 107*9880d681SAndroid Build Coastguard Worker /// This set tracks which sections we've already opened. 108*9880d681SAndroid Build Coastguard Worker DenseSet<MCSectionCOFF *> ComdatDebugSections; 109*9880d681SAndroid Build Coastguard Worker 110*9880d681SAndroid Build Coastguard Worker /// Switch to the appropriate .debug$S section for GVSym. If GVSym, the symbol 111*9880d681SAndroid Build Coastguard Worker /// of an emitted global value, is in a comdat COFF section, this will switch 112*9880d681SAndroid Build Coastguard Worker /// to a new .debug$S section in that comdat. This method ensures that the 113*9880d681SAndroid Build Coastguard Worker /// section starts with the magic version number on first use. If GVSym is 114*9880d681SAndroid Build Coastguard Worker /// null, uses the main .debug$S section. 115*9880d681SAndroid Build Coastguard Worker void switchToDebugSectionForSymbol(const MCSymbol *GVSym); 116*9880d681SAndroid Build Coastguard Worker 117*9880d681SAndroid Build Coastguard Worker /// The next available function index for use with our .cv_* directives. Not 118*9880d681SAndroid Build Coastguard Worker /// to be confused with type indices for LF_FUNC_ID records. 119*9880d681SAndroid Build Coastguard Worker unsigned NextFuncId = 0; 120*9880d681SAndroid Build Coastguard Worker 121*9880d681SAndroid Build Coastguard Worker InlineSite &getInlineSite(const DILocation *InlinedAt, 122*9880d681SAndroid Build Coastguard Worker const DISubprogram *Inlinee); 123*9880d681SAndroid Build Coastguard Worker 124*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex getFuncIdForSubprogram(const DISubprogram *SP); 125*9880d681SAndroid Build Coastguard Worker 126*9880d681SAndroid Build Coastguard Worker static void collectInlineSiteChildren(SmallVectorImpl<unsigned> &Children, 127*9880d681SAndroid Build Coastguard Worker const FunctionInfo &FI, 128*9880d681SAndroid Build Coastguard Worker const InlineSite &Site); 129*9880d681SAndroid Build Coastguard Worker 130*9880d681SAndroid Build Coastguard Worker /// Remember some debug info about each function. Keep it in a stable order to 131*9880d681SAndroid Build Coastguard Worker /// emit at the end of the TU. 132*9880d681SAndroid Build Coastguard Worker MapVector<const Function *, FunctionInfo> FnDebugInfo; 133*9880d681SAndroid Build Coastguard Worker 134*9880d681SAndroid Build Coastguard Worker /// Map from DIFile to .cv_file id. 135*9880d681SAndroid Build Coastguard Worker DenseMap<const DIFile *, unsigned> FileIdMap; 136*9880d681SAndroid Build Coastguard Worker 137*9880d681SAndroid Build Coastguard Worker /// All inlined subprograms in the order they should be emitted. 138*9880d681SAndroid Build Coastguard Worker SmallSetVector<const DISubprogram *, 4> InlinedSubprograms; 139*9880d681SAndroid Build Coastguard Worker 140*9880d681SAndroid Build Coastguard Worker /// Map from a pair of DI metadata nodes and its DI type (or scope) that can 141*9880d681SAndroid Build Coastguard Worker /// be nullptr, to CodeView type indices. Primarily indexed by 142*9880d681SAndroid Build Coastguard Worker /// {DIType*, DIType*} and {DISubprogram*, DIType*}. 143*9880d681SAndroid Build Coastguard Worker /// 144*9880d681SAndroid Build Coastguard Worker /// The second entry in the key is needed for methods as DISubroutineType 145*9880d681SAndroid Build Coastguard Worker /// representing static method type are shared with non-method function type. 146*9880d681SAndroid Build Coastguard Worker DenseMap<std::pair<const DINode *, const DIType *>, codeview::TypeIndex> 147*9880d681SAndroid Build Coastguard Worker TypeIndices; 148*9880d681SAndroid Build Coastguard Worker 149*9880d681SAndroid Build Coastguard Worker /// Map from DICompositeType* to complete type index. Non-record types are 150*9880d681SAndroid Build Coastguard Worker /// always looked up in the normal TypeIndices map. 151*9880d681SAndroid Build Coastguard Worker DenseMap<const DICompositeType *, codeview::TypeIndex> CompleteTypeIndices; 152*9880d681SAndroid Build Coastguard Worker 153*9880d681SAndroid Build Coastguard Worker /// Complete record types to emit after all active type lowerings are 154*9880d681SAndroid Build Coastguard Worker /// finished. 155*9880d681SAndroid Build Coastguard Worker SmallVector<const DICompositeType *, 4> DeferredCompleteTypes; 156*9880d681SAndroid Build Coastguard Worker 157*9880d681SAndroid Build Coastguard Worker /// Number of type lowering frames active on the stack. 158*9880d681SAndroid Build Coastguard Worker unsigned TypeEmissionLevel = 0; 159*9880d681SAndroid Build Coastguard Worker 160*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex VBPType; 161*9880d681SAndroid Build Coastguard Worker 162*9880d681SAndroid Build Coastguard Worker const DISubprogram *CurrentSubprogram = nullptr; 163*9880d681SAndroid Build Coastguard Worker 164*9880d681SAndroid Build Coastguard Worker // The UDTs we have seen while processing types; each entry is a pair of type 165*9880d681SAndroid Build Coastguard Worker // index and type name. 166*9880d681SAndroid Build Coastguard Worker std::vector<std::pair<std::string, codeview::TypeIndex>> LocalUDTs, 167*9880d681SAndroid Build Coastguard Worker GlobalUDTs; 168*9880d681SAndroid Build Coastguard Worker 169*9880d681SAndroid Build Coastguard Worker typedef std::map<const DIFile *, std::string> FileToFilepathMapTy; 170*9880d681SAndroid Build Coastguard Worker FileToFilepathMapTy FileToFilepathMap; 171*9880d681SAndroid Build Coastguard Worker StringRef getFullFilepath(const DIFile *S); 172*9880d681SAndroid Build Coastguard Worker 173*9880d681SAndroid Build Coastguard Worker unsigned maybeRecordFile(const DIFile *F); 174*9880d681SAndroid Build Coastguard Worker 175*9880d681SAndroid Build Coastguard Worker void maybeRecordLocation(const DebugLoc &DL, const MachineFunction *MF); 176*9880d681SAndroid Build Coastguard Worker 177*9880d681SAndroid Build Coastguard Worker void clear(); 178*9880d681SAndroid Build Coastguard Worker setCurrentSubprogram(const DISubprogram * SP)179*9880d681SAndroid Build Coastguard Worker void setCurrentSubprogram(const DISubprogram *SP) { 180*9880d681SAndroid Build Coastguard Worker CurrentSubprogram = SP; 181*9880d681SAndroid Build Coastguard Worker LocalUDTs.clear(); 182*9880d681SAndroid Build Coastguard Worker } 183*9880d681SAndroid Build Coastguard Worker 184*9880d681SAndroid Build Coastguard Worker /// Emit the magic version number at the start of a CodeView type or symbol 185*9880d681SAndroid Build Coastguard Worker /// section. Appears at the front of every .debug$S or .debug$T section. 186*9880d681SAndroid Build Coastguard Worker void emitCodeViewMagicVersion(); 187*9880d681SAndroid Build Coastguard Worker 188*9880d681SAndroid Build Coastguard Worker void emitTypeInformation(); 189*9880d681SAndroid Build Coastguard Worker 190*9880d681SAndroid Build Coastguard Worker void emitInlineeLinesSubsection(); 191*9880d681SAndroid Build Coastguard Worker 192*9880d681SAndroid Build Coastguard Worker void emitDebugInfoForFunction(const Function *GV, FunctionInfo &FI); 193*9880d681SAndroid Build Coastguard Worker 194*9880d681SAndroid Build Coastguard Worker void emitDebugInfoForGlobals(); 195*9880d681SAndroid Build Coastguard Worker 196*9880d681SAndroid Build Coastguard Worker void emitDebugInfoForRetainedTypes(); 197*9880d681SAndroid Build Coastguard Worker 198*9880d681SAndroid Build Coastguard Worker void emitDebugInfoForUDTs( 199*9880d681SAndroid Build Coastguard Worker ArrayRef<std::pair<std::string, codeview::TypeIndex>> UDTs); 200*9880d681SAndroid Build Coastguard Worker 201*9880d681SAndroid Build Coastguard Worker void emitDebugInfoForGlobal(const DIGlobalVariable *DIGV, MCSymbol *GVSym); 202*9880d681SAndroid Build Coastguard Worker 203*9880d681SAndroid Build Coastguard Worker /// Opens a subsection of the given kind in a .debug$S codeview section. 204*9880d681SAndroid Build Coastguard Worker /// Returns an end label for use with endCVSubsection when the subsection is 205*9880d681SAndroid Build Coastguard Worker /// finished. 206*9880d681SAndroid Build Coastguard Worker MCSymbol *beginCVSubsection(codeview::ModuleSubstreamKind Kind); 207*9880d681SAndroid Build Coastguard Worker 208*9880d681SAndroid Build Coastguard Worker void endCVSubsection(MCSymbol *EndLabel); 209*9880d681SAndroid Build Coastguard Worker 210*9880d681SAndroid Build Coastguard Worker void emitInlinedCallSite(const FunctionInfo &FI, const DILocation *InlinedAt, 211*9880d681SAndroid Build Coastguard Worker const InlineSite &Site); 212*9880d681SAndroid Build Coastguard Worker 213*9880d681SAndroid Build Coastguard Worker typedef DbgValueHistoryMap::InlinedVariable InlinedVariable; 214*9880d681SAndroid Build Coastguard Worker 215*9880d681SAndroid Build Coastguard Worker void collectVariableInfo(const DISubprogram *SP); 216*9880d681SAndroid Build Coastguard Worker 217*9880d681SAndroid Build Coastguard Worker void collectVariableInfoFromMMITable(DenseSet<InlinedVariable> &Processed); 218*9880d681SAndroid Build Coastguard Worker 219*9880d681SAndroid Build Coastguard Worker /// Records information about a local variable in the appropriate scope. In 220*9880d681SAndroid Build Coastguard Worker /// particular, locals from inlined code live inside the inlining site. 221*9880d681SAndroid Build Coastguard Worker void recordLocalVariable(LocalVariable &&Var, const DILocation *Loc); 222*9880d681SAndroid Build Coastguard Worker 223*9880d681SAndroid Build Coastguard Worker /// Emits local variables in the appropriate order. 224*9880d681SAndroid Build Coastguard Worker void emitLocalVariableList(ArrayRef<LocalVariable> Locals); 225*9880d681SAndroid Build Coastguard Worker 226*9880d681SAndroid Build Coastguard Worker /// Emits an S_LOCAL record and its associated defined ranges. 227*9880d681SAndroid Build Coastguard Worker void emitLocalVariable(const LocalVariable &Var); 228*9880d681SAndroid Build Coastguard Worker 229*9880d681SAndroid Build Coastguard Worker /// Translates the DIType to codeview if necessary and returns a type index 230*9880d681SAndroid Build Coastguard Worker /// for it. 231*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex getTypeIndex(DITypeRef TypeRef, 232*9880d681SAndroid Build Coastguard Worker DITypeRef ClassTyRef = DITypeRef()); 233*9880d681SAndroid Build Coastguard Worker 234*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex getMemberFunctionType(const DISubprogram *SP, 235*9880d681SAndroid Build Coastguard Worker const DICompositeType *Class); 236*9880d681SAndroid Build Coastguard Worker 237*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex getScopeIndex(const DIScope *Scope); 238*9880d681SAndroid Build Coastguard Worker 239*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex getVBPTypeIndex(); 240*9880d681SAndroid Build Coastguard Worker 241*9880d681SAndroid Build Coastguard Worker void addToUDTs(const DIType *Ty, codeview::TypeIndex TI); 242*9880d681SAndroid Build Coastguard Worker 243*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerType(const DIType *Ty, const DIType *ClassTy); 244*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty); 245*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeArray(const DICompositeType *Ty); 246*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeBasic(const DIBasicType *Ty); 247*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypePointer(const DIDerivedType *Ty); 248*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeMemberPointer(const DIDerivedType *Ty); 249*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeModifier(const DIDerivedType *Ty); 250*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeFunction(const DISubroutineType *Ty); 251*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeMemberFunction(const DISubroutineType *Ty, 252*9880d681SAndroid Build Coastguard Worker const DIType *ClassTy, 253*9880d681SAndroid Build Coastguard Worker int ThisAdjustment); 254*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeEnum(const DICompositeType *Ty); 255*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeClass(const DICompositeType *Ty); 256*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerTypeUnion(const DICompositeType *Ty); 257*9880d681SAndroid Build Coastguard Worker 258*9880d681SAndroid Build Coastguard Worker /// Symbol records should point to complete types, but type records should 259*9880d681SAndroid Build Coastguard Worker /// always point to incomplete types to avoid cycles in the type graph. Only 260*9880d681SAndroid Build Coastguard Worker /// use this entry point when generating symbol records. The complete and 261*9880d681SAndroid Build Coastguard Worker /// incomplete type indices only differ for record types. All other types use 262*9880d681SAndroid Build Coastguard Worker /// the same index. 263*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex getCompleteTypeIndex(DITypeRef TypeRef); 264*9880d681SAndroid Build Coastguard Worker 265*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerCompleteTypeClass(const DICompositeType *Ty); 266*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex lowerCompleteTypeUnion(const DICompositeType *Ty); 267*9880d681SAndroid Build Coastguard Worker 268*9880d681SAndroid Build Coastguard Worker struct TypeLoweringScope; 269*9880d681SAndroid Build Coastguard Worker 270*9880d681SAndroid Build Coastguard Worker void emitDeferredCompleteTypes(); 271*9880d681SAndroid Build Coastguard Worker 272*9880d681SAndroid Build Coastguard Worker void collectMemberInfo(ClassInfo &Info, const DIDerivedType *DDTy); 273*9880d681SAndroid Build Coastguard Worker ClassInfo collectClassInfo(const DICompositeType *Ty); 274*9880d681SAndroid Build Coastguard Worker 275*9880d681SAndroid Build Coastguard Worker /// Common record member lowering functionality for record types, which are 276*9880d681SAndroid Build Coastguard Worker /// structs, classes, and unions. Returns the field list index and the member 277*9880d681SAndroid Build Coastguard Worker /// count. 278*9880d681SAndroid Build Coastguard Worker std::tuple<codeview::TypeIndex, codeview::TypeIndex, unsigned, bool> 279*9880d681SAndroid Build Coastguard Worker lowerRecordFieldList(const DICompositeType *Ty); 280*9880d681SAndroid Build Coastguard Worker 281*9880d681SAndroid Build Coastguard Worker /// Inserts {{Node, ClassTy}, TI} into TypeIndices and checks for duplicates. 282*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex recordTypeIndexForDINode(const DINode *Node, 283*9880d681SAndroid Build Coastguard Worker codeview::TypeIndex TI, 284*9880d681SAndroid Build Coastguard Worker const DIType *ClassTy = nullptr); 285*9880d681SAndroid Build Coastguard Worker 286*9880d681SAndroid Build Coastguard Worker unsigned getPointerSizeInBytes(); 287*9880d681SAndroid Build Coastguard Worker 288*9880d681SAndroid Build Coastguard Worker public: 289*9880d681SAndroid Build Coastguard Worker CodeViewDebug(AsmPrinter *Asm); 290*9880d681SAndroid Build Coastguard Worker setSymbolSize(const llvm::MCSymbol *,uint64_t)291*9880d681SAndroid Build Coastguard Worker void setSymbolSize(const llvm::MCSymbol *, uint64_t) override {} 292*9880d681SAndroid Build Coastguard Worker 293*9880d681SAndroid Build Coastguard Worker /// \brief Emit the COFF section that holds the line table information. 294*9880d681SAndroid Build Coastguard Worker void endModule() override; 295*9880d681SAndroid Build Coastguard Worker 296*9880d681SAndroid Build Coastguard Worker /// \brief Gather pre-function debug information. 297*9880d681SAndroid Build Coastguard Worker void beginFunction(const MachineFunction *MF) override; 298*9880d681SAndroid Build Coastguard Worker 299*9880d681SAndroid Build Coastguard Worker /// \brief Gather post-function debug information. 300*9880d681SAndroid Build Coastguard Worker void endFunction(const MachineFunction *) override; 301*9880d681SAndroid Build Coastguard Worker 302*9880d681SAndroid Build Coastguard Worker /// \brief Process beginning of an instruction. 303*9880d681SAndroid Build Coastguard Worker void beginInstruction(const MachineInstr *MI) override; 304*9880d681SAndroid Build Coastguard Worker }; 305*9880d681SAndroid Build Coastguard Worker } // End of namespace llvm 306*9880d681SAndroid Build Coastguard Worker 307*9880d681SAndroid Build Coastguard Worker #endif 308