summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-08-21 15:22:33 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-08-21 15:22:33 +0000
commit9ae3bcb79eb1fcbea887acd533b310d6f34ca065 (patch)
treebb99bd15fab32fe980a7f0815d1ab104f72fee3c /llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
parent37fd02c5a1a21ff880fb87d28e9c974c8187f31c (diff)
downloadbcm5719-llvm-9ae3bcb79eb1fcbea887acd533b310d6f34ca065.tar.gz
bcm5719-llvm-9ae3bcb79eb1fcbea887acd533b310d6f34ca065.zip
Add a pass to do call graph analyis to overlay the autos and frame sections of
leaf functions. This pass will be extended to color other nodes of the call tree as well in future. llvm-svn: 79631
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp')
-rw-r--r--llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
index 3ff27a9ae7f..4c2349f9ee4 100644
--- a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
+++ b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
@@ -82,6 +82,35 @@ getSectionForFunctionFrame(const std::string &FnName) const {
return getPIC16Section(T.c_str(), SectionKind::getDataRel());
}
+std::string PIC16TargetObjectFile::getNameForFunctFrame(const Function *F,
+ bool IsAutosSection) {
+ std::string SectionName = F->getName();
+ if (F->hasSection()) {
+ std::string Sectn = F->getSection();
+ std::string StrToFind = "Overlay=";
+ unsigned Pos = Sectn.find(StrToFind);
+ if (Pos != std::string::npos) {
+ Pos += StrToFind.length();
+ std::string Color = "";
+ char c = Sectn.at(Pos);
+ // A Color can only consist on upper case letters or underscore.
+ while ((c >= 'A' && c<= 'Z') || c == '_') {
+ Color.append(1,c);
+ Pos++;
+ if (Pos >= Sectn.length())
+ break;
+ c = Sectn.at(Pos);
+ }
+ // Autos Section need to be given a different name from function frame.
+ if (IsAutosSection)
+ SectionName = PAN::getAutosSectionForColor(Color);
+ else
+ SectionName = Color;
+ }
+ }
+ return SectionName;
+}
+
const MCSection *
PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
assert(GV->hasInitializer() && "This global doesn't need space");
OpenPOWER on IntegriCloud