[llvm-commits] [polly] r144909 - in /polly/trunk/lib: Analysis/ScopDetection.cpp Analysis/ScopInfo.cpp Cloog.cpp CodeGeneration.cpp Exchange/JSONExporter.cpp Exchange/ScopLib.cpp Exchange/ScopLibExporter.cpp Exchange/ScopLibImporter.cpp RegionSimplify.cpp

Tobias Grosser grosser at fim.uni-passau.de
Thu Nov 17 06:52:36 PST 2011


Author: grosser
Date: Thu Nov 17 08:52:36 2011
New Revision: 144909

URL: http://llvm.org/viewvc/llvm-project?rev=144909&view=rev
Log:
Do not use getNameStr() anymore.

Instead we switch to the recommended getName(). This fixes compilation with
recent versions of LLVM.

Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Cloog.cpp
    polly/trunk/lib/CodeGeneration.cpp
    polly/trunk/lib/Exchange/JSONExporter.cpp
    polly/trunk/lib/Exchange/ScopLib.cpp
    polly/trunk/lib/Exchange/ScopLibExporter.cpp
    polly/trunk/lib/Exchange/ScopLibImporter.cpp
    polly/trunk/lib/RegionSimplify.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu Nov 17 08:52:36 2011
@@ -154,7 +154,7 @@
   BranchInst *Br = dyn_cast<BranchInst>(TI);
 
   if (!Br)
-    INVALID(CFG, "Non branch instruction terminates BB: " + BB.getNameStr());
+    INVALID(CFG, "Non branch instruction terminates BB: " + BB.getName());
 
   if (Br->isUnconditional()) return true;
 
@@ -163,11 +163,11 @@
   // UndefValue is not allowed as condition.
   if (isa<UndefValue>(Condition))
     INVALID(AffFunc, "Condition based on 'undef' value in BB: "
-                     + BB.getNameStr());
+                     + BB.getName());
 
   // Only Constant and ICmpInst are allowed as condition.
   if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition)))
-    INVALID(AffFunc, "Condition in BB '" + BB.getNameStr() + "' neither "
+    INVALID(AffFunc, "Condition in BB '" + BB.getName() + "' neither "
                      "constant nor an icmp instruction");
 
   // Allow perfectly nested conditions.
@@ -185,14 +185,14 @@
     // Are both operands of the ICmp affine?
     if (isa<UndefValue>(ICmp->getOperand(0))
         || isa<UndefValue>(ICmp->getOperand(1)))
-      INVALID(AffFunc, "undef operand in branch at BB: " + BB.getNameStr());
+      INVALID(AffFunc, "undef operand in branch at BB: " + BB.getName());
 
     const SCEV *LHS = SE->getSCEV(ICmp->getOperand(0));
     const SCEV *RHS = SE->getSCEV(ICmp->getOperand(1));
 
     if (!isAffineExpr(&Context.CurRegion, LHS, *SE) ||
         !isAffineExpr(&Context.CurRegion, RHS, *SE))
-      INVALID(AffFunc, "Non affine branch in BB '" << BB.getNameStr()
+      INVALID(AffFunc, "Non affine branch in BB '" << BB.getName()
                         << "' with LHS: " << *LHS << " and RHS: " << *RHS);
   }
 
@@ -204,7 +204,7 @@
   // Allow perfectly nested conditions.
   Region *R = RI->getRegionFor(&BB);
   if (R->getEntry() != &BB)
-    INVALID(CFG, "Not well structured condition at BB: " + BB.getNameStr());
+    INVALID(CFG, "Not well structured condition at BB: " + BB.getName());
 
   return true;
 }
@@ -358,13 +358,13 @@
   // No canonical induction variable.
   if (!IndVar)
     INVALID(IndVar, "No canonical IV at loop header: "
-                    << L->getHeader()->getNameStr());
+                    << L->getHeader()->getName());
 
   // Is the loop count affine?
   const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
   if (!isAffineExpr(&Context.CurRegion, LoopCount, *SE))
     INVALID(LoopBound, "Non affine loop bound '" << *LoopCount << "' in loop: "
-                       << L->getHeader()->getNameStr());
+                       << L->getHeader()->getName());
 
   return true;
 }
@@ -525,7 +525,7 @@
 
   releaseMemory();
 
-  if (OnlyFunction != "" && F.getNameStr() != OnlyFunction)
+  if (OnlyFunction != "" && F.getName() != OnlyFunction)
     return false;
 
   if(!isValidFunction(F))

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Nov 17 08:52:36 2011
@@ -237,7 +237,8 @@
 
     isl_space *Space;
 
-    isl_id *ID = isl_id_alloc(ctx, Value->getNameStr().c_str(), Value);
+    std::string ValueName = Value->getName();
+    isl_id *ID = isl_id_alloc(ctx, ValueName.c_str(), Value);
     Space = isl_space_set_alloc(ctx, 1, NbLoopSpaces);
     Space = isl_space_set_dim_id(Space, isl_dim_param, 0, ID);
 
@@ -874,7 +875,7 @@
 
   if (const SCEVUnknown *ValueParameter = dyn_cast<SCEVUnknown>(Parameter)) {
     Value *Val = ValueParameter->getValue();
-    ParameterName = Val->getNameStr();
+    ParameterName = Val->getName();
   }
 
   if (ParameterName == "" || ParameterName.substr(0, 2) == "p_")

Modified: polly/trunk/lib/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Cloog.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Cloog.cpp (original)
+++ polly/trunk/lib/Cloog.cpp Thu Nov 17 08:52:36 2011
@@ -210,7 +210,7 @@
 
 }
 std::string CloogExporter::getFileName(Region *R) const {
-  std::string FunctionName = R->getEntry()->getParent()->getNameStr();
+  std::string FunctionName = R->getEntry()->getParent()->getName();
   std::string ExitName, EntryName;
 
   raw_string_ostream ExitStr(ExitName);
@@ -236,7 +236,7 @@
   Region &R = S.getRegion();
   CloogInfo &C = getAnalysis<CloogInfo>();
 
-  std::string FunctionName = R.getEntry()->getParent()->getNameStr();
+  std::string FunctionName = R.getEntry()->getParent()->getName();
   std::string Filename = getFileName(&R);
 
   errs() << "Writing Scop '" << R.getNameStr() << "' in function '"
@@ -296,7 +296,7 @@
 
   Function *F = S.getRegion().getEntry()->getParent();
 
-  DEBUG(dbgs() << ":: " << F->getNameStr());
+  DEBUG(dbgs() << ":: " << F->getName());
   DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n");;
   DEBUG(C->pprint(dbgs()));
 
@@ -306,7 +306,7 @@
 void CloogInfo::printScop(raw_ostream &OS) const {
   Function *function = scop->getRegion().getEntry()->getParent();
 
-  OS << function->getNameStr() << "():\n";
+  OS << function->getName() << "():\n";
 
   C->pprint(OS);
 }

Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Thu Nov 17 08:52:36 2011
@@ -239,8 +239,7 @@
     Value *VectorPtr = Builder.CreateBitCast(newPointer, vectorPtrType,
                                              "vector_ptr");
     LoadInst *VecLoad = Builder.CreateLoad(VectorPtr,
-                                        load->getNameStr()
-                                        + "_p_vec_full");
+                                           load->getName() + "_p_vec_full");
     if (!Aligned)
       VecLoad->setAlignment(8);
 
@@ -263,9 +262,9 @@
     Type *vectorPtrType = getVectorPtrTy(pointer, 1);
     Value *newPointer = getOperand(pointer, BBMap);
     Value *vectorPtr = Builder.CreateBitCast(newPointer, vectorPtrType,
-                                             load->getNameStr() + "_p_vec_p");
+                                             load->getName() + "_p_vec_p");
     LoadInst *scalarLoad= Builder.CreateLoad(vectorPtr,
-                                          load->getNameStr() + "_p_splat_one");
+                                             load->getName() + "_p_splat_one");
 
     if (!Aligned)
       scalarLoad->setAlignment(8);
@@ -279,7 +278,7 @@
 
     Value *vectorLoad = Builder.CreateShuffleVector(scalarLoad, scalarLoad,
                                                     splatVector,
-                                                    load->getNameStr()
+                                                    load->getName()
                                                     + "_p_splat");
     return vectorLoad;
   }
@@ -307,10 +306,10 @@
     for (int i = 0; i < size; i++) {
       Value *newPointer = getOperand(pointer, scalarMaps[i]);
       Value *scalarLoad = Builder.CreateLoad(newPointer,
-                                             load->getNameStr() + "_p_scalar_");
+                                             load->getName() + "_p_scalar_");
       vector = Builder.CreateInsertElement(vector, scalarLoad,
                                            Builder.getInt32(i),
-                                           load->getNameStr() + "_p_vec_");
+                                           load->getName() + "_p_vec_");
     }
 
     return vector;
@@ -387,7 +386,7 @@
     const Instruction *Inst = dyn_cast<Instruction>(load);
     Value *newPointer = generateLocationAccessed(Inst, pointer, BBMap);
     Value *scalarLoad = Builder.CreateLoad(newPointer,
-                                           load->getNameStr() + "_p_scalar_");
+                                           load->getName() + "_p_scalar_");
     return scalarLoad;
   }
 
@@ -444,7 +443,7 @@
 
     Value *newInst = Builder.CreateBinOp(Inst->getOpcode(), newOpZero,
                                          newOpOne,
-                                         Inst->getNameStr() + "p_vec");
+                                         Inst->getName() + "p_vec");
     vectorMap[Inst] = newInst;
 
     return;
@@ -580,8 +579,7 @@
     Function *F = Builder.GetInsertBlock()->getParent();
     LLVMContext &Context = F->getContext();
     BasicBlock *CopyBB = BasicBlock::Create(Context,
-                                            "polly." + BB->getNameStr()
-                                            + ".stmt",
+                                            "polly." + BB->getName() + ".stmt",
                                             F);
     Builder.CreateBr(CopyBB);
     DT->addNewBlock(CopyBB, Builder.GetInsertBlock());
@@ -914,11 +912,10 @@
   /// @brief Add a new definition of an openmp subfunction.
   Function *addOpenMPSubfunction(Module *M) {
     Function *F = Builder.GetInsertBlock()->getParent();
-    const std::string &Name = F->getNameStr() + ".omp_subfn";
-
     std::vector<Type*> Arguments(1, Builder.getInt8PtrTy());
     FunctionType *FT = FunctionType::get(Builder.getVoidTy(), Arguments, false);
-    Function *FN = Function::Create(FT, Function::InternalLinkage, Name, M);
+    Function *FN = Function::Create(FT, Function::InternalLinkage,
+                                    F->getName() + ".omp_subfn", M);
     // Do not run any polly pass on the new function.
     SD->markFunctionAsInvalid(FN);
 

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Thu Nov 17 08:52:36 2011
@@ -83,7 +83,7 @@
 char JSONExporter::ID = 0;
 std::string JSONExporter::getFileName(Scop *S) const {
   std::string FunctionName =
-    S->getRegion().getEntry()->getParent()->getNameStr();
+    S->getRegion().getEntry()->getParent()->getName();
   std::string FileName = FunctionName + "___" + S->getNameStr() + ".jscop";
   return FileName;
 }
@@ -142,7 +142,7 @@
   std::string ErrInfo;
   tool_output_file F(FileName.c_str(), ErrInfo);
 
-  std::string FunctionName = R.getEntry()->getParent()->getNameStr();
+  std::string FunctionName = R.getEntry()->getParent()->getName();
   errs() << "Writing JScop '" << R.getNameStr() << "' in function '"
     << FunctionName << "' to '" << FileName << "'.\n";
 
@@ -182,7 +182,7 @@
 char JSONImporter::ID = 0;
 std::string JSONImporter::getFileName(Scop *S) const {
   std::string FunctionName =
-    S->getRegion().getEntry()->getParent()->getNameStr();
+    S->getRegion().getEntry()->getParent()->getName();
   std::string FileName = FunctionName + "___" + S->getNameStr() + ".jscop";
 
   if (ImportPostfix != "")
@@ -207,7 +207,7 @@
 
   std::string FileName = ImportDir + "/" + getFileName(S);
 
-  std::string FunctionName = R.getEntry()->getParent()->getNameStr();
+  std::string FunctionName = R.getEntry()->getParent()->getName();
   errs() << "Reading JScop '" << R.getNameStr() << "' in function '"
     << FunctionName << "' from '" << FileName << "'.\n";
   OwningPtr<MemoryBuffer> result;

Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Thu Nov 17 08:52:36 2011
@@ -76,7 +76,7 @@
          VE = ArrayMap.end(); VI != VE; ++VI)
       if ((*VI).second == i) {
         const Value *V = (*VI).first;
-        std::string name = V->getNameStr();
+        std::string name = V->getName();
         scoplib->arrays[i] = (char*) malloc(sizeof(char*) * (name.size() + 1));
         strcpy(scoplib->arrays[i], name.c_str());
       }

Modified: polly/trunk/lib/Exchange/ScopLibExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLibExporter.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLibExporter.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLibExporter.cpp Thu Nov 17 08:52:36 2011
@@ -54,7 +54,7 @@
 
 std::string ScopLibExporter::getFileName(Scop *S) const {
   std::string FunctionName =
-    S->getRegion().getEntry()->getParent()->getNameStr();
+    S->getRegion().getEntry()->getParent()->getName();
   std::string FileName = FunctionName + "___" + S->getNameStr() + ".scoplib";
   return FileName;
 }
@@ -76,7 +76,7 @@
   scoplib.print(F);
   fclose(F);
 
-  std::string FunctionName = R->getEntry()->getParent()->getNameStr();
+  std::string FunctionName = R->getEntry()->getParent()->getName();
   errs() << "Writing Scop '" << R->getNameStr() << "' in function '"
     << FunctionName << "' to '" << FileName << "'.\n";
 

Modified: polly/trunk/lib/Exchange/ScopLibImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLibImporter.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLibImporter.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLibImporter.cpp Thu Nov 17 08:52:36 2011
@@ -62,7 +62,7 @@
 namespace {
 std::string ScopLibImporter::getFileName(Scop *S) const {
   std::string FunctionName =
-    S->getRegion().getEntry()->getParent()->getNameStr();
+    S->getRegion().getEntry()->getParent()->getName();
   std::string FileName = FunctionName + "___" + S->getNameStr() + ".scoplib";
   return FileName;
 }
@@ -85,7 +85,7 @@
     return false;
   }
 
-  std::string FunctionName = R->getEntry()->getParent()->getNameStr();
+  std::string FunctionName = R->getEntry()->getParent()->getName();
   errs() << "Reading Scop '" << R->getNameStr() << "' in function '"
     << FunctionName << "' from '" << FileName << "'.\n";
 

Modified: polly/trunk/lib/RegionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegionSimplify.cpp?rev=144909&r1=144908&r2=144909&view=diff
==============================================================================
--- polly/trunk/lib/RegionSimplify.cpp (original)
+++ polly/trunk/lib/RegionSimplify.cpp Thu Nov 17 08:52:36 2011
@@ -73,11 +73,11 @@
   O << "Region: " << r->getNameStr() << " Edges:\t";
 
   if (enteringBlock)
-    O << "Entering: [" << enteringBlock->getNameStr() << " -> "
+    O << "Entering: [" << enteringBlock->getName() << " -> "
       << r->getEntry()->getName() << "], ";
 
   if (exitingBlock) {
-    O << "Exiting: [" << exitingBlock->getNameStr() << " -> ";
+    O << "Exiting: [" << exitingBlock->getName() << " -> ";
     if (r->getExit())
       O << r->getExit()->getName();
     else





More information about the llvm-commits mailing list