diff options
| author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2010-02-16 03:41:07 +0000 |
|---|---|---|
| committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2010-02-16 03:41:07 +0000 |
| commit | adcee844ea90b3ae87d8bf3493023001aaa4453e (patch) | |
| tree | e0b7da542f7803716e0ea798ec1937e5c4699543 /llvm/lib/Target/PIC16 | |
| parent | ecd2600c522a592fbf03e86e8a6ca1b18dae4344 (diff) | |
| download | bcm5719-llvm-adcee844ea90b3ae87d8bf3493023001aaa4453e.tar.gz bcm5719-llvm-adcee844ea90b3ae87d8bf3493023001aaa4453e.zip | |
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.
llvm-svn: 96322
Diffstat (limited to 'llvm/lib/Target/PIC16')
| -rw-r--r-- | llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Target/PIC16/PIC16ABINames.h | 13 | ||||
| -rw-r--r-- | llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Target/PIC16/PIC16TargetObjectFile.h | 3 |
4 files changed, 23 insertions, 4 deletions
diff --git a/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp index 72f7c16c637..b015edd9e1d 100644 --- a/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp +++ b/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp @@ -106,8 +106,9 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { DbgInfo.BeginFunction(MF); // Now emit the instructions of function in its code section. - const MCSection *fCodeSection - = getObjFileLowering().SectionForCode(CurrentFnSym->getName()); + const MCSection *fCodeSection = + getObjFileLowering().SectionForCode(CurrentFnSym->getName(), + PAN::isISR(F->getSection())); // Start the Code Section. O << "\n"; diff --git a/llvm/lib/Target/PIC16/PIC16ABINames.h b/llvm/lib/Target/PIC16/PIC16ABINames.h index e18ddf158ec..b0b9318d438 100644 --- a/llvm/lib/Target/PIC16/PIC16ABINames.h +++ b/llvm/lib/Target/PIC16/PIC16ABINames.h @@ -325,6 +325,19 @@ namespace llvm { 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. } // end namespace llvm; diff --git a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp index d7cfe029d35..b891c18c464 100644 --- a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp +++ b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp @@ -315,8 +315,12 @@ PIC16TargetObjectFile::allocateSHARED(const GlobalVariable *GV, // Interface used by AsmPrinter to get a code section for a function. 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); + // 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); } diff --git a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h index 0b0ad43ff94..cf8bf848e45 100644 --- a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h +++ b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h @@ -137,7 +137,8 @@ namespace llvm { /// 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. const PIC16Section *SectionForFrame (const std::string &FnName) const; |

