#define LLVM_MC_MCCONTEXT_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/MC/MCDwarf.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
/// assembly source files.
unsigned GenDwarfFileNumber;
- /// The default initial text section that we generate dwarf debugging line
- /// info for when generating dwarf assembly source files.
- const MCSection *GenDwarfSection;
- /// Symbols created for the start and end of this section.
- MCSymbol *GenDwarfSectionStartSym, *GenDwarfSectionEndSym;
+ /// Symbols created for the start and end of each section, used for
+ /// generating the .debug_ranges and .debug_aranges sections.
+ MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> >
+ SectionStartEndSyms;
/// The information gathered from labels that will have dwarf label
/// entries when generating dwarf assembly source files.
void setGenDwarfFileNumber(unsigned FileNumber) {
GenDwarfFileNumber = FileNumber;
}
- const MCSection *getGenDwarfSection() { return GenDwarfSection; }
- void setGenDwarfSection(const MCSection *Sec) { GenDwarfSection = Sec; }
- MCSymbol *getGenDwarfSectionStartSym() { return GenDwarfSectionStartSym; }
- void setGenDwarfSectionStartSym(MCSymbol *Sym) {
- GenDwarfSectionStartSym = Sym;
+ MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> > &
+ getGenDwarfSectionSyms() {
+ return SectionStartEndSyms;
}
- MCSymbol *getGenDwarfSectionEndSym() { return GenDwarfSectionEndSym; }
- void setGenDwarfSectionEndSym(MCSymbol *Sym) {
- GenDwarfSectionEndSym = Sym;
+ std::pair<MapVector<const MCSection *,
+ std::pair<MCSymbol *, MCSymbol *> >::iterator,
+ bool>
+ addGenDwarfSection(const MCSection *Sec) {
+ return SectionStartEndSyms.insert(
+ std::make_pair(Sec, std::make_pair(nullptr, nullptr)));
}
+ void finalizeDwarfSections(MCStreamer &MCOS);
const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const {
return MCGenDwarfLabelEntries;
}