summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-21 23:08:09 +0000
committerChris Lattner <sabre@nondot.org>2009-08-21 23:08:09 +0000
commitec3579ff0d1d0872074d7f726f63e4aae90e6679 (patch)
tree9714d07ab0ec2af6f3e4e55b48fa46a91434b468 /lib
parentd6f761e0eb610936a6b8495360b62696dcd85164 (diff)
downloadllvm-ec3579ff0d1d0872074d7f726f63e4aae90e6679.tar.gz
llvm-ec3579ff0d1d0872074d7f726f63e4aae90e6679.tar.bz2
llvm-ec3579ff0d1d0872074d7f726f63e4aae90e6679.tar.xz
revert 79631
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp20
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h2
-rw-r--r--lib/Target/PIC16/MCSectionPIC16.h3
-rw-r--r--lib/Target/PIC16/PIC16.h1
-rw-r--r--lib/Target/PIC16/PIC16PAN.h29
-rw-r--r--lib/Target/PIC16/PIC16Passes/Makefile3
-rw-r--r--lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.cpp69
-rw-r--r--lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.h45
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.cpp29
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.h4
10 files changed, 8 insertions, 197 deletions
diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
index 65309ea675..b96ae54005 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(F);
+ EmitAutos(CurrentFnName);
// Now emit the instructions of function in its code section.
const MCSection *fCodeSection =
@@ -362,10 +362,9 @@ 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(SectionName);
+ getObjFileLowering().getSectionForFunctionFrame(CurrentFnName);
OutStreamer.SwitchSection(fPDataSection);
// Emit function frame label
@@ -441,12 +440,12 @@ void PIC16AsmPrinter::EmitUData(Module &M) {
}
}
-void PIC16AsmPrinter::EmitAutos(const Function *F) {
+void PIC16AsmPrinter::EmitAutos(std::string FunctName) {
// 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(CurrentFnName);
+ std::string SectionName = PAN::getAutosSectionName(FunctName);
// 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
@@ -460,15 +459,6 @@ void PIC16AsmPrinter::EmitAutos(const Function *F) {
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 ece19ca260..55a2fcf85a 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 (const Function *F);
+ void EmitAutos (std::string FunctName);
void EmitRemainingAutos ();
void EmitRomData (Module &M);
void EmitFunctionFrame(MachineFunction &MF);
diff --git a/lib/Target/PIC16/MCSectionPIC16.h b/lib/Target/PIC16/MCSectionPIC16.h
index cfc8dd067b..66607c813f 100644
--- a/lib/Target/PIC16/MCSectionPIC16.h
+++ b/lib/Target/PIC16/MCSectionPIC16.h
@@ -28,8 +28,7 @@ namespace llvm {
public:
const std::string &getName() const { return Name; }
-
- void setName(std::string name) { Name = name; }
+
static MCSectionPIC16 *Create(const StringRef &Name,
SectionKind K, MCContext &Ctx);
diff --git a/lib/Target/PIC16/PIC16.h b/lib/Target/PIC16/PIC16.h
index 073eb47f64..29f9079230 100644
--- a/lib/Target/PIC16/PIC16.h
+++ b/lib/Target/PIC16/PIC16.h
@@ -44,7 +44,6 @@ namespace PIC16CC {
UGE
};
}
-
// External symbol names require memory to live till the program end.
// So we have to allocate it and keep.
inline static const char *createESName (const std::string &name) {
diff --git a/lib/Target/PIC16/PIC16PAN.h b/lib/Target/PIC16/PIC16PAN.h
index a14671e755..837a42d4a5 100644
--- a/lib/Target/PIC16/PIC16PAN.h
+++ b/lib/Target/PIC16/PIC16PAN.h
@@ -22,19 +22,8 @@
#include <cassert>
#include <cstring>
#include <string>
-namespace llvm {
-namespace PIC16Overlay {
- // Implement Overlay through colors because we may want to enhance overlay
- // architecture later. More colors can be added then.
- // Idea here is that functions with same color can be overlayed.
- enum Overlay {
- // A color name can only consist of upper case letters and underscore.
- GREEN, // Stands for mainline functions that can be overlayed.
- GREEN_IL, // Interrupt line version of GREEN.
- RED // Stands for functions that can not be overlayed.
- };
-}
+namespace llvm {
// A Central class to manage all ABI naming conventions.
// PAN - [P]ic16 [A]BI [N]ames
class PAN {
@@ -425,22 +414,6 @@ namespace PIC16Overlay {
}
}
}
- inline static std::string getOverlayStr(unsigned Color) {
- std::string Str = "Overlay=";
- Str.append(getSectionNameForColor(Color));
- return Str;
- }
-
- inline static std::string getSectionNameForColor(unsigned Color) {
- switch (Color) {
- default:
- assert( 0 && "Color not supported");
- case PIC16Overlay::GREEN:
- return "GREEN";
- case PIC16Overlay::GREEN_IL:
- return "GREEN_IL";
- }
- }
inline static std::string getAutosSectionForColor(std::string Color) {
return Color.append("_AUTOS");
diff --git a/lib/Target/PIC16/PIC16Passes/Makefile b/lib/Target/PIC16/PIC16Passes/Makefile
index 61b43623a1..919562106a 100644
--- a/lib/Target/PIC16/PIC16Passes/Makefile
+++ b/lib/Target/PIC16/PIC16Passes/Makefile
@@ -12,8 +12,5 @@ TARGET = PIC16
LOADABLE_MODULE = 1
-# Hack: we need to include 'main' pic16 target directory to grab private headers
-CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
-
include $(LEVEL)/Makefile.common
diff --git a/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.cpp b/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.cpp
index cfeb97d6e7..e69de29bb2 100644
--- a/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.cpp
+++ b/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.cpp
@@ -1,69 +0,0 @@
-//===-- PIC16FrameOverlay.cpp - Implementation for PIC16 Frame Overlay===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains the PIC16 Frame Overlay implementation.
-//
-//===----------------------------------------------------------------------===//
-
-
-#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Pass.h"
-#include "llvm/Module.h"
-#include "llvm/Support/raw_ostream.h"
-#include "PIC16.h"
-#include "PIC16FrameOverlay.h"
-#include <vector>
-#include <iostream>
-using namespace llvm;
-using std::vector;
-using std::string;
-
-
-void PIC16FrameOverlay::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesCFG();
- AU.addRequired<CallGraph>();
-}
-
-bool PIC16FrameOverlay::runOnModule(Module &M) {
- CallGraph &CG = getAnalysis<CallGraph>();
- for (CallGraph::iterator it = CG.begin() ; it != CG.end(); it++)
- {
- // External calling node doesn't have any function associated
- // with it
- if (!it->first)
- continue;
-
- if (it->second->size() == 0) {
- if (PAN::isInterruptLineFunction(it->first))
- ColorFunction(it->second, PIC16Overlay::GREEN_IL);
- else
- ColorFunction(it->second, PIC16Overlay::GREEN);
- }
- }
- return false;
-}
-
-void PIC16FrameOverlay::ColorFunction(CallGraphNode *CGN, unsigned Color) {
- switch (Color) {
- case PIC16Overlay::GREEN:
- case PIC16Overlay::GREEN_IL: {
- Function *LeafFunct = CGN->getFunction();
- std::string Section = "";
- if (LeafFunct->hasSection()) {
- Section = LeafFunct->getSection();
- Section.append(" ");
- }
- Section.append(PAN::getOverlayStr(Color));
- LeafFunct->setSection(Section);
- break;
- }
- default:
- assert( 0 && "Color not supported");
- }
-}
diff --git a/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.h b/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.h
index 813ceba063..e69de29bb2 100644
--- a/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.h
+++ b/lib/Target/PIC16/PIC16Passes/PIC16FrameOverlay.h
@@ -1,45 +0,0 @@
-//===-- PIC16FrameOverlay.h - Interface for PIC16 Frame Overlay -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains the PIC16 Frame Overlay infrastructure.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef PIC16FRAMEOVERLAY_H
-#define PIC16FRAMEOVERLAY_H
-
-#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Pass.h"
-#include "llvm/Module.h"
-#include "llvm/Support/raw_ostream.h"
-#include <vector>
-#include <iostream>
-using std::vector;
-using std::string;
-using namespace llvm;
-
-namespace {
-
- class PIC16FrameOverlay : public ModulePass {
- public:
- static char ID; // Class identification
- PIC16FrameOverlay() : ModulePass(&ID) {}
-
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
- virtual bool runOnModule(Module &M);
- private:
- void ColorFunction(CallGraphNode *CGN, unsigned Color);
- };
- char PIC16FrameOverlay::ID = 0;
- static RegisterPass<PIC16FrameOverlay>
- Y("pic16overlay", "PIC16 Frame Overlay Analysis");
-
-} // End of namespace
-
-#endif
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
index b3c435e85c..3ff27a9ae7 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.cpp
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
@@ -82,35 +82,6 @@ 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=";
- size_t 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");
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.h b/lib/Target/PIC16/PIC16TargetObjectFile.h
index a8f4c63fd8..4676b3c8d6 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.h
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.h
@@ -12,7 +12,6 @@
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/Function.h"
#include <vector>
#include <string>
@@ -85,9 +84,6 @@ namespace llvm {
// If the current function is cloned then create the new autos section
// also.
void createClonedSectionForAutos(const std::string &SecName);
- std::string getNameForFunctFrame(const Function *F,
- bool IsAutosSection = false);
-
private:
std::string getSectionNameForSym(const std::string &Sym) const;