Skip to content

Commit

Permalink
revert r79562 + r79563
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79690 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Aug 21, 2009
1 parent 361ae1d commit 35a27c8
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 533 deletions.
56 changes: 12 additions & 44 deletions lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
PTLI = static_cast<PIC16TargetLowering*>(TM.getTargetLowering());
PTAI = static_cast<const PIC16TargetAsmInfo*>(T);
PTOF = (PIC16TargetObjectFile*)&PTLI->getObjFileLowering();
CurrentFnPtr = NULL;
}

bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
Expand All @@ -61,11 +60,6 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
// Get the mangled name.
const Function *F = MF.getFunction();
CurrentFnName = Mang->getMangledName(F);
CurrentFnPtr = F;

// Current function name was mangled in llvm-ld for both
// MainLine and InterruptLine and should be demangled here
PAN::updateCallLineSymbol(CurrentFnName, CurrentFnPtr);

// Emit the function frame (args and temps).
EmitFunctionFrame(MF);
Expand All @@ -77,23 +71,18 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {

// Now emit the instructions of function in its code section.
const MCSection *fCodeSection =
getObjFileLowering().getSectionForFunction(CurrentFnName,
PAN::isISR(F));
getObjFileLowering().getSectionForFunction(CurrentFnName);
// Start the Code Section.
O << "\n";
OutStreamer.SwitchSection(fCodeSection);

// If it is not an interrupt function then emit the data address
// retrieval code in function code itself.
if (!(PAN::isISR(F))) {
// 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";
}

// 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";

// Emit function start label.
O << CurrentFnName << ":\n";

DebugLoc CurDL;
O << "\n";
// Print out code for the function.
Expand Down Expand Up @@ -153,9 +142,7 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
if (PAN::isMemIntrinsic(Sname)) {
LibcallDecls.push_back(createESName(Sname));
}
// All the call sites were mangled in llvm-ld pass hence the
// operands for call instructions should be demangled here.
PAN::updateCallLineSymbol(Sname, CurrentFnPtr);

O << Sname;
break;
}
Expand All @@ -164,9 +151,7 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {

// If its a libcall name, record it to decls section.
if (PAN::getSymbolTag(Sname) == PAN::LIBCALL) {
// LibCallDecls for InterruptLine functions should have ".IL" suffix
const char *NewName= PAN::getUpdatedLibCallDecl(Sname, CurrentFnPtr);
LibcallDecls.push_back(NewName);
LibcallDecls.push_back(Sname);
}

// Record a call to intrinsic to print the extern declaration for it.
Expand All @@ -175,13 +160,9 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
Sym = PAN::addPrefix(Sym);
LibcallDecls.push_back(createESName(Sym));
}
// Update the library call symbols. Library calls to InterruptLine
// functions are different. (They have ".IL" in their names)
// Also other symbols (frame and temp) for the cloned function
// should be updated here.
PAN::updateCallLineSymbol(Sym, CurrentFnPtr);
O << Sym;
break;

O << Sym;
break;
}
case MachineOperand::MO_MachineBasicBlock:
printBasicBlockLabel(MO.getMBB());
Expand Down Expand Up @@ -293,11 +274,7 @@ void PIC16AsmPrinter::EmitFunctionDecls(Module &M) {

const char *directive = I->isDeclaration() ? TAI->getExternDirective() :
TAI->getGlobalDirective();

// This is called in initialization. Hence information of the current
// function line is not available. Hence UnspecifiedLine. UnspecifiedLine
// will be treated as MainLine.
PAN::updateCallLineSymbol(Name, PAN::UnspecifiedLine);

O << directive << Name << "\n";
O << directive << PAN::getRetvalLabel(Name) << "\n";
O << directive << PAN::getArgsLabel(Name) << "\n";
Expand Down Expand Up @@ -446,13 +423,6 @@ void PIC16AsmPrinter::EmitAutos(std::string FunctName) {

// Now print Autos section for this function.
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
// should be cloned.
// This function will check and clone
PTOF->createClonedSectionForAutos(SectionName);

const std::vector<PIC16Section*> &AutosSections = PTOF->AutosSections;
for (unsigned i = 0; i < AutosSections.size(); i++) {
O << "\n";
Expand All @@ -466,8 +436,6 @@ void PIC16AsmPrinter::EmitAutos(std::string FunctName) {
Constant *C = Items[j]->getInitializer();
const Type *Ty = C->getType();
unsigned Size = TD->getTypeAllocSize(Ty);
// Auto variables should be cloned for the cloned function
PAN::updateCallLineAutos(VarName, CurrentFnName);
// Emit memory reserve directive.
O << VarName << " RES " << Size << "\n";
}
Expand Down
1 change: 0 additions & 1 deletion lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ namespace llvm {
PIC16DbgInfo DbgInfo;
const PIC16TargetAsmInfo *PTAI;
std::list<const char *> LibcallDecls; // List of extern decls.
const Function *CurrentFnPtr; // Hold the pointer to current Function
};
} // end of namespace

Expand Down
2 changes: 1 addition & 1 deletion lib/Target/PIC16/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BUILT_SOURCES = PIC16GenRegisterInfo.h.inc PIC16GenRegisterNames.inc \
PIC16GenDAGISel.inc PIC16GenCallingConv.inc \
PIC16GenSubtarget.inc

DIRS = AsmPrinter TargetInfo PIC16Passes
DIRS = AsmPrinter TargetInfo

include $(LEVEL)/Makefile.common

Loading

0 comments on commit 35a27c8

Please sign in to comment.