ARM TLS: implement "general dynamic", "initial exec" and "local exec" models.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36506 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp
index 1fe66fb..30a8eaf 100644
--- a/lib/Target/ARM/ARMConstantPoolValue.cpp
+++ b/lib/Target/ARM/ARMConstantPoolValue.cpp
@@ -20,18 +20,20 @@
 ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, unsigned id,
                                            ARMCP::ARMCPKind k,
                                            unsigned char PCAdj,
-                                           const char *Modif)
+                                           const char *Modif,
+                                           bool AddCA)
   : MachineConstantPoolValue((const Type*)gv->getType()),
     GV(gv), S(NULL), LabelId(id), Kind(k), PCAdjust(PCAdj),
-    Modifier(Modif) {}
+    Modifier(Modif), AddCurrentAddress(AddCA) {}
 
 ARMConstantPoolValue::ARMConstantPoolValue(const char *s, unsigned id,
                                            ARMCP::ARMCPKind k,
                                            unsigned char PCAdj,
-                                           const char *Modif)
+                                           const char *Modif,
+                                           bool AddCA)
   : MachineConstantPoolValue((const Type*)Type::Int32Ty),
     GV(NULL), S(s), LabelId(id), Kind(k), PCAdjust(PCAdj),
-    Modifier(Modif) {}
+    Modifier(Modif), AddCurrentAddress(AddCA) {}
 
 ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv,
                                            ARMCP::ARMCPKind k,
@@ -78,6 +80,11 @@
   if (isNonLazyPointer()) O << "$non_lazy_ptr";
   else if (isStub()) O << "$stub";
   if (Modifier) O << "(" << Modifier << ")";
-  if (PCAdjust != 0) O << "-(LPIC" << LabelId << "+"
-                       << (unsigned)PCAdjust << ")";
+  if (PCAdjust != 0) {
+    O << "-(LPIC" << LabelId << "+"
+      << (unsigned)PCAdjust;
+    if (AddCurrentAddress)
+      O << "-.";
+    O << ")";
+  }
 }