mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
start refactoring pic16 section selection logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76977 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2dcafe4b8f
commit
7c023d6759
@ -249,13 +249,15 @@ const Section*
|
|||||||
PIC16TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
PIC16TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) 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()) {
|
||||||
std::string SectName = GV->getSection();
|
if (const GlobalVariable *GVar = cast<GlobalVariable>(GV)) {
|
||||||
// If address for a variable is specified, get the address and create
|
std::string SectName = GVar->getSection();
|
||||||
// section.
|
// If address for a variable is specified, get the address and create
|
||||||
std::string AddrStr = "Address=";
|
// section.
|
||||||
if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
|
std::string AddrStr = "Address=";
|
||||||
std::string SectAddr = SectName.substr(AddrStr.length());
|
if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
|
||||||
return CreateSectionForGlobal(GV, SectAddr);
|
std::string SectAddr = SectName.substr(AddrStr.length());
|
||||||
|
return CreateSectionForGlobal(GVar, SectAddr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,13 +268,8 @@ PIC16TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
|
|||||||
// 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
|
||||||
// section at that address else create by name.
|
// section at that address else create by name.
|
||||||
const Section *
|
const Section *
|
||||||
PIC16TargetAsmInfo::CreateSectionForGlobal(const GlobalValue *GV1,
|
PIC16TargetAsmInfo::CreateSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr) const {
|
const std::string &Addr) const {
|
||||||
const GlobalVariable *GV = dyn_cast<GlobalVariable>(GV1);
|
|
||||||
|
|
||||||
if (!GV)
|
|
||||||
return TargetAsmInfo::SectionForGlobal(GV1);
|
|
||||||
|
|
||||||
// See if this is an uninitialized global.
|
// See if this is an uninitialized global.
|
||||||
const Constant *C = GV->getInitializer();
|
const Constant *C = GV->getInitializer();
|
||||||
if (C->isNullValue())
|
if (C->isNullValue())
|
||||||
|
@ -75,8 +75,8 @@ namespace llvm {
|
|||||||
const Section *CreateROSectionForGlobal(const GlobalVariable *GV,
|
const Section *CreateROSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr = "") const;
|
std::string Addr = "") const;
|
||||||
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV) const;
|
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV) const;
|
||||||
const Section * CreateSectionForGlobal(const GlobalValue *GV,
|
const Section *CreateSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr = "") const;
|
const std::string &Addr = "") const;
|
||||||
public:
|
public:
|
||||||
void SetSectionForGVs(Module &M);
|
void SetSectionForGVs(Module &M);
|
||||||
const std::vector<PIC16Section*> &getBSSSections() const {
|
const std::vector<PIC16Section*> &getBSSSections() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user