diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-10-15 08:42:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-10-15 08:42:59 +0000 |
commit | f8f993b675568ea6380ad141371c67679a1b9ac4 (patch) | |
tree | 8db20f611c5d78ee1d0a2fd46cf756938f6376f4 /lib | |
parent | ecfa16cc2134ff7ed7f9fc4f669080f61aa41c32 (diff) | |
download | external_llvm-f8f993b675568ea6380ad141371c67679a1b9ac4.zip external_llvm-f8f993b675568ea6380ad141371c67679a1b9ac4.tar.gz external_llvm-f8f993b675568ea6380ad141371c67679a1b9ac4.tar.bz2 |
[SystemZ] Use A(G)SI when spilling the target of a constant addition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/SystemZ/SystemZInstrInfo.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index 38d0a32..83e023f 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -747,8 +747,21 @@ SystemZInstrInfo::foldMemoryOperandImpl(MachineFunction &MF, int FrameIndex) const { const MachineFrameInfo *MFI = MF.getFrameInfo(); unsigned Size = MFI->getObjectSize(FrameIndex); + unsigned Opcode = MI->getOpcode(); + + if (Ops.size() == 2 && Ops[0] == 0 && Ops[1] == 1) { + if ((Opcode == SystemZ::LA || Opcode == SystemZ::LAY) && + isInt<8>(MI->getOperand(2).getImm()) && + !MI->getOperand(3).getReg()) { + // LA(Y) %reg, CONST(%reg) -> AGSI %mem, CONST + return BuildMI(MF, MI->getDebugLoc(), get(SystemZ::AGSI)) + .addFrameIndex(FrameIndex).addImm(0) + .addImm(MI->getOperand(2).getImm()); + } + return 0; + } - // Eary exit for cases we don't care about + // All other cases require a single operand. if (Ops.size() != 1) return 0; @@ -757,7 +770,16 @@ SystemZInstrInfo::foldMemoryOperandImpl(MachineFunction &MF, .getRegClass(MI->getOperand(OpNum).getReg())->getSize() && "Invalid size combination"); - unsigned Opcode = MI->getOpcode(); + if ((Opcode == SystemZ::AHI || Opcode == SystemZ::AGHI) && + OpNum == 0 && + isInt<8>(MI->getOperand(2).getImm())) { + // A(G)HI %reg, CONST -> A(G)SI %mem, CONST + Opcode = (Opcode == SystemZ::AHI ? SystemZ::ASI : SystemZ::AGSI); + return BuildMI(MF, MI->getDebugLoc(), get(Opcode)) + .addFrameIndex(FrameIndex).addImm(0) + .addImm(MI->getOperand(2).getImm()); + } + if (Opcode == SystemZ::LGDR || Opcode == SystemZ::LDGR) { bool Op0IsGPR = (Opcode == SystemZ::LGDR); bool Op1IsGPR = (Opcode == SystemZ::LDGR); |