mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Detect FI|cst pattern in MipsDAGToDAGISel::SelectAddr. Patch by Sasa Stankovic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -135,24 +135,25 @@ SelectAddr(SDValue Addr, SDValue &Offset, SDValue &Base) {
|
||||
}
|
||||
}
|
||||
|
||||
// Addresses of the form FI+const or FI|const
|
||||
if (CurDAG->isBaseWithConstantOffset(Addr)) {
|
||||
ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1));
|
||||
if (isInt<16>(CN->getSExtValue())) {
|
||||
|
||||
// If the first operand is a FI, get the TargetFI Node
|
||||
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>
|
||||
(Addr.getOperand(0)))
|
||||
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
|
||||
else
|
||||
Base = Addr.getOperand(0);
|
||||
|
||||
Offset = CurDAG->getTargetConstant(CN->getZExtValue(), MVT::i32);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Operand is a result from an ADD.
|
||||
if (Addr.getOpcode() == ISD::ADD) {
|
||||
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
|
||||
if (isInt<16>(CN->getSExtValue())) {
|
||||
|
||||
// If the first operand is a FI, get the TargetFI Node
|
||||
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>
|
||||
(Addr.getOperand(0))) {
|
||||
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
|
||||
} else {
|
||||
Base = Addr.getOperand(0);
|
||||
}
|
||||
|
||||
Offset = CurDAG->getTargetConstant(CN->getZExtValue(), MVT::i32);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// When loading from constant pools, load the lower address part in
|
||||
// the instruction itself. Example, instead of:
|
||||
// lui $2, %hi($CPI1_0)
|
||||
|
Reference in New Issue
Block a user