TableGen: Move GenStrConcat to a helper function in BinOpInit

Summary:
Make it accessible for more users.

Change-Id: Ib05f09ba14e7942ced5d2f24b205efa285e40cd5

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 327845
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 4a4a510..5f19d55 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -1994,9 +1994,7 @@
         break;
       }
 
-      Result =
-          BinOpInit::get(BinOpInit::STRCONCAT, LHS, RHS, StringRecTy::get())
-              ->Fold(CurRec);
+      Result = BinOpInit::getStrConcat(LHS, RHS);
       break;
     }
   }
@@ -2831,12 +2829,10 @@
   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),
-                  DefName, StringRecTy::get())
-                  ->Fold(DefProto);
+    DefName = BinOpInit::getStrConcat(
+        UnOpInit::get(UnOpInit::CAST, DefmPrefix, StringRecTy::get())
+            ->Fold(DefProto),
+        DefName);
   }
 
   // Make a trail of SMLocs from the multiclass instantiations.