Do not use getNameStr() anymore.

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

llvm-svn: 144909
This commit is contained in:
Tobias Grosser 2011-11-17 14:52:36 +00:00
parent 135c9c6534
commit 29ee0b14d5
9 changed files with 38 additions and 40 deletions

View File

@ -154,7 +154,7 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
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 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
// 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 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
// 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 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
// 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 @@ bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const {
// 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 @@ bool ScopDetection::runOnFunction(llvm::Function &F) {
releaseMemory();
if (OnlyFunction != "" && F.getNameStr() != OnlyFunction)
if (OnlyFunction != "" && F.getName() != OnlyFunction)
return false;
if(!isValidFunction(F))

View File

@ -237,7 +237,8 @@ public:
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 @@ __isl_give isl_id *Scop::getIdForParam(const SCEV *Parameter) const {
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_")

View File

@ -210,7 +210,7 @@ struct CloogExporter : public ScopPass {
}
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 @@ bool CloogExporter::runOnScop(Scop &S) {
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 @@ bool CloogInfo::runOnScop(Scop &S) {
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 @@ bool CloogInfo::runOnScop(Scop &S) {
void CloogInfo::printScop(raw_ostream &OS) const {
Function *function = scop->getRegion().getEntry()->getParent();
OS << function->getNameStr() << "():\n";
OS << function->getName() << "():\n";
C->pprint(OS);
}

View File

@ -239,8 +239,7 @@ public:
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 @@ public:
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 @@ public:
Value *vectorLoad = Builder.CreateShuffleVector(scalarLoad, scalarLoad,
splatVector,
load->getNameStr()
load->getName()
+ "_p_splat");
return vectorLoad;
}
@ -307,10 +306,10 @@ public:
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 @@ public:
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 @@ public:
Value *newInst = Builder.CreateBinOp(Inst->getOpcode(), newOpZero,
newOpOne,
Inst->getNameStr() + "p_vec");
Inst->getName() + "p_vec");
vectorMap[Inst] = newInst;
return;
@ -580,8 +579,7 @@ public:
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 @@ public:
/// @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);

View File

@ -83,7 +83,7 @@ struct JSONImporter : public ScopPass {
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 @@ bool JSONExporter::runOnScop(Scop &scop) {
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 @@ Pass *polly::createJSONExporterPass() {
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 @@ bool JSONImporter::runOnScop(Scop &scop) {
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;

View File

@ -76,7 +76,7 @@ void ScopLib::initializeArrays() {
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());
}

View File

@ -54,7 +54,7 @@ char ScopLibExporter::ID = 0;
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 @@ bool ScopLibExporter::runOnScop(Scop &scop) {
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";

View File

@ -62,7 +62,7 @@ char ScopLibImporter::ID = 0;
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 @@ bool ScopLibImporter::runOnRegion(Region *R, RGPassManager &RGM) {
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";

View File

@ -73,11 +73,11 @@ void RegionSimplify::print(raw_ostream &O, const Module *M) const {
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