diff options
Diffstat (limited to 'lib/Target/PIC16')
-rw-r--r-- | lib/Target/PIC16/AsmPrinter/Makefile | 1 | ||||
-rw-r--r-- | lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp | 82 | ||||
-rw-r--r-- | lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h | 4 | ||||
-rw-r--r-- | lib/Target/PIC16/Makefile | 2 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16DebugInfo.cpp | 5 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16Passes/Makefile | 1 | ||||
-rw-r--r-- | lib/Target/PIC16/TargetInfo/Makefile | 1 |
7 files changed, 46 insertions, 50 deletions
diff --git a/lib/Target/PIC16/AsmPrinter/Makefile b/lib/Target/PIC16/AsmPrinter/Makefile index f4db57e..27c4045 100644 --- a/lib/Target/PIC16/AsmPrinter/Makefile +++ b/lib/Target/PIC16/AsmPrinter/Makefile @@ -8,6 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../../../.. LIBRARYNAME = LLVMPIC16AsmPrinter +CXXFLAGS = -fno-rtti # Hack: we need to include 'main' pic16 target directory to grab private headers CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp index 87f5aad..0463596 100644 --- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp +++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp @@ -29,7 +29,6 @@ #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" -#include "llvm/Support/Mangler.h" #include <cstring> using namespace llvm; @@ -82,7 +81,7 @@ static int getFunctionColor(const Function *F) { // Color the Auto section of the given function. void PIC16AsmPrinter::ColorAutoSection(const Function *F) { - std::string SectionName = PAN::getAutosSectionName(CurrentFnName); + std::string SectionName = PAN::getAutosSectionName(CurrentFnSym->getName()); PIC16Section* Section = PTOF->findPIC16Section(SectionName); if (Section != NULL) { int Color = getFunctionColor(F); @@ -103,11 +102,8 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { // of runOnMachineFunction. SetupMachineFunction(MF); - // Get the mangled name. - const Function *F = MF.getFunction(); - CurrentFnName = Mang->getMangledName(F); - // Put the color information from function to its auto section. + const Function *F = MF.getFunction(); ColorAutoSection(F); // Emit the function frame (args and temps). @@ -117,18 +113,18 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { // Now emit the instructions of function in its code section. const MCSection *fCodeSection - = getObjFileLowering().SectionForCode(CurrentFnName); + = getObjFileLowering().SectionForCode(CurrentFnSym->getName()); // Start the Code Section. O << "\n"; OutStreamer.SwitchSection(fCodeSection); // Emit the frame address of the function at the beginning of code. - O << "\tretlw low(" << PAN::getFrameLabel(CurrentFnName) << ")\n"; - O << "\tretlw high(" << PAN::getFrameLabel(CurrentFnName) << ")\n"; + O << "\tretlw low(" << PAN::getFrameLabel(CurrentFnSym->getName()) << ")\n"; + O << "\tretlw high(" << PAN::getFrameLabel(CurrentFnSym->getName()) << ")\n"; // Emit function start label. - O << CurrentFnName << ":\n"; + O << *CurrentFnSym << ":\n"; DebugLoc CurDL; O << "\n"; @@ -187,24 +183,22 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { return; case MachineOperand::MO_GlobalAddress: { - std::string Sname = Mang->getMangledName(MO.getGlobal()); + MCSymbol *Sym = GetGlobalValueSymbol(MO.getGlobal()); // FIXME: currently we do not have a memcpy def coming in the module // by any chance, as we do not link in those as .bc lib. So these calls // are always external and it is safe to emit an extern. - if (PAN::isMemIntrinsic(Sname)) { - LibcallDecls.push_back(createESName(Sname)); - } + if (PAN::isMemIntrinsic(Sym->getName())) + LibcallDecls.push_back(createESName(Sym->getName())); - O << Sname; + O << *Sym; break; } case MachineOperand::MO_ExternalSymbol: { const char *Sname = MO.getSymbolName(); // If its a libcall name, record it to decls section. - if (PAN::getSymbolTag(Sname) == PAN::LIBCALL) { + if (PAN::getSymbolTag(Sname) == PAN::LIBCALL) LibcallDecls.push_back(Sname); - } // Record a call to intrinsic to print the extern declaration for it. std::string Sym = Sname; @@ -213,11 +207,11 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { LibcallDecls.push_back(createESName(Sym)); } - O << Sym; + O << Sym; break; } case MachineOperand::MO_MachineBasicBlock: - GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI); + O << *GetMBBSymbol(MO.getMBB()->getNumber()); return; default: @@ -319,16 +313,14 @@ void PIC16AsmPrinter::EmitFunctionDecls(Module &M) { // Emit declarations for external functions. O <<"\n"<<MAI->getCommentString() << "Function Declarations - BEGIN." <<"\n"; for (Module::iterator I = M.begin(), E = M.end(); I != E; I++) { - if (I->isIntrinsic()) - continue; - - std::string Name = Mang->getMangledName(I); - if (Name.compare("@abort") == 0) + if (I->isIntrinsic() || I->getName() == "@abort") continue; if (!I->isDeclaration() && !I->hasExternalLinkage()) continue; + MCSymbol *Sym = GetGlobalValueSymbol(I); + // Do not emit memcpy, memset, and memmove here. // Calls to these routines can be generated in two ways, // 1. User calling the standard lib function @@ -337,14 +329,14 @@ void PIC16AsmPrinter::EmitFunctionDecls(Module &M) { // second case the call is via and externalsym and the prototype is missing. // So declarations for these are currently always getting printing by // tracking both kind of references in printInstrunction. - if (I->isDeclaration() && PAN::isMemIntrinsic(Name)) continue; + if (I->isDeclaration() && PAN::isMemIntrinsic(Sym->getName())) continue; const char *directive = I->isDeclaration() ? MAI->getExternDirective() : MAI->getGlobalDirective(); - O << directive << Name << "\n"; - O << directive << PAN::getRetvalLabel(Name) << "\n"; - O << directive << PAN::getArgsLabel(Name) << "\n"; + O << directive << Sym->getName() << "\n"; + O << directive << PAN::getRetvalLabel(Sym->getName()) << "\n"; + O << directive << PAN::getArgsLabel(Sym->getName()) << "\n"; } O << MAI->getCommentString() << "Function Declarations - END." <<"\n"; @@ -356,9 +348,8 @@ void PIC16AsmPrinter::EmitUndefinedVars(Module &M) { if (!Items.size()) return; O << "\n" << MAI->getCommentString() << "Imported Variables - BEGIN" << "\n"; - for (unsigned j = 0; j < Items.size(); j++) { - O << MAI->getExternDirective() << Mang->getMangledName(Items[j]) << "\n"; - } + for (unsigned j = 0; j < Items.size(); j++) + O << MAI->getExternDirective() << *GetGlobalValueSymbol(Items[j]) << "\n"; O << MAI->getCommentString() << "Imported Variables - END" << "\n"; } @@ -368,9 +359,8 @@ void PIC16AsmPrinter::EmitDefinedVars(Module &M) { if (!Items.size()) return; O << "\n" << MAI->getCommentString() << "Exported Variables - BEGIN" << "\n"; - for (unsigned j = 0; j < Items.size(); j++) { - O << MAI->getGlobalDirective() << Mang->getMangledName(Items[j]) << "\n"; - } + for (unsigned j = 0; j < Items.size(); j++) + O << MAI->getGlobalDirective() << *GetGlobalValueSymbol(Items[j]) << "\n"; O << MAI->getCommentString() << "Exported Variables - END" << "\n"; } @@ -394,19 +384,19 @@ bool PIC16AsmPrinter::doFinalization(Module &M) { void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) { const Function *F = MF.getFunction(); - std::string FuncName = Mang->getMangledName(F); const TargetData *TD = TM.getTargetData(); // Emit the data section name. O << "\n"; - PIC16Section *fPDataSection = const_cast<PIC16Section *>(getObjFileLowering(). - SectionForFrame(CurrentFnName)); + PIC16Section *fPDataSection = + const_cast<PIC16Section *>(getObjFileLowering(). + SectionForFrame(CurrentFnSym->getName())); fPDataSection->setColor(getFunctionColor(F)); OutStreamer.SwitchSection(fPDataSection); // Emit function frame label - O << PAN::getFrameLabel(CurrentFnName) << ":\n"; + O << PAN::getFrameLabel(CurrentFnSym->getName()) << ":\n"; const Type *RetType = F->getReturnType(); unsigned RetSize = 0; @@ -418,9 +408,10 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) { // we will need to avoid printing a global directive for Retval label // in emitExternandGloblas. if(RetSize > 0) - O << PAN::getRetvalLabel(CurrentFnName) << " RES " << RetSize << "\n"; + O << PAN::getRetvalLabel(CurrentFnSym->getName()) + << " RES " << RetSize << "\n"; else - O << PAN::getRetvalLabel(CurrentFnName) << ": \n"; + O << PAN::getRetvalLabel(CurrentFnSym->getName()) << ": \n"; // Emit variable to hold the space for function arguments unsigned ArgSize = 0; @@ -430,12 +421,13 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) { ArgSize += TD->getTypeAllocSize(Ty); } - O << PAN::getArgsLabel(CurrentFnName) << " RES " << ArgSize << "\n"; + O << PAN::getArgsLabel(CurrentFnSym->getName()) << " RES " << ArgSize << "\n"; // Emit temporary space int TempSize = PTLI->GetTmpSize(); if (TempSize > 0) - O << PAN::getTempdataLabel(CurrentFnName) << " RES " << TempSize << '\n'; + O << PAN::getTempdataLabel(CurrentFnSym->getName()) << " RES " + << TempSize << '\n'; } @@ -445,10 +437,9 @@ void PIC16AsmPrinter::EmitInitializedDataSection(const PIC16Section *S) { std::vector<const GlobalVariable*> Items = S->Items; for (unsigned j = 0; j < Items.size(); j++) { - std::string Name = Mang->getMangledName(Items[j]); Constant *C = Items[j]->getInitializer(); int AddrSpace = Items[j]->getType()->getAddressSpace(); - O << Name; + O << *GetGlobalValueSymbol(Items[j]); EmitGlobalConstant(C, AddrSpace); } } @@ -464,11 +455,10 @@ EmitUninitializedDataSection(const PIC16Section *S) { OutStreamer.SwitchSection(S); std::vector<const GlobalVariable*> Items = S->Items; for (unsigned j = 0; j < Items.size(); j++) { - std::string Name = Mang->getMangledName(Items[j]); Constant *C = Items[j]->getInitializer(); const Type *Ty = C->getType(); unsigned Size = TD->getTypeAllocSize(Ty); - O << Name << " RES " << Size << "\n"; + O << *GetGlobalValueSymbol(Items[j]) << " RES " << Size << "\n"; } } diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h index 838c970..74ab72c 100644 --- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h +++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h @@ -69,9 +69,9 @@ namespace llvm { bool doInitialization(Module &M); bool doFinalization(Module &M); - /// PrintGlobalVariable - Emit the specified global variable and its + /// EmitGlobalVariable - Emit the specified global variable and its /// initializer to the output stream. - virtual void PrintGlobalVariable(const GlobalVariable *GV) { + virtual void EmitGlobalVariable(const GlobalVariable *GV) { // PIC16 doesn't use normal hooks for this. } diff --git a/lib/Target/PIC16/Makefile b/lib/Target/PIC16/Makefile index 4382eba7..a1dbde5 100644 --- a/lib/Target/PIC16/Makefile +++ b/lib/Target/PIC16/Makefile @@ -6,9 +6,11 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## + LEVEL = ../../.. LIBRARYNAME = LLVMPIC16CodeGen TARGET = PIC16 +CXXFLAGS = -fno-rtti # Make sure that tblgen is run, first thing. BUILT_SOURCES = PIC16GenRegisterInfo.h.inc PIC16GenRegisterNames.inc \ diff --git a/lib/Target/PIC16/PIC16DebugInfo.cpp b/lib/Target/PIC16/PIC16DebugInfo.cpp index 6e0e3ce..8368a3c 100644 --- a/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -259,8 +259,9 @@ void PIC16DbgInfo::ChangeDebugLoc(const MachineFunction &MF, if (! EmitDebugDirectives) return; assert (! DL.isUnknown() && "can't change to invalid debug loc"); - MDNode *CU = MF.getDebugLocTuple(DL).Scope; - unsigned line = MF.getDebugLocTuple(DL).Line; + DILocation Loc = MF.getDILocation(DL); + MDNode *CU = Loc.getScope().getNode(); + unsigned line = Loc.getLineNumber(); SwitchToCU(CU); SwitchToLine(line, IsInBeginFunction); diff --git a/lib/Target/PIC16/PIC16Passes/Makefile b/lib/Target/PIC16/PIC16Passes/Makefile index 9684b8d..fb45d71 100644 --- a/lib/Target/PIC16/PIC16Passes/Makefile +++ b/lib/Target/PIC16/PIC16Passes/Makefile @@ -10,6 +10,7 @@ LEVEL = ../../../.. TARGET = PIC16 LIBRARYNAME = LLVMpic16passes BUILD_ARCHIVE = 1 +CXXFLAGS = -fno-rtti include $(LEVEL)/Makefile.common diff --git a/lib/Target/PIC16/TargetInfo/Makefile b/lib/Target/PIC16/TargetInfo/Makefile index 76609f6..9004be8 100644 --- a/lib/Target/PIC16/TargetInfo/Makefile +++ b/lib/Target/PIC16/TargetInfo/Makefile @@ -8,6 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../../../.. LIBRARYNAME = LLVMPIC16Info +CXXFLAGS = -fno-rtti # Hack: we need to include 'main' target directory to grab private headers CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. |