[MC] Generalize MCContext's SectionSymbols field.

Change SectionSymbols so that it doesn't hard-code ELF types, so that
it can be used for non-ELF targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2016-12-03 23:55:57 +00:00
parent 728c815331
commit bbaf9cd246
2 changed files with 5 additions and 5 deletions

View File

@ -82,9 +82,9 @@ namespace llvm {
/// Bindings of names to symbols.
SymbolTable Symbols;
/// ELF sections can have a corresponding symbol. This maps one to the
/// Sections can have a corresponding symbol. This maps one to the
/// other.
DenseMap<const MCSectionELF *, MCSymbolELF *> SectionSymbols;
DenseMap<const MCSection *, MCSymbol *> SectionSymbols;
/// A mapping from a local label number and an instance count to a symbol.
/// For example, in the assembly

View File

@ -125,15 +125,15 @@ MCSymbol *MCContext::getOrCreateSymbol(const Twine &Name) {
}
MCSymbolELF *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) {
MCSymbolELF *&Sym = SectionSymbols[&Section];
MCSymbol *&Sym = SectionSymbols[&Section];
if (Sym)
return Sym;
return cast<MCSymbolELF>(Sym);
StringRef Name = Section.getSectionName();
auto NameIter = UsedNames.insert(std::make_pair(Name, false)).first;
Sym = new (&*NameIter, *this) MCSymbolELF(&*NameIter, /*isTemporary*/ false);
return Sym;
return cast<MCSymbolELF>(Sym);
}
MCSymbol *MCContext::getOrCreateFrameAllocSymbol(StringRef FuncName,