1 //===-- llvm/CodeGen/DwarfCompileUnit.h - Dwarf Compile Unit ---*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains support for writing dwarf compile unit.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
17 #include "DwarfUnit.h"
18 #include "llvm/Support/Dwarf.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/IR/DebugInfo.h"
30 class DwarfCompileUnit : public DwarfUnit {
31 /// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding
32 /// the need to search for it in applyStmtList.
33 unsigned stmtListIndex;
36 DwarfCompileUnit(unsigned UID, DICompileUnit Node, AsmPrinter *A,
37 DwarfDebug *DW, DwarfFile *DWU);
39 void initStmtList(MCSymbol *DwarfLineSectionSym);
41 /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
42 void applyStmtList(DIE &D);
44 /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
45 DIE *getOrCreateGlobalVariableDIE(DIGlobalVariable GV);
47 /// addLabelAddress - Add a dwarf label attribute data and value using
48 /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
49 void addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
50 const MCSymbol *Label);
52 /// addLocalLabelAddress - Add a dwarf label attribute data and value using
53 /// DW_FORM_addr only.
54 void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute,
55 const MCSymbol *Label);
57 DwarfCompileUnit &getCU() override { return *this; }
59 unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName) override;
61 /// addRange - Add an address range to the list of ranges for this unit.
62 void addRange(RangeSpan Range);
64 void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
67 } // end llvm namespace