diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-04 14:58:56 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-04 14:58:56 +0000 |
commit | 7ff99155c39edd73ebf1c6adfa023b1048fee9a4 (patch) | |
tree | b4dc751bcee540346911aa4115729eff2f991657 /lib/Target/PIC16/PIC16TargetObjectFile.cpp | |
parent | d1f06de484602e72707476a6152974847bac1570 (diff) | |
download | FreeBSD-src-7ff99155c39edd73ebf1c6adfa023b1048fee9a4.zip FreeBSD-src-7ff99155c39edd73ebf1c6adfa023b1048fee9a4.tar.gz |
Update LLVM to r86025.
Diffstat (limited to 'lib/Target/PIC16/PIC16TargetObjectFile.cpp')
-rw-r--r-- | lib/Target/PIC16/PIC16TargetObjectFile.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/lib/Target/PIC16/PIC16TargetObjectFile.cpp index 7eedf7f..d7cfe02 100644 --- a/lib/Target/PIC16/PIC16TargetObjectFile.cpp +++ b/lib/Target/PIC16/PIC16TargetObjectFile.cpp @@ -72,6 +72,7 @@ getPIC16DataSection(const std::string &Name, PIC16SectionType Ty, case UDATA: UDATASections_.push_back(Entry); break; case IDATA: IDATASections_.push_back(Entry); break; case ROMDATA: ROMDATASection_ = Entry; break; + case UDATA_SHR: SHAREDUDATASection_ = Entry; break; } return Entry; @@ -125,6 +126,7 @@ void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){ TM = &tm; ROMDATASection_ = NULL; + SHAREDUDATASection_ = NULL; } /// allocateUDATA - Allocate a un-initialized global to an existing or new UDATA @@ -279,7 +281,10 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, std::string AddrStr = "Address="; if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) { std::string SectAddr = SectName.substr(AddrStr.length()); - return allocateAtGivenAddress(GVar, SectAddr); + if (SectAddr.compare("NEAR") == 0) + return allocateSHARED(GVar, Mang); + else + return allocateAtGivenAddress(GVar, SectAddr); } // Create the section specified with section attribute. @@ -289,6 +294,25 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, return getPIC16DataSection(GV->getSection().c_str(), UDATA); } +const MCSection * +PIC16TargetObjectFile::allocateSHARED(const GlobalVariable *GV, + Mangler *Mang) const { + // Make sure that this is an uninitialized global. + assert(GV->hasInitializer() && "This global doesn't need space"); + if (!GV->getInitializer()->isNullValue()) { + // FIXME: Generate a warning in this case that near qualifier will be + // ignored. + return SelectSectionForGlobal(GV, SectionKind::getDataRel(), Mang, *TM); + } + std::string Name = PAN::getSharedUDataSectionName(); + + PIC16Section *SharedUDataSect = getPIC16DataSection(Name.c_str(), UDATA_SHR); + // Insert the GV into shared section. + SharedUDataSect->Items.push_back(GV); + return SharedUDataSect; +} + + // Interface used by AsmPrinter to get a code section for a function. const PIC16Section * PIC16TargetObjectFile::SectionForCode(const std::string &FnName) const { |