Correct asmprinting of memory operands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70732 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
index e564e63..c057d69 100644
--- a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
+++ b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
@@ -72,6 +72,7 @@
   return new MSP430DAGToDAGISel(TM);
 }
 
+// FIXME: This is pretty dummy routine and needs to be rewritten in the future.
 bool MSP430DAGToDAGISel::SelectAddr(SDValue Op, SDValue Addr,
                                     SDValue &Disp, SDValue &Base) {
   // We don't support frame index stuff yet.
@@ -99,20 +100,17 @@
   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);
+      Base = CurDAG->getRegister(0, MVT::i16);
+      Disp = CurDAG->getTargetGlobalAddress(G->getGlobal(),
+                                            MVT::i16, G->getOffset());
 
-        return true;
-      }
+      return true;
     }
     break;
   };
 
-  Base = Addr;
-  Disp = CurDAG->getTargetConstant(0, MVT::i16);
+  Base = CurDAG->getRegister(0, MVT::i16);
+  Disp = Addr;
 
   return true;
 }