[polly] r229877 - [NFC] Generalize getIslCompatibleName interface.

Johannes Doerfert doerfert at cs.uni-saarland.de
Thu Feb 19 10:09:40 PST 2015


Author: jdoerfert
Date: Thu Feb 19 12:09:39 2015
New Revision: 229877

URL: http://llvm.org/viewvc/llvm-project?rev=229877&view=rev
Log:
[NFC] Generalize getIslCompatibleName interface.

Modified:
    polly/trunk/include/polly/Support/GICHelper.h
    polly/trunk/lib/Support/GICHelper.cpp

Modified: polly/trunk/include/polly/Support/GICHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/GICHelper.h?rev=229877&r1=229876&r2=229877&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/GICHelper.h (original)
+++ polly/trunk/include/polly/Support/GICHelper.h Thu Feb 19 12:09:39 2015
@@ -72,8 +72,13 @@ inline llvm::raw_ostream &operator<<(llv
 }
 
 /// @brief Return @p Prefix + @p Val->getName() + @p Suffix but Isl compatible.
-std::string getIslCompatibleName(std::string Prefix, const llvm::Value *Val,
-                                 std::string Suffix);
+std::string getIslCompatibleName(const std::string &Prefix,
+                                 const llvm::Value *Val,
+                                 const std::string &Suffix);
+
+std::string getIslCompatibleName(const std::string &Prefix,
+                                 const std::string &Middle,
+                                 const std::string &Suffix);
 
 } // end namespace polly
 

Modified: polly/trunk/lib/Support/GICHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/GICHelper.cpp?rev=229877&r1=229876&r2=229877&view=diff
==============================================================================
--- polly/trunk/lib/Support/GICHelper.cpp (original)
+++ polly/trunk/lib/Support/GICHelper.cpp Thu Feb 19 12:09:39 2015
@@ -136,15 +136,21 @@ static void makeIslCompatible(std::strin
   replace(str, "\"", "_");
 }
 
-std::string polly::getIslCompatibleName(std::string Prefix, const Value *Val,
-                                        std::string Suffix) {
+std::string polly::getIslCompatibleName(const std::string &Prefix,
+                                        const std::string &Middle,
+                                        const std::string &Suffix) {
+  std::string S = Prefix + Middle + Suffix;
+  makeIslCompatible(S);
+  return S;
+}
+
+std::string polly::getIslCompatibleName(const std::string &Prefix, const Value *Val,
+                                        const std::string &Suffix) {
   std::string ValStr;
   raw_string_ostream OS(ValStr);
   Val->printAsOperand(OS, false);
   ValStr = OS.str();
   // Remove the leading %
   ValStr.erase(0, 1);
-  ValStr = Prefix + ValStr + Suffix;
-  makeIslCompatible(ValStr);
-  return ValStr;
+  return getIslCompatibleName(Prefix, ValStr, Suffix);
 }





More information about the llvm-commits mailing list