mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Hoist hasLoadFromStackSlot and hasStoreToStackSlot.
These the methods are target-independent since they simply scan the memory operands. They can live in TargetInstrInfoImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137063 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -160,6 +160,42 @@ bool TargetInstrInfoImpl::PredicateInstruction(MachineInstr *MI,
|
||||
return MadeChange;
|
||||
}
|
||||
|
||||
bool TargetInstrInfoImpl::hasLoadFromStackSlot(const MachineInstr *MI,
|
||||
const MachineMemOperand *&MMO,
|
||||
int &FrameIndex) const {
|
||||
for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
|
||||
oe = MI->memoperands_end();
|
||||
o != oe;
|
||||
++o) {
|
||||
if ((*o)->isLoad() && (*o)->getValue())
|
||||
if (const FixedStackPseudoSourceValue *Value =
|
||||
dyn_cast<const FixedStackPseudoSourceValue>((*o)->getValue())) {
|
||||
FrameIndex = Value->getFrameIndex();
|
||||
MMO = *o;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TargetInstrInfoImpl::hasStoreToStackSlot(const MachineInstr *MI,
|
||||
const MachineMemOperand *&MMO,
|
||||
int &FrameIndex) const {
|
||||
for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
|
||||
oe = MI->memoperands_end();
|
||||
o != oe;
|
||||
++o) {
|
||||
if ((*o)->isStore() && (*o)->getValue())
|
||||
if (const FixedStackPseudoSourceValue *Value =
|
||||
dyn_cast<const FixedStackPseudoSourceValue>((*o)->getValue())) {
|
||||
FrameIndex = Value->getFrameIndex();
|
||||
MMO = *o;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TargetInstrInfoImpl::reMaterialize(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I,
|
||||
unsigned DestReg,
|
||||
|
Reference in New Issue
Block a user