diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-05-12 00:48:43 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-05-12 00:48:43 +0000 |
commit | 4147e4d054b62eb2ea8259db0385791ec23c460b (patch) | |
tree | 3eeb3aec4ec14367dee4cc26699a21243ced6e7f /lib/Target/Mips | |
parent | 774394c68abc88a0d49f207abc1d4da9bd0675b8 (diff) | |
download | external_llvm-4147e4d054b62eb2ea8259db0385791ec23c460b.zip external_llvm-4147e4d054b62eb2ea8259db0385791ec23c460b.tar.gz external_llvm-4147e4d054b62eb2ea8259db0385791ec23c460b.tar.bz2 |
Make the following changes in MipsAsmPrinter.cpp:
- Remove code which lowers pseudo SETGP01.
- Fix LowerSETGP01. The first two of the three instructions that are emitted to
initialize the global pointer register now use register $2.
- Stop emitting .cpload directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r-- | lib/Target/Mips/MipsAsmPrinter.cpp | 25 | ||||
-rw-r--r-- | lib/Target/Mips/MipsMCInstLower.cpp | 15 | ||||
-rw-r--r-- | lib/Target/Mips/MipsMCInstLower.h | 2 |
3 files changed, 11 insertions, 31 deletions
diff --git a/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp index 65dd6e9..e62da35 100644 --- a/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/MipsAsmPrinter.cpp @@ -134,15 +134,6 @@ void MipsAsmPrinter::EmitInstruction(const MachineInstr *MI) { break; } - case Mips::SETGP01: { - MCInstLowering.LowerSETGP01(MI, MCInsts); - - for (SmallVector<MCInst, 4>::iterator I = MCInsts.begin(); - I != MCInsts.end(); ++I) - OutStreamer.EmitInstruction(*I); - - return; - } default: break; } @@ -295,10 +286,6 @@ void MipsAsmPrinter::EmitFunctionBodyStart() { emitFrameDirective(); - bool EmitCPLoad = (MF->getTarget().getRelocationModel() == Reloc::PIC_) && - Subtarget->isABI_O32() && MipsFI->globalBaseRegSet() && - MipsFI->globalBaseRegFixed(); - if (OutStreamer.hasRawTextSupport()) { SmallString<128> Str; raw_svector_ostream OS(Str); @@ -306,17 +293,15 @@ void MipsAsmPrinter::EmitFunctionBodyStart() { OutStreamer.EmitRawText(OS.str()); OutStreamer.EmitRawText(StringRef("\t.set\tnoreorder")); - - // Emit .cpload directive if needed. - if (EmitCPLoad) - OutStreamer.EmitRawText(StringRef("\t.cpload\t$25")); - OutStreamer.EmitRawText(StringRef("\t.set\tnomacro")); if (MipsFI->getEmitNOAT()) OutStreamer.EmitRawText(StringRef("\t.set\tnoat")); - } else if (EmitCPLoad) { + } + + if ((MF->getTarget().getRelocationModel() == Reloc::PIC_) && + Subtarget->isABI_O32() && MipsFI->globalBaseRegSet()) { SmallVector<MCInst, 4> MCInsts; - MCInstLowering.LowerCPLOAD(MCInsts); + MCInstLowering.LowerSETGP01(MCInsts); for (SmallVector<MCInst, 4>::iterator I = MCInsts.begin(); I != MCInsts.end(); ++I) OutStreamer.EmitInstruction(*I); diff --git a/lib/Target/Mips/MipsMCInstLower.cpp b/lib/Target/Mips/MipsMCInstLower.cpp index 1597b93..8bdcfd9 100644 --- a/lib/Target/Mips/MipsMCInstLower.cpp +++ b/lib/Target/Mips/MipsMCInstLower.cpp @@ -317,16 +317,11 @@ void MipsMCInstLower::LowerUnalignedLoadStore(const MachineInstr *MI, if (!TwoInstructions) MCInsts.push_back(Instr3); } -// Convert -// "setgp01 $reg" -// to -// "lui $reg, %hi(_gp_disp)" -// "addiu $reg, $reg, %lo(_gp_disp)" -void MipsMCInstLower::LowerSETGP01(const MachineInstr *MI, - SmallVector<MCInst, 4>& MCInsts) { - const MachineOperand &MO = MI->getOperand(0); - assert(MO.isReg()); - MCOperand RegOpnd = MCOperand::CreateReg(MO.getReg()); +// Create the following two instructions: +// "lui $2, %hi(_gp_disp)" +// "addiu $2, $2, %lo(_gp_disp)" +void MipsMCInstLower::LowerSETGP01(SmallVector<MCInst, 4>& MCInsts) { + MCOperand RegOpnd = MCOperand::CreateReg(Mips::V0); StringRef SymName("_gp_disp"); const MCSymbol *Sym = Ctx->GetOrCreateSymbol(SymName); const MCSymbolRefExpr *MCSym; diff --git a/lib/Target/Mips/MipsMCInstLower.h b/lib/Target/Mips/MipsMCInstLower.h index c1d007d..53db3ad 100644 --- a/lib/Target/Mips/MipsMCInstLower.h +++ b/lib/Target/Mips/MipsMCInstLower.h @@ -37,7 +37,7 @@ public: void LowerCPRESTORE(int64_t Offset, SmallVector<MCInst, 4>& MCInsts); void LowerUnalignedLoadStore(const MachineInstr *MI, SmallVector<MCInst, 4>& MCInsts); - void LowerSETGP01(const MachineInstr *MI, SmallVector<MCInst, 4>& MCInsts); + void LowerSETGP01(SmallVector<MCInst, 4>& MCInsts); private: MCOperand LowerSymbolOperand(const MachineOperand &MO, MachineOperandType MOTy, unsigned Offset) const; |