mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fold the add (ptr, offset) into ptr[offset] only if the offset is small enough. movwi and moviw allow value of 5-bits only (i.e. 32).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8dfbe6c853
commit
ae99227ef9
@ -702,10 +702,12 @@ void PIC16TargetLowering::LegalizeAddress(SDValue Ptr, SelectionDAG &DAG,
|
||||
if (Ptr.getOpcode() == ISD::ADD) {
|
||||
SDValue OperLeft = Ptr.getOperand(0);
|
||||
SDValue OperRight = Ptr.getOperand(1);
|
||||
if (OperLeft.getOpcode() == ISD::Constant) {
|
||||
if ((OperLeft.getOpcode() == ISD::Constant) &&
|
||||
(dyn_cast<ConstantSDNode>(OperLeft)->getZExtValue() < 32 )) {
|
||||
Offset = dyn_cast<ConstantSDNode>(OperLeft)->getZExtValue();
|
||||
Ptr = OperRight;
|
||||
} else if (OperRight.getOpcode() == ISD::Constant) {
|
||||
} else if ((OperRight.getOpcode() == ISD::Constant) &&
|
||||
(dyn_cast<ConstantSDNode>(OperRight)->getZExtValue() < 32 )){
|
||||
Offset = dyn_cast<ConstantSDNode>(OperRight)->getZExtValue();
|
||||
Ptr = OperLeft;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user