diff options
author | Reed Kotler <rkotler@mips.com> | 2013-02-16 09:47:57 +0000 |
---|---|---|
committer | Reed Kotler <rkotler@mips.com> | 2013-02-16 09:47:57 +0000 |
commit | 6a0da011e42e553d497fce2059f43401e854b99d (patch) | |
tree | ad03e0bc7470b81eeb1f06abf87ac2b8e3078201 | |
parent | 6d3a278aabb0007e75a6c36c904538950e4b0093 (diff) |
Use a different scheme to chose 16/32 variants. This scheme is more
consistent with how BuildMI works. No new tests needed. All should work
the same as before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175342 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/Mips/Mips16InstrInfo.cpp | 14 | ||||
-rw-r--r-- | lib/Target/Mips/Mips16InstrInfo.h | 4 |
2 files changed, 7 insertions, 11 deletions
diff --git a/lib/Target/Mips/Mips16InstrInfo.cpp b/lib/Target/Mips/Mips16InstrInfo.cpp index 5a91519fd8..19e00df996 100644 --- a/lib/Target/Mips/Mips16InstrInfo.cpp +++ b/lib/Target/Mips/Mips16InstrInfo.cpp @@ -184,7 +184,7 @@ void Mips16InstrInfo::makeFrame(unsigned SP, int64_t FrameSize, int64_t Remainder = FrameSize - Base; BuildMI(MBB, I, DL, get(Mips::SaveRaF16)). addImm(Base); if (isInt<16>(-Remainder)) - BuildAddiuSpImm(MBB, I, DL, -Remainder); + BuildMI(MBB, I, DL, AddiuSpImm(-Remainder)).addImm(-Remainder); else adjustStackPtrBig(SP, -Remainder, MBB, I, Mips::V0, Mips::V1); } @@ -225,7 +225,7 @@ void Mips16InstrInfo::restoreFrame(unsigned SP, int64_t FrameSize, // returns largest possible n bit unsigned integer int64_t Remainder = FrameSize - Base; if (isInt<16>(Remainder)) - BuildAddiuSpImm(MBB, I, DL, Remainder); + BuildMI(MBB, I, DL, AddiuSpImm(Remainder)).addImm(Remainder); else adjustStackPtrBig(SP, Remainder, MBB, I, Mips::A0, Mips::A1); BuildMI(MBB, I, DL, get(Mips::RestoreRaF16)). addImm(Base); @@ -299,7 +299,7 @@ void Mips16InstrInfo::adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock::iterator I) const { DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc(); if (isInt<16>(Amount)) // need to change to addiu sp, ....and isInt<16> - BuildAddiuSpImm(MBB, I, DL, Amount); + BuildMI(MBB, I, DL, AddiuSpImm(Amount)).addImm(Amount); else adjustStackPtrBigUnrestricted(SP, Amount, MBB, I); } @@ -400,13 +400,11 @@ void Mips16InstrInfo::ExpandRetRA16(MachineBasicBlock &MBB, BuildMI(MBB, I, I->getDebugLoc(), get(Opc)); } -void Mips16InstrInfo::BuildAddiuSpImm( - MachineBasicBlock &MBB, - MachineBasicBlock::iterator II, DebugLoc DL, int64_t Imm) const { +const MCInstrDesc &Mips16InstrInfo::AddiuSpImm(int64_t Imm) const { if (validSpImm8(Imm)) - BuildMI(MBB, II, DL, get(Mips::AddiuSpImm16)).addImm(Imm); + return get(Mips::AddiuSpImm16); else - BuildMI(MBB, II, DL, get(Mips::AddiuSpImmX16)).addImm(Imm); + return get(Mips::AddiuSpImmX16); } const MipsInstrInfo *llvm::createMips16InstrInfo(MipsTargetMachine &TM) { diff --git a/lib/Target/Mips/Mips16InstrInfo.h b/lib/Target/Mips/Mips16InstrInfo.h index f8570bdc27..0e8e87ab2a 100644 --- a/lib/Target/Mips/Mips16InstrInfo.h +++ b/lib/Target/Mips/Mips16InstrInfo.h @@ -93,10 +93,8 @@ public: // // build the proper one based on the Imm field // - void BuildAddiuSpImm(MachineBasicBlock &MBB, - MachineBasicBlock::iterator II, DebugLoc DL, - int64_t Imm) const; + const MCInstrDesc& AddiuSpImm(int64_t Imm) const; private: virtual unsigned GetAnalyzableBrOpc(unsigned Opc) const; |