[CodeGen] Add getMachineMemOperand + MachineMemOperand::Flags allocator helper wrapper. NFCI.

Pre-commit for D62726 on behalf of @luke (Luke Lau)

llvm-svn: 363257
This commit is contained in:
Simon Pilgrim 2019-06-13 12:58:55 +00:00
parent bf2b2f08b0
commit 6b56ad164c
3 changed files with 17 additions and 8 deletions
llvm
include/llvm/CodeGen
lib

View File

@ -740,6 +740,12 @@ public:
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
const AAMDNodes &AAInfo);
/// Allocate a new MachineMemOperand by copying an existing one,
/// replacing the flags. MachineMemOperands are owned
/// by the MachineFunction and need not be explicitly deallocated.
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
MachineMemOperand::Flags Flags);
using OperandCapacity = ArrayRecycler<MachineOperand>::Capacity;
/// Allocate an array of MachineOperands. This is only intended for use by

View File

@ -430,6 +430,15 @@ MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
MMO->getOrdering(), MMO->getFailureOrdering());
}
MachineMemOperand *
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
MachineMemOperand::Flags Flags) {
return new (Allocator) MachineMemOperand(
MMO->getPointerInfo(), Flags, MMO->getSize(), MMO->getBaseAlignment(),
MMO->getAAInfo(), MMO->getRanges(), MMO->getSyncScopeID(),
MMO->getOrdering(), MMO->getFailureOrdering());
}
MachineInstr::ExtraInfo *
MachineFunction::createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
MCSymbol *PreInstrSymbol,

View File

@ -5149,10 +5149,7 @@ extractLoadMMOs(ArrayRef<MachineMemOperand *> MMOs, MachineFunction &MF) {
} else {
// Clone the MMO and unset the store flag.
LoadMMOs.push_back(MF.getMachineMemOperand(
MMO->getPointerInfo(), MMO->getFlags() & ~MachineMemOperand::MOStore,
MMO->getSize(), MMO->getBaseAlignment(), MMO->getAAInfo(), nullptr,
MMO->getSyncScopeID(), MMO->getOrdering(),
MMO->getFailureOrdering()));
MMO, MMO->getFlags() & ~MachineMemOperand::MOStore));
}
}
@ -5173,10 +5170,7 @@ extractStoreMMOs(ArrayRef<MachineMemOperand *> MMOs, MachineFunction &MF) {
} else {
// Clone the MMO and unset the load flag.
StoreMMOs.push_back(MF.getMachineMemOperand(
MMO->getPointerInfo(), MMO->getFlags() & ~MachineMemOperand::MOLoad,
MMO->getSize(), MMO->getBaseAlignment(), MMO->getAAInfo(), nullptr,
MMO->getSyncScopeID(), MMO->getOrdering(),
MMO->getFailureOrdering()));
MMO, MMO->getFlags() & ~MachineMemOperand::MOLoad));
}
}