diff options
author | Stephen Hines <srhines@google.com> | 2015-04-01 18:49:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-01 18:49:26 +0000 |
commit | 3fa16bd6062e23bcdb82ed4dd965674792e6b761 (patch) | |
tree | 9348fc507292f7e8715d22d64ce5a32131b4f875 /lib/MC/MCContext.cpp | |
parent | beed47390a60f6f0c77532b3d3f76bb47ef49423 (diff) | |
parent | ebe69fe11e48d322045d5949c83283927a0d790b (diff) | |
download | external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.zip external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.gz external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.bz2 |
Merge "Update aosp/master LLVM for rebase to r230699."
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r-- | lib/MC/MCContext.cpp | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 8630b25..721edd4 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -130,6 +130,11 @@ MCSymbol *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) { return Sym; } +MCSymbol *MCContext::getOrCreateFrameAllocSymbol(StringRef FuncName) { + return GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + + "frameallocation_" + FuncName); +} + MCSymbol *MCContext::CreateSymbol(StringRef Name) { // Determine whether this is an assembler temporary or normal label, if used. bool isTemporary = false; @@ -247,10 +252,9 @@ getMachOSection(StringRef Segment, StringRef Section, Reserved2, Kind); } -const MCSectionELF *MCContext:: -getELFSection(StringRef Section, unsigned Type, unsigned Flags, - SectionKind Kind) { - return getELFSection(Section, Type, Flags, Kind, 0, ""); +const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type, + unsigned Flags) { + return getELFSection(Section, Type, Flags, 0, ""); } void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) { @@ -266,35 +270,45 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) { const_cast<MCSectionELF*>(Section)->setSectionName(CachedName); } -const MCSectionELF *MCContext:: -getELFSection(StringRef Section, unsigned Type, unsigned Flags, - SectionKind Kind, unsigned EntrySize, StringRef Group) { +const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type, + unsigned Flags, unsigned EntrySize, + StringRef Group, bool Unique) { // Do the lookup, if we have a hit, return it. auto IterBool = ELFUniquingMap.insert( std::make_pair(SectionGroupPair(Section, Group), nullptr)); auto &Entry = *IterBool.first; - if (!IterBool.second) return Entry.second; - - // Possibly refine the entry size first. - if (!EntrySize) { - EntrySize = MCSectionELF::DetermineEntrySize(Kind); - } + if (!IterBool.second && !Unique) + return Entry.second; MCSymbol *GroupSym = nullptr; if (!Group.empty()) GroupSym = GetOrCreateSymbol(Group); StringRef CachedName = Entry.first.first; + + SectionKind Kind; + if (Flags & ELF::SHF_EXECINSTR) + Kind = SectionKind::getText(); + else + Kind = SectionKind::getReadOnly(); + MCSectionELF *Result = new (*this) - MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym); - Entry.second = Result; + MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym, Unique); + if (!Unique) + Entry.second = Result; return Result; } +const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type, + unsigned Flags, unsigned EntrySize, + StringRef Group) { + return getELFSection(Section, Type, Flags, EntrySize, Group, false); +} + const MCSectionELF *MCContext::CreateELFGroupSection() { MCSectionELF *Result = - new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0, - SectionKind::getReadOnly(), 4, nullptr); + new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0, + SectionKind::getReadOnly(), 4, nullptr, false); return Result; } |