diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:08:51 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:08:51 +0000 |
| commit | a3bce28ae0a7d443accd38d9debc7903e88cbf4b (patch) | |
| tree | dd23f28e04c48c03de0b7a8adb3f1c34d094b522 | |
| parent | cfc97056e75bf04cf50f4d63ac7e5e861f83a6a3 (diff) | |
| download | bcm5719-llvm-a3bce28ae0a7d443accd38d9debc7903e88cbf4b.tar.gz bcm5719-llvm-a3bce28ae0a7d443accd38d9debc7903e88cbf4b.zip | |
Match wrapper node for address
llvm-svn: 70731
| -rw-r--r-- | llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp index 3b28668f550..e564e63598a 100644 --- a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp +++ b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp @@ -79,7 +79,8 @@ bool MSP430DAGToDAGISel::SelectAddr(SDValue Op, SDValue Addr, return false; // Operand is a result from ADD with constant operand which fits into i16. - if (Addr.getOpcode() == ISD::ADD) { + switch (Addr.getOpcode()) { + case ISD::ADD: if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) { uint64_t CVal = CN->getZExtValue(); // Offset should fit into 16 bits. @@ -94,7 +95,21 @@ bool MSP430DAGToDAGISel::SelectAddr(SDValue Op, SDValue Addr, return true; } } - } + break; + case MSP430ISD::Wrapper: + SDValue N0 = Addr.getOperand(0); + if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(N0)) { + // We can match addresses of globals without any offsets + if (!G->getOffset()) { + Base = CurDAG->getTargetGlobalAddress(G->getGlobal(), + MVT::i16, 0); + Disp = CurDAG->getTargetConstant(0, MVT::i16); + + return true; + } + } + break; + }; Base = Addr; Disp = CurDAG->getTargetConstant(0, MVT::i16); |

