diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-07-16 14:01:27 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-07-16 14:01:27 +0000 |
commit | 23fb2219effb7cb408069f809d104f85439b8b8c (patch) | |
tree | 634fb414a0eb2ecb68c6ba1dc8f1db8a7861d98d /lib | |
parent | 8eef40431fdff783136569e80c4b3c625ae2f959 (diff) | |
download | external_llvm-23fb2219effb7cb408069f809d104f85439b8b8c.zip external_llvm-23fb2219effb7cb408069f809d104f85439b8b8c.tar.gz external_llvm-23fb2219effb7cb408069f809d104f85439b8b8c.tar.bz2 |
Provide hooks for spilling / restoring stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/SystemZ/SystemZInstrInfo.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index 90e77ff..e3e5e0d 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "SystemZ.h" +#include "SystemZInstrBuilder.h" #include "SystemZInstrInfo.h" #include "SystemZMachineFunctionInfo.h" #include "SystemZTargetMachine.h" @@ -55,14 +56,41 @@ void SystemZInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIdx, const TargetRegisterClass *RC) const { - assert(0 && "Cannot store this register to stack slot!"); + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (MI != MBB.end()) DL = MI->getDebugLoc(); + + unsigned Opc = 0; + if (RC == &SystemZ::GR32RegClass || + RC == &SystemZ::ADDR32RegClass) + Opc = SystemZ::MOV32mr; + else if (RC == &SystemZ::GR64RegClass || + RC == &SystemZ::ADDR64RegClass) { + Opc = SystemZ::MOV64mr; + } else + assert(0 && "Unsupported regclass to store"); + + addFrameReference(BuildMI(MBB, MI, DL, get(Opc)), FrameIdx) + .addReg(SrcReg, getKillRegState(isKill)); } void SystemZInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIdx, const TargetRegisterClass *RC) const{ - assert(0 && "Cannot store this register to stack slot!"); + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (MI != MBB.end()) DL = MI->getDebugLoc(); + + unsigned Opc = 0; + if (RC == &SystemZ::GR32RegClass || + RC == &SystemZ::ADDR32RegClass) + Opc = SystemZ::MOV32rm; + else if (RC == &SystemZ::GR64RegClass || + RC == &SystemZ::ADDR64RegClass) { + Opc = SystemZ::MOV64rm; + } else + assert(0 && "Unsupported regclass to store"); + + addFrameReference(BuildMI(MBB, MI, DL, get(Opc), DestReg), FrameIdx); } bool SystemZInstrInfo::copyRegToReg(MachineBasicBlock &MBB, |