diff options
author | Reed Kotler <rkotler@mips.com> | 2013-12-08 16:51:52 +0000 |
---|---|---|
committer | Reed Kotler <rkotler@mips.com> | 2013-12-08 16:51:52 +0000 |
commit | c9ea75ee5bcf6a9ced5852b7662f1400a9be8d16 (patch) | |
tree | c321731e3293b1bcde6922fec6bb3c9d04d9353d /lib/Target/Mips/InstPrinter | |
parent | 7c4342e90b929a1301261147ea23e60e1ea02f6c (diff) | |
download | llvm-c9ea75ee5bcf6a9ced5852b7662f1400a9be8d16.tar.gz llvm-c9ea75ee5bcf6a9ced5852b7662f1400a9be8d16.tar.bz2 llvm-c9ea75ee5bcf6a9ced5852b7662f1400a9be8d16.tar.xz |
Cleaning up of prologue/epilogue code for Mips16. First step
here is to make save/restore into variable number of argument instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/InstPrinter')
-rw-r--r-- | lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp | 24 | ||||
-rw-r--r-- | lib/Target/Mips/InstPrinter/MipsInstPrinter.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp b/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp index 7884589899..c23fc6a6ed 100644 --- a/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp +++ b/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp @@ -83,6 +83,19 @@ void MipsInstPrinter::printInst(const MCInst *MI, raw_ostream &O, case Mips::RDHWR64: O << "\t.set\tpush\n"; O << "\t.set\tmips32r2\n"; + break; + case Mips::Save16: + case Mips::SaveX16: + O << "\tsave\t"; + printSaveRestore(MI, O); + O << "\n"; + return; + case Mips::Restore16: + case Mips::RestoreX16: + O << "\trestore\t"; + printSaveRestore(MI, O); + O << "\n"; + return; } // Try to print any aliases first. @@ -286,3 +299,14 @@ bool MipsInstPrinter::printAlias(const MCInst &MI, raw_ostream &OS) { default: return false; } } + +void MipsInstPrinter::printSaveRestore(const MCInst *MI, raw_ostream &O) { + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + if (i != 0) O << ", "; + if (MI->getOperand(i).isReg()) + printRegName(O, MI->getOperand(i).getReg()); + else + printUnsignedImm(MI, i, O); + } +} + diff --git a/lib/Target/Mips/InstPrinter/MipsInstPrinter.h b/lib/Target/Mips/InstPrinter/MipsInstPrinter.h index f75ae249c3..2b745f028e 100644 --- a/lib/Target/Mips/InstPrinter/MipsInstPrinter.h +++ b/lib/Target/Mips/InstPrinter/MipsInstPrinter.h @@ -104,6 +104,7 @@ private: bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo0, unsigned OpNo1, raw_ostream &OS); bool printAlias(const MCInst &MI, raw_ostream &OS); + void printSaveRestore(const MCInst *MI, raw_ostream &O); }; } // end namespace llvm |