summaryrefslogtreecommitdiff
path: root/lib/Target/PIC16/AsmPrinter
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
commiteaa8b1f81d391ede72c4e8fcb1a8b426845e3932 (patch)
tree2f94360e3c74816c257b7c0801d950d40a6b4996 /lib/Target/PIC16/AsmPrinter
parent1f2b32c5c6502c74890c188b0224e4c01ff22da4 (diff)
downloadllvm-eaa8b1f81d391ede72c4e8fcb1a8b426845e3932.tar.gz
llvm-eaa8b1f81d391ede72c4e8fcb1a8b426845e3932.tar.bz2
llvm-eaa8b1f81d391ede72c4e8fcb1a8b426845e3932.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79631 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/AsmPrinter')
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp20
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h2
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
index b96ae54005..65309ea675 100644
--- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
@@ -73,7 +73,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
DbgInfo.BeginFunction(MF);
// Emit the autos section of function.
- EmitAutos(CurrentFnName);
+ EmitAutos(F);
// Now emit the instructions of function in its code section.
const MCSection *fCodeSection =
@@ -362,9 +362,10 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
const TargetData *TD = TM.getTargetData();
// Emit the data section name.
O << "\n";
-
+
+ std::string SectionName = getObjFileLowering().getNameForFunctFrame(F);
const MCSection *fPDataSection =
- getObjFileLowering().getSectionForFunctionFrame(CurrentFnName);
+ getObjFileLowering().getSectionForFunctionFrame(SectionName);
OutStreamer.SwitchSection(fPDataSection);
// Emit function frame label
@@ -440,12 +441,12 @@ void PIC16AsmPrinter::EmitUData(Module &M) {
}
}
-void PIC16AsmPrinter::EmitAutos(std::string FunctName) {
+void PIC16AsmPrinter::EmitAutos(const Function *F) {
// Section names for all globals are already set.
const TargetData *TD = TM.getTargetData();
// Now print Autos section for this function.
- std::string SectionName = PAN::getAutosSectionName(FunctName);
+ std::string SectionName = PAN::getAutosSectionName(CurrentFnName);
// If this function is a cloned function then the name of auto section
// will not be present in the list of existing section. Hence this section
@@ -459,6 +460,15 @@ void PIC16AsmPrinter::EmitAutos(std::string FunctName) {
if (AutosSections[i]->S_->getName() == SectionName) {
// Set the printing status to true
AutosSections[i]->setPrintedStatus(true);
+ // Overlay auto sections with same function color.
+ std::string BaseSectionName = getObjFileLowering().
+ getNameForFunctFrame(F, true);
+ if (BaseSectionName != F->getName()) {
+ std::string NewSectionName = PAN::getAutosSectionName(BaseSectionName);
+ const_cast<MCSectionPIC16 *>(AutosSections[i]->S_)->setName(
+ NewSectionName);
+ }
+
OutStreamer.SwitchSection(AutosSections[i]->S_);
const std::vector<const GlobalVariable*> &Items = AutosSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h
index 55a2fcf85a..ece19ca260 100644
--- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h
+++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h
@@ -52,7 +52,7 @@ namespace llvm {
void EmitDefinedVars (Module &M);
void EmitIData (Module &M);
void EmitUData (Module &M);
- void EmitAutos (std::string FunctName);
+ void EmitAutos (const Function *F);
void EmitRemainingAutos ();
void EmitRomData (Module &M);
void EmitFunctionFrame(MachineFunction &MF);