Temporarily backing out 56585:56589 to unbreak the build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56607 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp
index 81bec51..7afbab3 100644
--- a/lib/Target/ARM/ARMTargetAsmInfo.cpp
+++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp
@@ -17,7 +17,7 @@
 #include <cctype>
 using namespace llvm;
 
-const char *const llvm::arm_asm_table[] = {
+static const char *const arm_asm_table[] = {
                                       "{r0}", "r0",
                                       "{r1}", "r1",
                                       "{r2}", "r2",
@@ -42,10 +42,21 @@
                                       "{cc}", "cc",
                                       0,0};
 
-TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo<TargetAsmInfo>);
+ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
+  AsmTransCBE = arm_asm_table;
+
+  AlignmentIsInBytes = false;
+  Data64bitsDirective = 0;
+  CommentString = "@";
+  ConstantPoolSection = "\t.text\n";
+  COMMDirectiveTakesAlignment = false;
+  InlineAsmStart = "@ InlineAsm Start";
+  InlineAsmEnd = "@ InlineAsm End";
+  LCOMMDirective = "\t.lcomm\t";
+}
 
 ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
-  ARMTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
+  ARMTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
   Subtarget = &DTM->getSubtarget<ARMSubtarget>();
 
   GlobalPrefix = "_";
@@ -93,7 +104,7 @@
 }
 
 ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMTargetMachine &TM):
-  ARMTargetAsmInfo<ELFTargetAsmInfo>(TM) {
+  ARMTargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
   Subtarget = &ETM->getSubtarget<ARMSubtarget>();
 
   NeedsSet = false;
@@ -127,15 +138,13 @@
 
 /// Count the number of comma-separated arguments.
 /// Do not try to detect errors.
-template <class BaseTAI>
-unsigned ARMTargetAsmInfo<BaseTAI>::countArguments(const char* p) const {
+unsigned ARMTargetAsmInfo::countArguments(const char* p) const {
   unsigned count = 0;
   while (*p && isspace(*p) && *p != '\n')
     p++;
   count++;
-  while (*p && *p!='\n' &&
-         strncmp(p, BaseTAI::CommentString,
-                 strlen(BaseTAI::CommentString))!=0) {
+  while (*p && *p!='\n' && 
+         strncmp(p, CommentString, strlen(CommentString))!=0) {
     if (*p==',')
       count++;
     p++;
@@ -145,8 +154,7 @@
 
 /// Count the length of a string enclosed in quote characters.
 /// Do not try to detect errors.
-template <class BaseTAI>
-unsigned ARMTargetAsmInfo<BaseTAI>::countString(const char* p) const {
+unsigned ARMTargetAsmInfo::countString(const char* p) const {
   unsigned count = 0;
   while (*p && isspace(*p) && *p!='\n')
     p++;
@@ -158,8 +166,7 @@
 }
 
 /// ARM-specific version of TargetAsmInfo::getInlineAsmLength.
-template <class BaseTAI>
-unsigned ARMTargetAsmInfo<BaseTAI>::getInlineAsmLength(const char *s) const {
+unsigned ARMTargetAsmInfo::getInlineAsmLength(const char *s) const {
   // Make a lowercase-folded version of s for counting purposes.
   char *q, *s_copy = (char *)malloc(strlen(s) + 1);
   strcpy(s_copy, s);
@@ -185,7 +192,7 @@
           break;
         }
       // Ignore everything from comment char(s) to EOL
-      if (strncmp(Str, BaseTAI::CommentString, strlen(BaseTAI::CommentString))==-0)
+      if (strncmp(Str, CommentString, strlen(CommentString))==-0)
         atInsnStart = false;
       // FIXME do something like the following for non-Darwin
       else if (*Str == '.' && Subtarget->isTargetDarwin()) {
@@ -275,7 +282,7 @@
           Length += 4;    // ARM
       }
     }
-    if (*Str == '\n' || *Str == BaseTAI::SeparatorChar)
+    if (*Str == '\n' || *Str == SeparatorChar)
       atInsnStart = true;
   }
   free(s_copy);
diff --git a/lib/Target/ARM/ARMTargetAsmInfo.h b/lib/Target/ARM/ARMTargetAsmInfo.h
index 9e6f856..9030d06 100644
--- a/lib/Target/ARM/ARMTargetAsmInfo.h
+++ b/lib/Target/ARM/ARMTargetAsmInfo.h
@@ -14,31 +14,19 @@
 #ifndef ARMTARGETASMINFO_H
 #define ARMTARGETASMINFO_H
 
-#include "ARMTargetMachine.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/ELFTargetAsmInfo.h"
 #include "llvm/Target/DarwinTargetAsmInfo.h"
-#include "llvm/Support/Compiler.h"
+
+#include "ARMSubtarget.h"
 
 namespace llvm {
 
-  extern const char *const arm_asm_table[];
+  // Forward declaration.
+  class ARMTargetMachine;
 
-  template <class BaseTAI>
-  struct ARMTargetAsmInfo : public BaseTAI {
-    explicit ARMTargetAsmInfo(const ARMTargetMachine &TM):
-      BaseTAI(TM) {
-      BaseTAI::AsmTransCBE = arm_asm_table;
-
-      BaseTAI::AlignmentIsInBytes = false;
-      BaseTAI::Data64bitsDirective = 0;
-      BaseTAI::CommentString = "@";
-      BaseTAI::ConstantPoolSection = "\t.text\n";
-      BaseTAI::COMMDirectiveTakesAlignment = false;
-      BaseTAI::InlineAsmStart = "@ InlineAsm Start";
-      BaseTAI::InlineAsmEnd = "@ InlineAsm End";
-      BaseTAI::LCOMMDirective = "\t.lcomm\t";
-    }
+  struct ARMTargetAsmInfo : public virtual TargetAsmInfo {
+    explicit ARMTargetAsmInfo(const ARMTargetMachine &TM);
 
     const ARMSubtarget *Subtarget;
 
@@ -47,15 +35,13 @@
     unsigned countString(const char *p) const;
   };
 
-  typedef ARMTargetAsmInfo<TargetAsmInfo> ARMGenericTargetAsmInfo;
-
-  EXTERN_TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo<TargetAsmInfo>);
-
-  struct ARMDarwinTargetAsmInfo : public ARMTargetAsmInfo<DarwinTargetAsmInfo> {
+  struct ARMDarwinTargetAsmInfo : public virtual ARMTargetAsmInfo,
+                                  public virtual DarwinTargetAsmInfo {
     explicit ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM);
   };
 
-  struct ARMELFTargetAsmInfo : public ARMTargetAsmInfo<ELFTargetAsmInfo> {
+  struct ARMELFTargetAsmInfo : public virtual ARMTargetAsmInfo,
+                               public virtual ELFTargetAsmInfo {
     explicit ARMELFTargetAsmInfo(const ARMTargetMachine &TM);
   };
 
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
index 29a9d84..0613078 100644
--- a/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
@@ -120,7 +120,7 @@
    case ARMSubtarget::isELF:
     return new ARMELFTargetAsmInfo(*this);
    default:
-    return new ARMGenericTargetAsmInfo(*this);
+    return new ARMTargetAsmInfo(*this);
   }
 }