mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
Fix a bootstrap failure.
Provide special isLoadFromStackSlotPostFE and isStoreToStackSlotPostFE interfaces to explicitly request checking for post-frame ptr elimination operands. This uses a heuristic so it isn't reliable for correctness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
98538b4bea
commit
dda3978d78
@ -171,6 +171,14 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// isLoadFromStackSlotPostFE - Check for post-frame ptr elimination
|
||||
/// stack locations as well. This uses a heuristic so it isn't
|
||||
/// reliable for correctness.
|
||||
virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// hasLoadFromStackSlot - If the specified machine instruction has
|
||||
/// a load from a stack slot, return true along with the FrameIndex
|
||||
/// of the loaded stack slot. If not, return false. Unlike
|
||||
@ -192,6 +200,14 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
|
||||
/// stack locations as well. This uses a heuristic so it isn't
|
||||
/// reliable for correctness.
|
||||
virtual unsigned isStoreToStackSlotPostFE(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// hasStoreToStackSlot - If the specified machine instruction has a
|
||||
/// store to a stack slot, return true along with the FrameIndex of
|
||||
/// the loaded stack slot. If not, return false. Unlike
|
||||
|
@ -726,9 +726,8 @@ bool X86InstrInfo::isFrameOperand(const MachineInstr *MI, unsigned int Op,
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned X86InstrInfo::isLoadFromStackSlot(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
switch (MI->getOpcode()) {
|
||||
static bool isFrameLoadOpcode(int Opcode) {
|
||||
switch (Opcode) {
|
||||
default: break;
|
||||
case X86::MOV8rm:
|
||||
case X86::MOV16rm:
|
||||
@ -742,12 +741,49 @@ unsigned X86InstrInfo::isLoadFromStackSlot(const MachineInstr *MI,
|
||||
case X86::MOVDQArm:
|
||||
case X86::MMX_MOVD64rm:
|
||||
case X86::MMX_MOVQ64rm:
|
||||
if (isFrameOperand(MI, 1, FrameIndex)) {
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isFrameStoreOpcode(int Opcode) {
|
||||
switch (Opcode) {
|
||||
default: break;
|
||||
case X86::MOV8mr:
|
||||
case X86::MOV16mr:
|
||||
case X86::MOV32mr:
|
||||
case X86::MOV64mr:
|
||||
case X86::ST_FpP64m:
|
||||
case X86::MOVSSmr:
|
||||
case X86::MOVSDmr:
|
||||
case X86::MOVAPSmr:
|
||||
case X86::MOVAPDmr:
|
||||
case X86::MOVDQAmr:
|
||||
case X86::MMX_MOVD64mr:
|
||||
case X86::MMX_MOVQ64mr:
|
||||
case X86::MMX_MOVNTQmr:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned X86InstrInfo::isLoadFromStackSlot(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
if (isFrameLoadOpcode(MI->getOpcode()))
|
||||
if (isFrameOperand(MI, 1, FrameIndex))
|
||||
return MI->getOperand(0).getReg();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned X86InstrInfo::isLoadFromStackSlotPostFE(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
if (isFrameLoadOpcode(MI->getOpcode())) {
|
||||
unsigned Reg;
|
||||
if ((Reg = isLoadFromStackSlot(MI, FrameIndex)))
|
||||
return Reg;
|
||||
// Check for post-frame index elimination operations
|
||||
return hasLoadFromStackSlot(MI, FrameIndex);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -770,27 +806,20 @@ bool X86InstrInfo::hasLoadFromStackSlot(const MachineInstr *MI,
|
||||
|
||||
unsigned X86InstrInfo::isStoreToStackSlot(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
switch (MI->getOpcode()) {
|
||||
default: break;
|
||||
case X86::MOV8mr:
|
||||
case X86::MOV16mr:
|
||||
case X86::MOV32mr:
|
||||
case X86::MOV64mr:
|
||||
case X86::ST_FpP64m:
|
||||
case X86::MOVSSmr:
|
||||
case X86::MOVSDmr:
|
||||
case X86::MOVAPSmr:
|
||||
case X86::MOVAPDmr:
|
||||
case X86::MOVDQAmr:
|
||||
case X86::MMX_MOVD64mr:
|
||||
case X86::MMX_MOVQ64mr:
|
||||
case X86::MMX_MOVNTQmr:
|
||||
if (isFrameOperand(MI, 0, FrameIndex)) {
|
||||
if (isFrameStoreOpcode(MI->getOpcode()))
|
||||
if (isFrameOperand(MI, 0, FrameIndex))
|
||||
return MI->getOperand(X86AddrNumOperands).getReg();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned X86InstrInfo::isStoreToStackSlotPostFE(const MachineInstr *MI,
|
||||
int &FrameIndex) const {
|
||||
if (isFrameStoreOpcode(MI->getOpcode())) {
|
||||
unsigned Reg;
|
||||
if ((Reg = isStoreToStackSlot(MI, FrameIndex)))
|
||||
return Reg;
|
||||
// Check for post-frame index elimination operations
|
||||
return hasStoreToStackSlot(MI, FrameIndex);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -449,6 +449,11 @@ public:
|
||||
unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
|
||||
|
||||
unsigned isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const;
|
||||
/// isLoadFromStackSlotPostFE - Check for post-frame ptr elimination
|
||||
/// stack locations as well. This uses a heuristic so it isn't
|
||||
/// reliable for correctness.
|
||||
unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI,
|
||||
int &FrameIndex) const;
|
||||
|
||||
/// hasLoadFromStackSlot - If the specified machine instruction has
|
||||
/// a load from a stack slot, return true along with the FrameIndex
|
||||
@ -459,6 +464,11 @@ public:
|
||||
bool hasLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const;
|
||||
|
||||
unsigned isStoreToStackSlot(const MachineInstr *MI, int &FrameIndex) const;
|
||||
/// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
|
||||
/// stack locations as well. This uses a heuristic so it isn't
|
||||
/// reliable for correctness.
|
||||
unsigned isStoreToStackSlotPostFE(const MachineInstr *MI,
|
||||
int &FrameIndex) const;
|
||||
|
||||
/// hasStoreToStackSlot - If the specified machine instruction has a
|
||||
/// store to a stack slot, return true along with the FrameIndex of
|
||||
|
Loading…
x
Reference in New Issue
Block a user