diff options
author | Owen Anderson <resistor@mac.com> | 2008-01-07 01:35:02 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-01-07 01:35:02 +0000 |
commit | 43dbe05279b753aabda571d9c83eaeb36987001a (patch) | |
tree | b767b17e91b91d3bb7f897f507175fd60ebadb6b /lib/Target/Alpha/AlphaInstrInfo.cpp | |
parent | 93f96d00bf10299246ea726956ce84dcb4b9a59e (diff) | |
download | llvm-43dbe05279b753aabda571d9c83eaeb36987001a.tar.gz llvm-43dbe05279b753aabda571d9c83eaeb36987001a.tar.bz2 llvm-43dbe05279b753aabda571d9c83eaeb36987001a.tar.xz |
Move even more functionality from MRegisterInfo into TargetInstrInfo.
Some day I'll get it all moved over...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha/AlphaInstrInfo.cpp')
-rw-r--r-- | lib/Target/Alpha/AlphaInstrInfo.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/Target/Alpha/AlphaInstrInfo.cpp b/lib/Target/Alpha/AlphaInstrInfo.cpp index 7c89ec8ced..abd7e33a69 100644 --- a/lib/Target/Alpha/AlphaInstrInfo.cpp +++ b/lib/Target/Alpha/AlphaInstrInfo.cpp @@ -250,6 +250,43 @@ void AlphaInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, NewMIs.push_back(MIB); } +MachineInstr *AlphaInstrInfo::foldMemoryOperand(MachineInstr *MI, + SmallVectorImpl<unsigned> &Ops, + int FrameIndex) const { + if (Ops.size() != 1) return NULL; + + // Make sure this is a reg-reg copy. + unsigned Opc = MI->getOpcode(); + + MachineInstr *NewMI = NULL; + switch(Opc) { + default: + break; + case Alpha::BISr: + case Alpha::CPYSS: + case Alpha::CPYST: + if (MI->getOperand(1).getReg() == MI->getOperand(2).getReg()) { + if (Ops[0] == 0) { // move -> store + unsigned InReg = MI->getOperand(1).getReg(); + Opc = (Opc == Alpha::BISr) ? Alpha::STQ : + ((Opc == Alpha::CPYSS) ? Alpha::STS : Alpha::STT); + NewMI = BuildMI(get(Opc)).addReg(InReg).addFrameIndex(FrameIndex) + .addReg(Alpha::F31); + } else { // load -> move + unsigned OutReg = MI->getOperand(0).getReg(); + Opc = (Opc == Alpha::BISr) ? Alpha::LDQ : + ((Opc == Alpha::CPYSS) ? Alpha::LDS : Alpha::LDT); + NewMI = BuildMI(get(Opc), OutReg).addFrameIndex(FrameIndex) + .addReg(Alpha::F31); + } + } + break; + } + if (NewMI) + NewMI->copyKillDeadInfo(MI); + return 0; +} + static unsigned AlphaRevCondCode(unsigned Opcode) { switch (Opcode) { case Alpha::BEQ: return Alpha::BNE; |