From 4b489c75c24b31f7310501dde48ca7ea3676e0af Mon Sep 17 00:00:00 2001 From: Sanjiv Gupta Date: Wed, 8 Apr 2009 05:38:48 +0000 Subject: Handle indirect function calls. Every function has the address of its frame in the beginning of code section. The frame address is retrieved and used to pass arguments. llvm-svn: 68597 --- llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp') diff --git a/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp b/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp index c0b1f6e8607..109504ec68a 100644 --- a/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp +++ b/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp @@ -113,6 +113,10 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { SectionFlags::Code); O << "\n"; SwitchToSection (fCodeSection); + O << CurrentFnName << ":\n"; + O << " retlw low(" << CurrentFnName << ".frame)\n"; + O << " retlw high(" << CurrentFnName << ".frame)\n"; + // Print out code for the function. for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); @@ -122,8 +126,6 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { printBasicBlockLabel(I, true); O << '\n'; } - else - O << CurrentFnName << ":\n"; CurBank = ""; for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { -- cgit v1.2.3