mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
The code section for an ISR has a specific address.
Currently, whether a function is ISR or not is encoded in the section attribute for that function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96322 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6e303cb9fa
commit
7643ca5c2b
@ -106,8 +106,9 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
DbgInfo.BeginFunction(MF);
|
DbgInfo.BeginFunction(MF);
|
||||||
|
|
||||||
// Now emit the instructions of function in its code section.
|
// Now emit the instructions of function in its code section.
|
||||||
const MCSection *fCodeSection
|
const MCSection *fCodeSection =
|
||||||
= getObjFileLowering().SectionForCode(CurrentFnSym->getName());
|
getObjFileLowering().SectionForCode(CurrentFnSym->getName(),
|
||||||
|
PAN::isISR(F->getSection()));
|
||||||
|
|
||||||
// Start the Code Section.
|
// Start the Code Section.
|
||||||
O << "\n";
|
O << "\n";
|
||||||
|
@ -325,6 +325,19 @@ namespace llvm {
|
|||||||
|
|
||||||
return o.str();
|
return o.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if the current function is an ISR
|
||||||
|
inline static bool isISR(const std::string SectName) {
|
||||||
|
if (SectName.find("interrupt") != std::string::npos)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the address for ISR starts in rom.
|
||||||
|
inline static std::string getISRAddr(void) {
|
||||||
|
return "0x4";
|
||||||
|
}
|
||||||
}; // class PAN.
|
}; // class PAN.
|
||||||
} // end namespace llvm;
|
} // end namespace llvm;
|
||||||
|
|
||||||
|
@ -315,8 +315,12 @@ PIC16TargetObjectFile::allocateSHARED(const GlobalVariable *GV,
|
|||||||
|
|
||||||
// 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,
|
||||||
|
bool isISR) const {
|
||||||
const std::string &sec_name = PAN::getCodeSectionName(FnName);
|
const std::string &sec_name = PAN::getCodeSectionName(FnName);
|
||||||
|
// If it is ISR, its code section starts at a specific address.
|
||||||
|
if (isISR)
|
||||||
|
return getPIC16Section(sec_name, CODE, PAN::getISRAddr());
|
||||||
return getPIC16Section(sec_name, CODE);
|
return getPIC16Section(sec_name, CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,8 @@ namespace llvm {
|
|||||||
|
|
||||||
|
|
||||||
/// Return a code section for a function.
|
/// Return a code section for a function.
|
||||||
const PIC16Section *SectionForCode (const std::string &FnName) const;
|
const PIC16Section *SectionForCode (const std::string &FnName,
|
||||||
|
bool isISR) const;
|
||||||
|
|
||||||
/// Return a frame section for a function.
|
/// Return a frame section for a function.
|
||||||
const PIC16Section *SectionForFrame (const std::string &FnName) const;
|
const PIC16Section *SectionForFrame (const std::string &FnName) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user