mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Fix PR9955 by only attaching load memory operands to load instructions and
similarly for stores. Now "make check" passes with the MachineVerifier forced on with the VerifyCoalescing option! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dc51575a5f
commit
5a4b3d8c8f
@ -2650,11 +2650,45 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
||||
// instructions that access memory and for ComplexPatterns that match
|
||||
// loads.
|
||||
if (EmitNodeInfo & OPFL_MemRefs) {
|
||||
// Only attach load or store memory operands if the generated
|
||||
// instruction may load or store.
|
||||
const TargetInstrDesc &TID = TM.getInstrInfo()->get(TargetOpc);
|
||||
bool mayLoad = TID.mayLoad();
|
||||
bool mayStore = TID.mayStore();
|
||||
|
||||
unsigned NumMemRefs = 0;
|
||||
for (SmallVector<MachineMemOperand*, 2>::const_iterator I =
|
||||
MatchedMemRefs.begin(), E = MatchedMemRefs.end(); I != E; ++I) {
|
||||
if ((*I)->isLoad()) {
|
||||
if (mayLoad)
|
||||
++NumMemRefs;
|
||||
} else if ((*I)->isStore()) {
|
||||
if (mayStore)
|
||||
++NumMemRefs;
|
||||
} else {
|
||||
++NumMemRefs;
|
||||
}
|
||||
}
|
||||
|
||||
MachineSDNode::mmo_iterator MemRefs =
|
||||
MF->allocateMemRefsArray(MatchedMemRefs.size());
|
||||
std::copy(MatchedMemRefs.begin(), MatchedMemRefs.end(), MemRefs);
|
||||
MF->allocateMemRefsArray(NumMemRefs);
|
||||
|
||||
MachineSDNode::mmo_iterator MemRefsPos = MemRefs;
|
||||
for (SmallVector<MachineMemOperand*, 2>::const_iterator I =
|
||||
MatchedMemRefs.begin(), E = MatchedMemRefs.end(); I != E; ++I) {
|
||||
if ((*I)->isLoad()) {
|
||||
if (mayLoad)
|
||||
*MemRefsPos++ = *I;
|
||||
} else if ((*I)->isStore()) {
|
||||
if (mayStore)
|
||||
*MemRefsPos++ = *I;
|
||||
} else {
|
||||
*MemRefsPos++ = *I;
|
||||
}
|
||||
}
|
||||
|
||||
cast<MachineSDNode>(Res)
|
||||
->setMemRefs(MemRefs, MemRefs + MatchedMemRefs.size());
|
||||
->setMemRefs(MemRefs, MemRefs + NumMemRefs);
|
||||
}
|
||||
|
||||
DEBUG(errs() << " "
|
||||
|
Loading…
Reference in New Issue
Block a user