summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-19 07:41:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-19 07:41:23 +0000
commit9900b4802ee6a1d95cad3dfe649e200e8d08ac00 (patch)
treec34fc19fc5fd66d348643786ffebe00e04b77a7d /llvm/lib/MC
parent2debc86138861c8c978304e6184b886529fd98fe (diff)
downloadbcm5719-llvm-9900b4802ee6a1d95cad3dfe649e200e8d08ac00.tar.gz
bcm5719-llvm-9900b4802ee6a1d95cad3dfe649e200e8d08ac00.zip
Add a MCLineSectionOrder vector so that we produce the line tables in a
deterministic order. llvm-svn: 119795
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 1462d574028..67ce43d6a71 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -80,16 +80,16 @@ void MCLineEntry::Make(MCStreamer *MCOS, const MCSection *Section) {
// Get the MCLineSection for this section, if one does not exist for this
// section create it.
- DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
+ const DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
MCOS->getContext().getMCLineSections();
- MCLineSection *LineSection = MCLineSections[Section];
+ MCLineSection *LineSection = MCLineSections.lookup(Section);
if (!LineSection) {
// Create a new MCLineSection. This will be deleted after the dwarf line
// table is created using it by iterating through the MCLineSections
// DenseMap.
LineSection = new MCLineSection;
// Save a pointer to the new LineSection into the MCLineSections DenseMap.
- MCLineSections[Section] = LineSection;
+ MCOS->getContext().addMCLineSection(Section, LineSection);
}
// Add the line entry to this section's entries.
@@ -137,7 +137,7 @@ static inline void EmitDwarfSetAddress(MCStreamer *MCOS,
//
static inline void EmitDwarfLineTable(MCStreamer *MCOS,
const MCSection *Section,
- MCLineSection *LineSection,
+ const MCLineSection *LineSection,
const MCSection *DwarfLineSection,
MCSectionData *DLS,
int PointerSize) {
@@ -149,7 +149,7 @@ static inline void EmitDwarfLineTable(MCStreamer *MCOS,
MCSymbol *LastLabel = NULL;
// Loop through each MCLineEntry and encode the dwarf line number table.
- for (MCLineSection::iterator
+ for (MCLineSection::const_iterator
it = LineSection->getMCLineEntries()->begin(),
ie = LineSection->getMCLineEntries()->end(); it != ie; ++it) {
@@ -321,16 +321,21 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS,
MCOS->EmitLabel(ProEndSym);
// Put out the line tables.
- DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
+ const DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
MCOS->getContext().getMCLineSections();
- for (DenseMap<const MCSection *, MCLineSection *>::iterator it =
- MCLineSections.begin(), ie = MCLineSections.end(); it != ie; ++it) {
- EmitDwarfLineTable(MCOS, it->first, it->second, DwarfLineSection, DLS,
+ const std::vector<const MCSection *> &MCLineSectionOrder =
+ MCOS->getContext().getMCLineSectionOrder();
+ for (std::vector<const MCSection*>::const_iterator it =
+ MCLineSectionOrder.begin(), ie = MCLineSectionOrder.end(); it != ie;
+ ++it) {
+ const MCSection *Sec = *it;
+ const MCLineSection *Line = MCLineSections.lookup(Sec);
+ EmitDwarfLineTable(MCOS, Sec, Line, DwarfLineSection, DLS,
PointerSize);
// Now delete the MCLineSections that were created in MCLineEntry::Make()
// and used to emit the line table.
- delete it->second;
+ delete Line;
}
// This is the end of the section, so set the value of the symbol at the end
OpenPOWER on IntegriCloud