summaryrefslogtreecommitdiff
path: root/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-05-03 13:10:26 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-05-03 13:10:26 +0000
commit40477317f39dccfd5c9c139feabda1becc6bd49c (patch)
tree6a6ad5c86146d1b9f92b9469230fb2ed7b7c7547 /lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
parent82e46c2595ff6a684654564a5fd906d20535b156 (diff)
downloadllvm-40477317f39dccfd5c9c139feabda1becc6bd49c.tar.gz
llvm-40477317f39dccfd5c9c139feabda1becc6bd49c.tar.bz2
llvm-40477317f39dccfd5c9c139feabda1becc6bd49c.tar.xz
Proper handle loading of effective address of stack slot stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430/MSP430ISelDAGToDAG.cpp')
-rw-r--r--lib/Target/MSP430/MSP430ISelDAGToDAG.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
index a049413975..522e170d60 100644
--- a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
+++ b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
@@ -132,6 +132,7 @@ void MSP430DAGToDAGISel::InstructionSelect() {
SDNode *MSP430DAGToDAGISel::Select(SDValue Op) {
SDNode *Node = Op.getNode();
+ DebugLoc dl = Op.getDebugLoc();
// Dump information about the Node being selected
#ifndef NDEBUG
@@ -152,15 +153,20 @@ SDNode *MSP430DAGToDAGISel::Select(SDValue Op) {
return NULL;
}
- // Instruction Selection not handled by the auto-generated tablegen selection
- // should be handled here.
- // Something like this:
- // unsigned Opcode = Node->getOpcode();
- // switch (Opcode) {
- // default: break;
- // case ISD::Foo:
- // return SelectFoo(Node)
- // }
+ // Few custom selection stuff.
+ switch (Node->getOpcode()) {
+ default: break;
+ case ISD::FrameIndex: {
+ assert(Op.getValueType() == MVT::i16);
+ int FI = cast<FrameIndexSDNode>(Node)->getIndex();
+ SDValue TFI = CurDAG->getTargetFrameIndex(FI, MVT::i16);
+ if (Node->hasOneUse())
+ return CurDAG->SelectNodeTo(Node, MSP430::ADD16ri, MVT::i16,
+ TFI, CurDAG->getTargetConstant(0, MVT::i16));
+ return CurDAG->getTargetNode(MSP430::ADD16ri, dl, MVT::i16,
+ TFI, CurDAG->getTargetConstant(0, MVT::i16));
+ }
+ }
// Select the default instruction
SDNode *ResNode = SelectCode(Op);