From 2c5e9d71aba3b1a85f07c08d2c09d40b8547264b Mon Sep 17 00:00:00 2001
From: dim <dim@FreeBSD.org>
Date: Thu, 3 May 2012 16:50:55 +0000
Subject: Vendor import of llvm release_31 branch r155985:
 http://llvm.org/svn/llvm-project/llvm/branches/release_31@155985

---
 utils/TableGen/AsmMatcherEmitter.cpp | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

(limited to 'utils/TableGen/AsmMatcherEmitter.cpp')

diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 39a3c25..dc92a6c 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1181,7 +1181,8 @@ void AsmMatcherInfo::BuildInfo() {
   unsigned VariantCount = Target.getAsmParserVariantCount();
   for (unsigned VC = 0; VC != VariantCount; ++VC) {
     Record *AsmVariant = Target.getAsmParserVariant(VC);
-    std::string CommentDelimiter = AsmVariant->getValueAsString("CommentDelimiter");
+    std::string CommentDelimiter =
+      AsmVariant->getValueAsString("CommentDelimiter");
     std::string RegisterPrefix = AsmVariant->getValueAsString("RegisterPrefix");
     int AsmVariantNo = AsmVariant->getValueAsInt("Variant");
 
@@ -1208,11 +1209,11 @@ void AsmMatcherInfo::BuildInfo() {
           // reject it.  We reject aliases and ignore instructions for now.
           if (OI.MINumOperands != 1) {
             // FIXME: Should reject these.  The ARM backend hits this with $lane
-            // in a bunch of instructions. It is unclear what the right answer is.
+            // in a bunch of instructions. The right answer is unclear.
             DEBUG({
                 errs() << "warning: '" << CGI.TheDef->getName() << "': "
-                       << "ignoring instruction with multi-operand tied operand '"
-                       << OI.Name << "'\n";
+                     << "ignoring instruction with multi-operand tied operand '"
+                     << OI.Name << "'\n";
               });
             continue;
           }
@@ -1248,8 +1249,8 @@ void AsmMatcherInfo::BuildInfo() {
       // If the tblgen -match-prefix option is specified (for tblgen hackers),
       // filter the set of instruction aliases we consider, based on the target
       // instruction.
-      if (!StringRef(Alias->ResultInst->TheDef->getName()).startswith(
-                                                                      MatchPrefix))
+      if (!StringRef(Alias->ResultInst->TheDef->getName())
+            .startswith( MatchPrefix))
         continue;
 
       OwningPtr<MatchableInfo> II(new MatchableInfo(Alias));
@@ -1328,6 +1329,9 @@ void AsmMatcherInfo::BuildInfo() {
     Record *Rec = AllTokenAliases[i];
     ClassInfo *FromClass = getTokenClass(Rec->getValueAsString("FromToken"));
     ClassInfo *ToClass = getTokenClass(Rec->getValueAsString("ToToken"));
+    if (FromClass == ToClass)
+      throw TGError(Rec->getLoc(),
+                    "error: Destination value identical to source value.");
     FromClass->SuperClasses.push_back(ToClass);
   }
 
@@ -1868,7 +1872,8 @@ static void EmitComputeAvailableFeatures(AsmMatcherInfo &Info,
     SubtargetFeatureInfo &SFI = *it->second;
 
     OS << "  if (";
-    std::string CondStorage = SFI.TheDef->getValueAsString("AssemblerCondString");
+    std::string CondStorage =
+      SFI.TheDef->getValueAsString("AssemblerCondString");
     StringRef Conds = CondStorage;
     std::pair<StringRef,StringRef> Comma = Conds.split(',');
     bool First = true;
-- 
cgit v1.1