#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFFILE_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFFILE_H
#include "AddressPool.h"
#include "DwarfStringPool.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Allocator.h"
#include <memory>
#include <string>
#include <vector>
namespace llvm {
class AsmPrinter;
class DbgVariable;
class DwarfUnit;
class DIEAbbrev;
class MCSymbol;
class DIE;
class LexicalScope;
class StringRef;
class DwarfDebug;
class MCSection;
class DwarfFile {
AsmPrinter *Asm;
FoldingSet<DIEAbbrev> AbbreviationsSet;
std::vector<DIEAbbrev *> Abbreviations;
SmallVector<std::unique_ptr<DwarfUnit>, 1> CUs;
DwarfStringPool StrPool;
DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8>> ScopeVariables;
DenseMap<const MDNode *, DIE *> AbstractSPDies;
DenseMap<const MDNode *, DIE *> DITypeNodeToDieMap;
public:
DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA);
~DwarfFile();
const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() { return CUs; }
unsigned computeSizeAndOffset(DIE &Die, unsigned Offset);
void computeSizeAndOffsets();
void assignAbbrevNumber(DIEAbbrev &Abbrev);
void addUnit(std::unique_ptr<DwarfUnit> U);
void emitUnits(bool UseOffsets);
void emitAbbrevs(const MCSection *);
void emitStrings(const MCSection *StrSection,
const MCSection *OffsetSection = nullptr);
DwarfStringPool &getStringPool() { return StrPool; }
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var);
DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8>> &getScopeVariables() {
return ScopeVariables;
}
DenseMap<const MDNode *, DIE *> &getAbstractSPDies() {
return AbstractSPDies;
}
void insertDIE(const MDNode *TypeMD, DIE *Die) {
DITypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
}
DIE *getDIE(const MDNode *TypeMD) {
return DITypeNodeToDieMap.lookup(TypeMD);
}
};
}
#endif