diff options
author | Reed Kotler <rkotler@mips.com> | 2013-02-16 19:04:29 +0000 |
---|---|---|
committer | Reed Kotler <rkotler@mips.com> | 2013-02-16 19:04:29 +0000 |
commit | 2de893210b0d4178edb4e3f2a965d57e97410341 (patch) | |
tree | 37c8f9e3122191d43ff7d6f8993b6a63397a7b2c | |
parent | eb4774a972af4bdd36d8795625c8c5d96ca507d1 (diff) | |
download | external_llvm-2de893210b0d4178edb4e3f2a965d57e97410341.zip external_llvm-2de893210b0d4178edb4e3f2a965d57e97410341.tar.gz external_llvm-2de893210b0d4178edb4e3f2a965d57e97410341.tar.bz2 |
One more try to make this look nice. I have lots of pseudo lowering
as well as 16/32 bit variants to do and so I want this to look nice
when I do it. I've been experimenting with this. No new test cases
are needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175369 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/Mips/Mips16InstrInfo.cpp | 13 | ||||
-rw-r--r-- | lib/Target/Mips/Mips16InstrInfo.h | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/Target/Mips/Mips16InstrInfo.cpp b/lib/Target/Mips/Mips16InstrInfo.cpp index 19e00df..0612335 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)) - BuildMI(MBB, I, DL, AddiuSpImm(-Remainder)).addImm(-Remainder); + BuildAddiuSpImm(MBB, I, -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)) - BuildMI(MBB, I, DL, AddiuSpImm(Remainder)).addImm(Remainder); + BuildAddiuSpImm(MBB, I, Remainder); else adjustStackPtrBig(SP, Remainder, MBB, I, Mips::A0, Mips::A1); BuildMI(MBB, I, DL, get(Mips::RestoreRaF16)). addImm(Base); @@ -297,9 +297,8 @@ void Mips16InstrInfo::adjustStackPtrBigUnrestricted(unsigned SP, int64_t Amount, void Mips16InstrInfo::adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB, 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> - BuildMI(MBB, I, DL, AddiuSpImm(Amount)).addImm(Amount); + BuildAddiuSpImm(MBB, I, Amount); else adjustStackPtrBigUnrestricted(SP, Amount, MBB, I); } @@ -407,6 +406,12 @@ const MCInstrDesc &Mips16InstrInfo::AddiuSpImm(int64_t Imm) const { return get(Mips::AddiuSpImmX16); } +void Mips16InstrInfo::BuildAddiuSpImm + (MachineBasicBlock &MBB, MachineBasicBlock::iterator I, int64_t Imm) const { + DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc(); + BuildMI(MBB, I, DL, AddiuSpImm(Imm)).addImm(Imm); +} + const MipsInstrInfo *llvm::createMips16InstrInfo(MipsTargetMachine &TM) { return new Mips16InstrInfo(TM); } diff --git a/lib/Target/Mips/Mips16InstrInfo.h b/lib/Target/Mips/Mips16InstrInfo.h index 0e8e87a..d197e7c 100644 --- a/lib/Target/Mips/Mips16InstrInfo.h +++ b/lib/Target/Mips/Mips16InstrInfo.h @@ -96,6 +96,9 @@ public: const MCInstrDesc& AddiuSpImm(int64_t Imm) const; + void BuildAddiuSpImm + (MachineBasicBlock &MBB, MachineBasicBlock::iterator I, int64_t Imm) const; + private: virtual unsigned GetAnalyzableBrOpc(unsigned Opc) const; |