Revert back 85006 for now as it breaks PIC16 tests.

llvm-svn: 85008
This commit is contained in:
Sanjiv Gupta 2009-10-24 18:19:41 +00:00
parent 84f0f776e9
commit 9e8d42f295
6 changed files with 3 additions and 51 deletions

View File

@ -298,7 +298,6 @@ bool PIC16AsmPrinter::doInitialization(Module &M) {
EmitIData(M); EmitIData(M);
EmitUData(M); EmitUData(M);
EmitRomData(M); EmitRomData(M);
EmitSharedUdata(M);
EmitUserSections(M); EmitUserSections(M);
return Result; return Result;
} }
@ -371,11 +370,6 @@ void PIC16AsmPrinter::EmitRomData(Module &M) {
EmitSingleSection(PTOF->ROMDATASection()); EmitSingleSection(PTOF->ROMDATASection());
} }
// Emit Shared section udata.
void PIC16AsmPrinter::EmitSharedUdata(Module &M) {
EmitSingleSection(PTOF->SHAREDUDATASection());
}
bool PIC16AsmPrinter::doFinalization(Module &M) { bool PIC16AsmPrinter::doFinalization(Module &M) {
EmitAllAutos(M); EmitAllAutos(M);
printLibcallDecls(); printLibcallDecls();

View File

@ -55,7 +55,6 @@ namespace llvm {
void EmitUData (Module &M); void EmitUData (Module &M);
void EmitAllAutos (Module &M); void EmitAllAutos (Module &M);
void EmitRomData (Module &M); void EmitRomData (Module &M);
void EmitSharedUdata(Module &M);
void EmitUserSections (Module &M); void EmitUserSections (Module &M);
void EmitFunctionFrame(MachineFunction &MF); void EmitFunctionFrame(MachineFunction &MF);
void printLibcallDecls(); void printLibcallDecls();

View File

@ -234,12 +234,6 @@ namespace llvm {
return "romdata.#"; return "romdata.#";
} }
static std::string getSharedUDataSectionName() {
std::ostringstream o;
o << getTagName(PREFIX_SYMBOL) << "udata_shr" << ".#";
return o.str();
}
static std::string getRomdataSectionName(unsigned num, static std::string getRomdataSectionName(unsigned num,
std::string prefix = "") { std::string prefix = "") {
std::ostringstream o; std::ostringstream o;

View File

@ -144,7 +144,7 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) {
} }
// Get the section name(NewBank) for MemOp. // Get the section name(NewBank) for MemOp.
// This assumes that the section names for globals are already set by // This assumes that the section names for globals are laready set by
// AsmPrinter->doInitialization. // AsmPrinter->doInitialization.
std::string NewBank = CurBank; std::string NewBank = CurBank;
if (Op.getType() == MachineOperand::MO_GlobalAddress && if (Op.getType() == MachineOperand::MO_GlobalAddress &&
@ -156,11 +156,7 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) {
std::string Sym = Op.getSymbolName(); std::string Sym = Op.getSymbolName();
NewBank = PAN::getSectionNameForSym(Sym); NewBank = PAN::getSectionNameForSym(Sym);
} }
// If the section is shared section, do not emit banksel.
if (NewBank == PAN::getSharedUDataSectionName())
return Changed;
// If the previous and new section names are same, we don't need to // If the previous and new section names are same, we don't need to
// emit banksel. // emit banksel.
if (NewBank.compare(CurBank) != 0 ) { if (NewBank.compare(CurBank) != 0 ) {

View File

@ -72,7 +72,6 @@ getPIC16DataSection(const std::string &Name, PIC16SectionType Ty,
case UDATA: UDATASections_.push_back(Entry); break; case UDATA: UDATASections_.push_back(Entry); break;
case IDATA: IDATASections_.push_back(Entry); break; case IDATA: IDATASections_.push_back(Entry); break;
case ROMDATA: ROMDATASection_ = Entry; break; case ROMDATA: ROMDATASection_ = Entry; break;
case UDATA_SHR: SHAREDUDATASection_ = Entry; break;
} }
return Entry; return Entry;
@ -280,10 +279,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
std::string AddrStr = "Address="; std::string AddrStr = "Address=";
if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) { if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
std::string SectAddr = SectName.substr(AddrStr.length()); std::string SectAddr = SectName.substr(AddrStr.length());
if (SectAddr.compare("NEAR") == 0) return allocateAtGivenAddress(GVar, SectAddr);
return allocateSHARED(GVar, Mang);
else
return allocateAtGivenAddress(GVar, SectAddr);
} }
// Create the section specified with section attribute. // Create the section specified with section attribute.
@ -293,25 +289,6 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
return getPIC16DataSection(GV->getSection().c_str(), UDATA); 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. // Interface used by AsmPrinter to get a code section for a function.
const PIC16Section * const PIC16Section *
PIC16TargetObjectFile::SectionForCode(const std::string &FnName) const { PIC16TargetObjectFile::SectionForCode(const std::string &FnName) const {

View File

@ -56,7 +56,6 @@ namespace llvm {
mutable std::vector<PIC16Section *> UDATASections_; mutable std::vector<PIC16Section *> UDATASections_;
mutable std::vector<PIC16Section *> IDATASections_; mutable std::vector<PIC16Section *> IDATASections_;
mutable PIC16Section * ROMDATASection_; mutable PIC16Section * ROMDATASection_;
mutable PIC16Section * SHAREDUDATASection_;
/// Standard Auto Sections. /// Standard Auto Sections.
mutable std::vector<PIC16Section *> AUTOSections_; mutable std::vector<PIC16Section *> AUTOSections_;
@ -111,10 +110,6 @@ namespace llvm {
/// Allocate DATA at user specified address. /// Allocate DATA at user specified address.
const MCSection *allocateAtGivenAddress(const GlobalVariable *GV, const MCSection *allocateAtGivenAddress(const GlobalVariable *GV,
const std::string &Addr) const; const std::string &Addr) const;
/// Allocate a shared variable to SHARED section.
const MCSection *allocateSHARED(const GlobalVariable *GV,
Mangler *Mang) const;
public: public:
PIC16TargetObjectFile(); PIC16TargetObjectFile();
@ -152,9 +147,6 @@ namespace llvm {
const PIC16Section *ROMDATASection() const { const PIC16Section *ROMDATASection() const {
return ROMDATASection_; return ROMDATASection_;
} }
const PIC16Section *SHAREDUDATASection() const {
return SHAREDUDATASection_;
}
const std::vector<PIC16Section *> &AUTOSections() const { const std::vector<PIC16Section *> &AUTOSections() const {
return AUTOSections_; return AUTOSections_;
} }