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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68597 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index c0b1f6e..109504e 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -113,6 +113,10 @@
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 @@
printBasicBlockLabel(I, true);
O << '\n';
}
- else
- O << CurrentFnName << ":\n";
CurBank = "";
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {