summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/SystemZInstrInfo.cpp
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-05 14:31:24 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-05 14:31:24 +0000
commite684b96e3c6513f88137afee7c344a4d2d9f0694 (patch)
treec1cef5ad8575257cccc555aa46d3107ca5852b58 /lib/Target/SystemZ/SystemZInstrInfo.cpp
parent5f1c7e5eac78349acfd6be1f9f03ccef3ba51d59 (diff)
downloadllvm-e684b96e3c6513f88137afee7c344a4d2d9f0694.tar.gz
llvm-e684b96e3c6513f88137afee7c344a4d2d9f0694.tar.bz2
llvm-e684b96e3c6513f88137afee7c344a4d2d9f0694.tar.xz
[SystemZ] Remove redundant frame MMOs
This fixes foldMemoryOperandImpl() so that it doesn't create duplicated frame MMOs. I hadn't realized when writing r185434 that it was the caller's responsibility to add these. No behavioural change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/SystemZInstrInfo.cpp')
-rw-r--r--lib/Target/SystemZ/SystemZInstrInfo.cpp28
1 files changed, 4 insertions, 24 deletions
diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp
index 12bcd094f4..81d72e0574 100644
--- a/lib/Target/SystemZ/SystemZInstrInfo.cpp
+++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp
@@ -326,17 +326,6 @@ static bool isSimpleBD12Move(const MachineInstr *MI, unsigned Flag) {
MI->getOperand(3).getReg() == 0);
}
-// Return a MachineMemOperand for FrameIndex with flags MMOFlags.
-// Offset is the byte offset from the start of FrameIndex.
-static MachineMemOperand *getFrameMMO(MachineFunction &MF, int FrameIndex,
- uint64_t &Offset, unsigned MMOFlags) {
- const MachineFrameInfo *MFI = MF.getFrameInfo();
- const Value *V = PseudoSourceValue::getFixedStack(FrameIndex);
- return MF.getMachineMemOperand(MachinePointerInfo(V, Offset), MMOFlags,
- MFI->getObjectSize(FrameIndex),
- MFI->getObjectAlignment(FrameIndex));
-}
-
MachineInstr *
SystemZInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
MachineInstr *MI,
@@ -368,23 +357,17 @@ SystemZInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
if (MMO->getSize() == Size && !MMO->isVolatile()) {
// Handle conversion of loads.
if (isSimpleBD12Move(MI, SystemZII::SimpleBDXLoad)) {
- uint64_t Offset = 0;
- MachineMemOperand *FrameMMO = getFrameMMO(MF, FrameIndex, Offset,
- MachineMemOperand::MOStore);
return BuildMI(MF, MI->getDebugLoc(), get(SystemZ::MVC))
- .addFrameIndex(FrameIndex).addImm(Offset).addImm(Size)
+ .addFrameIndex(FrameIndex).addImm(0).addImm(Size)
.addOperand(MI->getOperand(1)).addImm(MI->getOperand(2).getImm())
- .addMemOperand(FrameMMO).addMemOperand(MMO);
+ .addMemOperand(MMO);
}
// Handle conversion of stores.
if (isSimpleBD12Move(MI, SystemZII::SimpleBDXStore)) {
- uint64_t Offset = 0;
- MachineMemOperand *FrameMMO = getFrameMMO(MF, FrameIndex, Offset,
- MachineMemOperand::MOLoad);
return BuildMI(MF, MI->getDebugLoc(), get(SystemZ::MVC))
.addOperand(MI->getOperand(1)).addImm(MI->getOperand(2).getImm())
- .addImm(Size).addFrameIndex(FrameIndex).addImm(Offset)
- .addMemOperand(MMO).addMemOperand(FrameMMO);
+ .addImm(Size).addFrameIndex(FrameIndex).addImm(0)
+ .addMemOperand(MMO);
}
}
}
@@ -400,15 +383,12 @@ SystemZInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
assert(AccessBytes != 0 && "Size of access should be known");
assert(AccessBytes <= Size && "Access outside the frame index");
uint64_t Offset = Size - AccessBytes;
- MachineMemOperand *FrameMMO = getFrameMMO(MF, FrameIndex, Offset,
- MachineMemOperand::MOLoad);
MachineInstrBuilder MIB = BuildMI(MF, MI->getDebugLoc(), get(MemOpcode));
for (unsigned I = 0; I < OpNum; ++I)
MIB.addOperand(MI->getOperand(I));
MIB.addFrameIndex(FrameIndex).addImm(Offset);
if (MemDesc.TSFlags & SystemZII::HasIndex)
MIB.addReg(0);
- MIB.addMemOperand(FrameMMO);
return MIB;
}
}