diff options
author | David Greene <greened@obbligato.org> | 2009-11-13 00:29:53 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2009-11-13 00:29:53 +0000 |
commit | dda3978d7877d2d60390833c73ed24857295e89c (patch) | |
tree | 3f13bb5866eba31734f415e5cab0abfa653ccbf5 /lib/Target/X86/X86InstrInfo.cpp | |
parent | 98538b4bea8653d47ac4cc1b6f750a245b0a5e45 (diff) | |
download | external_llvm-dda3978d7877d2d60390833c73ed24857295e89c.zip external_llvm-dda3978d7877d2d60390833c73ed24857295e89c.tar.gz external_llvm-dda3978d7877d2d60390833c73ed24857295e89c.tar.bz2 |
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
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 77 |
1 files changed, 53 insertions, 24 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 83d1db5..ac5e7da 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -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; } |