[llvm-commits] [llvm] r70736 - /llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
Anton Korobeynikov
asl at math.spbu.ru
Sun May 3 06:10:11 PDT 2009
Author: asl
Date: Sun May 3 08:10:11 2009
New Revision: 70736
URL: http://llvm.org/viewvc/llvm-project?rev=70736&view=rev
Log:
Match frame indexes
Modified:
llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp?rev=70736&r1=70735&r2=70736&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Sun May 3 08:10:11 2009
@@ -75,9 +75,12 @@
// FIXME: This is pretty dummy routine and needs to be rewritten in the future.
bool MSP430DAGToDAGISel::SelectAddr(SDValue Op, SDValue Addr,
SDValue &Base, SDValue &Disp) {
- // We don't support frame index stuff yet.
- if (isa<FrameIndexSDNode>(Addr))
- return false;
+ // Try to match frame address first.
+ if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
+ Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i16);
+ Disp = CurDAG->getTargetConstant(0, MVT::i16);
+ return true;
+ }
// Operand is a result from ADD with constant operand which fits into i16.
switch (Addr.getOpcode()) {
@@ -86,13 +89,13 @@
uint64_t CVal = CN->getZExtValue();
// Offset should fit into 16 bits.
if (((CVal << 48) >> 48) == CVal) {
- // We don't support frame index stuff yet.
- if (isa<FrameIndexSDNode>(Addr.getOperand(0)))
- return false;
+ SDValue N0 = Addr.getOperand(0);
+ if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(N0))
+ Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i16);
+ else
+ Base = N0;
- Base = Addr.getOperand(0);
Disp = CurDAG->getTargetConstant(CVal, MVT::i16);
-
return true;
}
}
@@ -103,7 +106,6 @@
Base = CurDAG->getTargetGlobalAddress(G->getGlobal(),
MVT::i16, G->getOffset());
Disp = CurDAG->getTargetConstant(0, MVT::i16);
-
return true;
}
break;
More information about the llvm-commits
mailing list