From: Anton Korobeynikov Date: Sun, 3 May 2009 13:10:11 +0000 (+0000) Subject: Match frame indexes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=82e46c2595ff6a684654564a5fd906d20535b156;p=oota-llvm.git Match frame indexes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70736 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp index 7fc707bbae8..a049413975c 100644 --- a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp +++ b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp @@ -75,9 +75,12 @@ FunctionPass *llvm::createMSP430ISelDag(MSP430TargetMachine &TM) { // 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(Addr)) - return false; + // Try to match frame address first. + if (FrameIndexSDNode *FIN = dyn_cast(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 @@ bool MSP430DAGToDAGISel::SelectAddr(SDValue Op, SDValue Addr, 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(Addr.getOperand(0))) - return false; + SDValue N0 = Addr.getOperand(0); + if (FrameIndexSDNode *FIN = dyn_cast(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 @@ bool MSP430DAGToDAGISel::SelectAddr(SDValue Op, SDValue Addr, Base = CurDAG->getTargetGlobalAddress(G->getGlobal(), MVT::i16, G->getOffset()); Disp = CurDAG->getTargetConstant(0, MVT::i16); - return true; } break;