summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
index b96ae54005e..65309ea6750 100644
--- a/llvm/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
+++ b/llvm/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++) {
OpenPOWER on IntegriCloud