summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2007-10-09 03:01:19 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2007-10-09 03:01:19 +0000
commit35d86e60b6db89ad34dd15e90fa410fc43a26be5 (patch)
tree7a8c2332105f7705416f28e886042f5e39c1d3ce /llvm/lib/Target/Mips/MipsAsmPrinter.cpp
parent5cef9cfd095800da95343abcd65dae9ddd20d1dd (diff)
downloadbcm5719-llvm-35d86e60b6db89ad34dd15e90fa410fc43a26be5.tar.gz
bcm5719-llvm-35d86e60b6db89ad34dd15e90fa410fc43a26be5.zip
Position Independent Code (PIC) support [2]
- Added a function to hold the stack location where GP must be stored during LowerCALL - AsmPrinter now emits directives based on relocation type - PIC_ set to default relocation type (same as GCC) llvm-svn: 42779
Diffstat (limited to 'llvm/lib/Target/Mips/MipsAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsAsmPrinter.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 254cc563c9c..cd5c1a3d657 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -67,7 +67,7 @@ namespace {
void printHex32(unsigned int Value);
void emitFunctionStart(MachineFunction &MF);
- void emitFunctionEnd();
+ void emitFunctionEnd(MachineFunction &MF);
void emitFrameDirective(MachineFunction &MF);
void emitMaskDirective(MachineFunction &MF);
void emitFMaskDirective(MachineFunction &MF);
@@ -209,10 +209,12 @@ getSavedRegsBitmask(bool isFloat, MachineFunction &MF)
Bitmask |= (1 << MipsRegisterInfo::getRegisterNumbering(CSI[i].getReg()));
if (RI.hasFP(MF))
- Bitmask |= (1 << MipsRegisterInfo::getRegisterNumbering(RI.getFrameRegister(MF)));
+ Bitmask |= (1 << MipsRegisterInfo::
+ getRegisterNumbering(RI.getFrameRegister(MF)));
if (MF.getFrameInfo()->hasCalls())
- Bitmask |= (1 << MipsRegisterInfo::getRegisterNumbering(RI.getRARegister()));
+ Bitmask |= (1 << MipsRegisterInfo::
+ getRegisterNumbering(RI.getRARegister()));
return Bitmask;
}
@@ -247,16 +249,24 @@ emitFunctionStart(MachineFunction &MF)
emitFrameDirective(MF);
emitMaskDirective(MF);
emitFMaskDirective(MF);
- emitSetDirective(NOREORDER);
- emitSetDirective(NOMACRO);
+
+ if (MF.getTarget().getRelocationModel() == Reloc::Static) {
+ emitSetDirective(NOREORDER);
+ emitSetDirective(NOMACRO);
+ }
+
O << "\n";
}
/// Emit the directives used by GAS on the end of functions
void MipsAsmPrinter::
-emitFunctionEnd() {
- emitSetDirective(MACRO);
- emitSetDirective(REORDER);
+emitFunctionEnd(MachineFunction &MF)
+{
+ if (MF.getTarget().getRelocationModel() == Reloc::Static) {
+ emitSetDirective(MACRO);
+ emitSetDirective(REORDER);
+ }
+
O << "\t.end\t" << CurrentFnName << "\n";
}
@@ -298,7 +308,7 @@ runOnMachineFunction(MachineFunction &MF)
}
// Emit function end directives
- emitFunctionEnd();
+ emitFunctionEnd(MF);
// We didn't modify anything.
return false;
OpenPOWER on IntegriCloud