TableGen: Remove the cast-from-string-to-variable-reference feature

Summary:
Cast-from-string for records isn't going away, but cast-from-string for
variables is a pretty dodgy feature to have, especially when referencing
template arguments. It's doubtful that this ever worked in a reliable
way, and nobody seems to be using it, so let's get rid of it and get
some related cleanups.

Change-Id: I395ac8a43fef4cf98e611f2f552300d21e99b66a

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D44195

llvm-svn: 327844
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 3bf99e9..4a4a510 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -936,7 +936,7 @@
       return nullptr;
     }
     Lex.Lex();  // eat the ')'
-    return (UnOpInit::get(Code, LHS, Type))->Fold(CurRec, CurMultiClass);
+    return (UnOpInit::get(Code, LHS, Type))->Fold(CurRec);
   }
 
   case tgtok::XIsA: {
@@ -1124,15 +1124,14 @@
         Code == BinOpInit::AND || Code == BinOpInit::OR) {
       while (InitList.size() > 2) {
         Init *RHS = InitList.pop_back_val();
-        RHS = (BinOpInit::get(Code, InitList.back(), RHS, Type))
-                           ->Fold(CurRec, CurMultiClass);
+        RHS = (BinOpInit::get(Code, InitList.back(), RHS, Type))->Fold(CurRec);
         InitList.back() = RHS;
       }
     }
 
     if (InitList.size() == 2)
       return (BinOpInit::get(Code, InitList[0], InitList[1], Type))
-        ->Fold(CurRec, CurMultiClass);
+          ->Fold(CurRec);
 
     Error(OpLoc, "expected two operands to operator");
     return nullptr;
@@ -1237,7 +1236,7 @@
     }
 
     return (TernOpInit::get(TernOpInit::FOREACH, LHS, MHS, RHS, OutType))
-               ->Fold(CurRec, CurMultiClass);
+        ->Fold(CurRec);
   }
 
   case tgtok::XDag:
@@ -1378,8 +1377,7 @@
       break;
     }
     }
-    return (TernOpInit::get(Code, LHS, MHS, RHS, Type))->Fold(CurRec,
-                                                             CurMultiClass);
+    return (TernOpInit::get(Code, LHS, MHS, RHS, Type))->Fold(CurRec);
   }
 
   case tgtok::XFoldl: {
@@ -1996,8 +1994,9 @@
         break;
       }
 
-      Result = BinOpInit::get(BinOpInit::STRCONCAT, LHS, RHS,
-                              StringRecTy::get())->Fold(CurRec, CurMultiClass);
+      Result =
+          BinOpInit::get(BinOpInit::STRCONCAT, LHS, RHS, StringRecTy::get())
+              ->Fold(CurRec);
       break;
     }
   }
@@ -2832,11 +2831,12 @@
   if (DefNameString) {
     // We have a fully expanded string so there are no operators to
     // resolve.  We should concatenate the given prefix and name.
-    DefName =
-      BinOpInit::get(BinOpInit::STRCONCAT,
-                     UnOpInit::get(UnOpInit::CAST, DefmPrefix,
-                                   StringRecTy::get())->Fold(DefProto, &MC),
-                     DefName, StringRecTy::get())->Fold(DefProto, &MC);
+    DefName = BinOpInit::get(
+                  BinOpInit::STRCONCAT,
+                  UnOpInit::get(UnOpInit::CAST, DefmPrefix, StringRecTy::get())
+                      ->Fold(DefProto),
+                  DefName, StringRecTy::get())
+                  ->Fold(DefProto);
   }
 
   // Make a trail of SMLocs from the multiclass instantiations.