mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-01 01:14:12 +00:00
make SectionForGlobal non-virtual, add a hook for pic16 to do its "address=" hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76989 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
731b5d97be
commit
7420ab2191
@ -594,6 +594,19 @@ namespace llvm {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// SectionForGlobal - This hooks returns proper section name for given
|
||||||
|
/// global with all necessary flags and marks.
|
||||||
|
// FIXME: MOVE TO TARGETLOWERING.
|
||||||
|
const Section* SectionForGlobal(const GlobalValue *GV) const;
|
||||||
|
|
||||||
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
|
/// section assignment of a global.
|
||||||
|
/// FIXME: ELIMINATE
|
||||||
|
virtual const Section *
|
||||||
|
getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
||||||
|
SectionKind::Kind Kind) const{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// SectionKindForGlobal - This hook allows the target to select proper
|
/// SectionKindForGlobal - This hook allows the target to select proper
|
||||||
/// section kind used for global emission.
|
/// section kind used for global emission.
|
||||||
@ -601,10 +614,6 @@ namespace llvm {
|
|||||||
virtual SectionKind::Kind
|
virtual SectionKind::Kind
|
||||||
SectionKindForGlobal(const GlobalValue *GV) const;
|
SectionKindForGlobal(const GlobalValue *GV) const;
|
||||||
|
|
||||||
/// SectionForGlobal - This hooks returns proper section name for given
|
|
||||||
/// global with all necessary flags and marks.
|
|
||||||
// FIXME: Eliminate this.
|
|
||||||
virtual const Section* SectionForGlobal(const GlobalValue *GV) const;
|
|
||||||
|
|
||||||
const std::string &getSectionFlags(unsigned Flags) const;
|
const std::string &getSectionFlags(unsigned Flags) const;
|
||||||
virtual std::string printSectionFlags(unsigned flags) const { return ""; }
|
virtual std::string printSectionFlags(unsigned flags) const { return ""; }
|
||||||
|
@ -203,15 +203,13 @@ PIC16TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV1) const {
|
|||||||
|
|
||||||
// First, if this is an automatic variable for a function, get the section
|
// First, if this is an automatic variable for a function, get the section
|
||||||
// name for it and return.
|
// name for it and return.
|
||||||
const std::string name = GV->getName();
|
std::string name = GV->getName();
|
||||||
if (PAN::isLocalName(name)) {
|
if (PAN::isLocalName(name))
|
||||||
return getSectionForAuto(GV);
|
return getSectionForAuto(GV);
|
||||||
}
|
|
||||||
|
|
||||||
// Record Exteranl Var Defs.
|
// Record Exteranl Var Defs.
|
||||||
if (GV->hasExternalLinkage() || GV->hasCommonLinkage()) {
|
if (GV->hasExternalLinkage() || GV->hasCommonLinkage())
|
||||||
ExternalVarDefs->Items.push_back(GV);
|
ExternalVarDefs->Items.push_back(GV);
|
||||||
}
|
|
||||||
|
|
||||||
// See if this is an uninitialized global.
|
// See if this is an uninitialized global.
|
||||||
const Constant *C = GV->getInitializer();
|
const Constant *C = GV->getInitializer();
|
||||||
@ -243,10 +241,12 @@ PIC16TargetAsmInfo::~PIC16TargetAsmInfo() {
|
|||||||
delete ExternalVarDefs;
|
delete ExternalVarDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override the default implementation. Create PIC16sections for variables
|
|
||||||
// which have a section name or address.
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
const Section*
|
/// section assignment of a global.
|
||||||
PIC16TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
const Section *
|
||||||
|
PIC16TargetAsmInfo::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
||||||
|
SectionKind::Kind Kind) const{
|
||||||
// If GV has a sectin name or section address create that section now.
|
// If GV has a sectin name or section address create that section now.
|
||||||
if (GV->hasSection()) {
|
if (GV->hasSection()) {
|
||||||
if (const GlobalVariable *GVar = cast<GlobalVariable>(GV)) {
|
if (const GlobalVariable *GVar = cast<GlobalVariable>(GV)) {
|
||||||
@ -260,9 +260,8 @@ PIC16TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use section depending on the 'type' of variable
|
return 0;
|
||||||
return SelectSectionForGlobal(GV);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new section for global variable. If Addr is given then create
|
// Create a new section for global variable. If Addr is given then create
|
||||||
|
@ -91,7 +91,13 @@ namespace llvm {
|
|||||||
const std::vector<PIC16Section*> &getROSections() const {
|
const std::vector<PIC16Section*> &getROSections() const {
|
||||||
return ROSections;
|
return ROSections;
|
||||||
}
|
}
|
||||||
virtual const Section *SectionForGlobal(const GlobalValue *GV) const;
|
|
||||||
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
|
/// section assignment of a global.
|
||||||
|
virtual const Section *
|
||||||
|
getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
||||||
|
SectionKind::Kind Kind) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -263,10 +263,18 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
|
|||||||
|
|
||||||
|
|
||||||
const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
||||||
// Select section name
|
SectionKind::Kind Kind = SectionKindForGlobal(GV);
|
||||||
|
|
||||||
|
// Select section name.
|
||||||
if (GV->hasSection()) {
|
if (GV->hasSection()) {
|
||||||
|
|
||||||
|
// If the target has special section hacks for specifically named globals,
|
||||||
|
// return them now.
|
||||||
|
if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind))
|
||||||
|
return TS;
|
||||||
|
|
||||||
// Honour section already set, if any.
|
// Honour section already set, if any.
|
||||||
unsigned Flags = SectionFlagsForGlobal(GV, SectionKindForGlobal(GV));
|
unsigned Flags = SectionFlagsForGlobal(GV, Kind);
|
||||||
|
|
||||||
// This is an explicitly named section.
|
// This is an explicitly named section.
|
||||||
Flags |= SectionFlags::Named;
|
Flags |= SectionFlags::Named;
|
||||||
@ -282,9 +290,8 @@ const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
|||||||
// If this global is linkonce/weak and the target handles this by emitting it
|
// If this global is linkonce/weak and the target handles this by emitting it
|
||||||
// into a 'uniqued' section name, create and return the section now.
|
// into a 'uniqued' section name, create and return the section now.
|
||||||
if (GV->isWeakForLinker()) {
|
if (GV->isWeakForLinker()) {
|
||||||
if (const char *Prefix =
|
if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) {
|
||||||
getSectionPrefixForUniqueGlobal(SectionKindForGlobal(GV))) {
|
unsigned Flags = SectionFlagsForGlobal(GV, Kind);
|
||||||
unsigned Flags = SectionFlagsForGlobal(GV, SectionKindForGlobal(GV));
|
|
||||||
|
|
||||||
// FIXME: Use mangler interface (PR4584).
|
// FIXME: Use mangler interface (PR4584).
|
||||||
std::string Name = Prefix+GV->getNameStr();
|
std::string Name = Prefix+GV->getNameStr();
|
||||||
|
Loading…
Reference in New Issue
Block a user