mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Remove redundant match for frame index from imm8 addrmode, it is handled by the imm12 addrmode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77632 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8f65253236
commit
07337c0fcf
@ -630,31 +630,21 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue Op, SDValue N,
|
|||||||
bool ARMDAGToDAGISel::SelectT2AddrModeImm8(SDValue Op, SDValue N,
|
bool ARMDAGToDAGISel::SelectT2AddrModeImm8(SDValue Op, SDValue N,
|
||||||
SDValue &Base, SDValue &OffImm) {
|
SDValue &Base, SDValue &OffImm) {
|
||||||
// Match simple R - imm8 operands.
|
// Match simple R - imm8 operands.
|
||||||
|
if ((N.getOpcode() == ISD::ADD) || (N.getOpcode() == ISD::SUB)) {
|
||||||
|
if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
|
||||||
|
int RHSC = (int)RHS->getSExtValue();
|
||||||
|
if (N.getOpcode() == ISD::SUB)
|
||||||
|
RHSC = -RHSC;
|
||||||
|
|
||||||
// Match frame index...
|
if ((RHSC >= -255) && (RHSC <= 0)) { // 8 bits (always negative)
|
||||||
if ((N.getOpcode() != ISD::ADD) && (N.getOpcode() != ISD::SUB)) {
|
Base = N.getOperand(0);
|
||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());
|
||||||
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
}
|
||||||
return true;
|
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
||||||
}
|
return true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
|
|
||||||
int RHSC = (int)RHS->getSExtValue();
|
|
||||||
if (N.getOpcode() == ISD::SUB)
|
|
||||||
RHSC = -RHSC;
|
|
||||||
|
|
||||||
if ((RHSC >= -255) && (RHSC <= 0)) { // 8 bits (always negative)
|
|
||||||
Base = N.getOperand(0);
|
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());
|
|
||||||
}
|
}
|
||||||
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user