From f6ccee5a9d2b9573f679bca6266ade3eb8cd3f88 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 24 Jul 2009 08:24:36 +0000 Subject: [PATCH 1/1] Switch to getNameStr(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76962 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/CFGPrinter.cpp | 12 ++++++------ lib/CodeGen/MachineFunction.cpp | 8 ++++---- lib/CodeGen/ScheduleDAGPrinter.cpp | 10 +++++----- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 4 ++-- lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 4 ++-- .../Interpreter/ExternalFunctions.cpp | 6 +++--- lib/Target/PIC16/PIC16DebugInfo.cpp | 4 ++-- lib/Target/PIC16/PIC16TargetAsmInfo.cpp | 6 +++--- lib/Target/X86/X86TargetAsmInfo.cpp | 6 +++--- lib/Transforms/IPO/DeadArgumentElimination.cpp | 2 +- lib/Transforms/Utils/CodeExtractor.cpp | 8 ++++---- tools/bugpoint/ExtractFunction.cpp | 2 +- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index 8ada5a3f74c..73f50d741c6 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -35,14 +35,14 @@ namespace llvm { template<> struct DOTGraphTraits : public DefaultDOTGraphTraits { static std::string getGraphName(const Function *F) { - return "CFG for '" + F->getName() + "' function"; + return "CFG for '" + F->getNameStr() + "' function"; } static std::string getNodeLabel(const BasicBlock *Node, const Function *Graph, bool ShortNames) { if (ShortNames && !Node->getName().empty()) - return Node->getName() + ":"; + return Node->getNameStr() + ":"; std::ostringstream Out; if (ShortNames) { @@ -136,7 +136,7 @@ namespace { explicit CFGPrinter(void *pid) : FunctionPass(pid) {} virtual bool runOnFunction(Function &F) { - std::string Filename = "cfg." + F.getName() + ".dot"; + std::string Filename = "cfg." + F.getNameStr() + ".dot"; cerr << "Writing '" << Filename << "'..."; std::ofstream File(Filename.c_str()); @@ -166,7 +166,7 @@ namespace { CFGOnlyPrinter() : FunctionPass(&ID) {} explicit CFGOnlyPrinter(void *pid) : FunctionPass(pid) {} virtual bool runOnFunction(Function &F) { - std::string Filename = "cfg." + F.getName() + ".dot"; + std::string Filename = "cfg." + F.getNameStr() + ".dot"; cerr << "Writing '" << Filename << "'..."; std::ofstream File(Filename.c_str()); @@ -196,7 +196,7 @@ P2("dot-cfg-only", /// being a 'dot' and 'gv' program in your path. /// void Function::viewCFG() const { - ViewGraph(this, "cfg" + getName()); + ViewGraph(this, "cfg" + getNameStr()); } /// viewCFGOnly - This function is meant for use from the debugger. It works @@ -205,7 +205,7 @@ void Function::viewCFG() const { /// his can make the graph smaller. /// void Function::viewCFGOnly() const { - ViewGraph(this, "cfg" + getName(), true); + ViewGraph(this, "cfg" + getNameStr(), true); } FunctionPass *llvm::createCFGPrinterPass () { diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 9d6669b0852..34f840a8284 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -304,7 +304,7 @@ namespace llvm { template<> struct DOTGraphTraits : public DefaultDOTGraphTraits { static std::string getGraphName(const MachineFunction *F) { - return "CFG for '" + F->getFunction()->getName() + "' function"; + return "CFG for '" + F->getFunction()->getNameStr() + "' function"; } static std::string getNodeLabel(const MachineBasicBlock *Node, @@ -312,7 +312,7 @@ namespace llvm { bool ShortNames) { if (ShortNames && Node->getBasicBlock() && !Node->getBasicBlock()->getName().empty()) - return Node->getBasicBlock()->getName() + ":"; + return Node->getBasicBlock()->getNameStr() + ":"; std::ostringstream Out; if (ShortNames) { @@ -339,7 +339,7 @@ namespace llvm { void MachineFunction::viewCFG() const { #ifndef NDEBUG - ViewGraph(this, "mf" + getFunction()->getName()); + ViewGraph(this, "mf" + getFunction()->getNameStr()); #else cerr << "SelectionDAG::viewGraph is only available in debug builds on " << "systems with Graphviz or gv!\n"; @@ -349,7 +349,7 @@ void MachineFunction::viewCFG() const void MachineFunction::viewCFGOnly() const { #ifndef NDEBUG - ViewGraph(this, "mf" + getFunction()->getName(), true); + ViewGraph(this, "mf" + getFunction()->getNameStr(), true); #else cerr << "SelectionDAG::viewGraph is only available in debug builds on " << "systems with Graphviz or gv!\n"; diff --git a/lib/CodeGen/ScheduleDAGPrinter.cpp b/lib/CodeGen/ScheduleDAGPrinter.cpp index 4514c77483c..ae358ec4fb5 100644 --- a/lib/CodeGen/ScheduleDAGPrinter.cpp +++ b/lib/CodeGen/ScheduleDAGPrinter.cpp @@ -86,12 +86,12 @@ void ScheduleDAG::viewGraph() { // This code is only for debugging! #ifndef NDEBUG if (BB->getBasicBlock()) - ViewGraph(this, "dag." + MF.getFunction()->getName(), false, - "Scheduling-Units Graph for " + MF.getFunction()->getName() + - ":" + BB->getBasicBlock()->getName()); + ViewGraph(this, "dag." + MF.getFunction()->getNameStr(), false, + "Scheduling-Units Graph for " + MF.getFunction()->getNameStr() + + ":" + BB->getBasicBlock()->getNameStr()); else - ViewGraph(this, "dag." + MF.getFunction()->getName(), false, - "Scheduling-Units Graph for " + MF.getFunction()->getName()); + ViewGraph(this, "dag." + MF.getFunction()->getNameStr(), false, + "Scheduling-Units Graph for " + MF.getFunction()->getNameStr()); #else cerr << "ScheduleDAG::viewGraph is only available in debug builds on " << "systems with Graphviz or gv!\n"; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e2d4d08ec05..b0a19df0520 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -568,8 +568,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() { if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs || ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs || ViewSUnitDAGs) - BlockName = CurDAG->getMachineFunction().getFunction()->getName() + ":" + - BB->getBasicBlock()->getName(); + BlockName = CurDAG->getMachineFunction().getFunction()->getNameStr() + ":" + + BB->getBasicBlock()->getNameStr(); DOUT << "Initial selection DAG:\n"; DEBUG(CurDAG->dump()); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index 6fd5df2b937..386d732348f 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -138,8 +138,8 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, void SelectionDAG::viewGraph(const std::string &Title) { // This code is only for debugging! #ifndef NDEBUG - ViewGraph(this, "dag." + getMachineFunction().getFunction()->getName(), false, - Title); + ViewGraph(this, "dag." + getMachineFunction().getFunction()->getNameStr(), + false, Title); #else cerr << "SelectionDAG::viewGraph is only available in debug builds on " << "systems with Graphviz or gv!\n"; diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 86d1e16589b..79948704ef1 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -96,15 +96,15 @@ static ExFunc lookupFunction(const Function *F) { const FunctionType *FT = F->getFunctionType(); for (unsigned i = 0, e = FT->getNumContainedTypes(); i != e; ++i) ExtName += getTypeID(FT->getContainedType(i)); - ExtName += "_" + F->getName(); + ExtName + "_" + F->getNameStr(); sys::ScopedLock Writer(*FunctionsLock); ExFunc FnPtr = FuncNames[ExtName]; if (FnPtr == 0) - FnPtr = FuncNames["lle_X_"+F->getName()]; + FnPtr = FuncNames["lle_X_" + F->getNameStr()]; if (FnPtr == 0) // Try calling a generic function... if it exists... FnPtr = (ExFunc)(intptr_t) - sys::DynamicLibrary::SearchForAddressOfSymbol("lle_X_"+F->getName()); + sys::DynamicLibrary::SearchForAddressOfSymbol("lle_X_"+F->getNameStr()); if (FnPtr != 0) ExportedFunctions->insert(std::make_pair(F, FnPtr)); // Cache for later return FnPtr; diff --git a/lib/Target/PIC16/PIC16DebugInfo.cpp b/lib/Target/PIC16/PIC16DebugInfo.cpp index bf635f086ce..fd0d309e141 100644 --- a/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -117,7 +117,7 @@ void PIC16DbgInfo::PopulateStructOrUnionTypeInfo (DIType Ty, CTy.getName(TagName); // UniqueSuffix is .number where number is obtained from // llvm.dbg.composite. - std::string UniqueSuffix = "." + Ty.getGV()->getName().substr(18); + std::string UniqueSuffix = "." + Ty.getGV()->getNameStr().substr(18); TagName += UniqueSuffix; unsigned short size = CTy.getSizeInBits()/8; // 7th and 8th byte represent size. @@ -446,7 +446,7 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) { bool HasAux = false; int Aux[PIC16Dbg::AuxSize] = { 0 }; std::string TagName = ""; - std::string VarName = TAI->getGlobalPrefix()+DIGV.getGlobal()->getName(); + std::string VarName = TAI->getGlobalPrefix()+DIGV.getGlobal()->getNameStr(); PopulateDebugInfo(Ty, TypeNo, HasAux, Aux, TagName); // Emit debug info only if type information is availaible. if (TypeNo != PIC16Dbg::T_NULL) { diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp index 9adf63a0a97..c7708fa761f 100644 --- a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp +++ b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp @@ -310,7 +310,7 @@ PIC16TargetAsmInfo::CreateBSSSectionForGlobal(const GlobalVariable *GV, } } } else { - std::string Prefix = GV->getName() + "." + Addr + "."; + std::string Prefix = GV->getNameStr() + "." + Addr + "."; Name = PAN::getUdataSectionName(BSSSections.size(), Prefix) + " " + Addr; } @@ -361,7 +361,7 @@ PIC16TargetAsmInfo::CreateIDATASectionForGlobal(const GlobalVariable *GV, } } } else { - std::string Prefix = GV->getName() + "." + Addr + "."; + std::string Prefix = GV->getNameStr() + "." + Addr + "."; Name = PAN::getIdataSectionName(IDATASections.size(), Prefix) + " " + Addr; } @@ -399,7 +399,7 @@ PIC16TargetAsmInfo::CreateROSectionForGlobal(const GlobalVariable *GV, } } } else { - std::string Prefix = GV->getName() + "." + Addr + "."; + std::string Prefix = GV->getNameStr() + "." + Addr + "."; Name = PAN::getRomdataSectionName(ROSections.size(), Prefix) + " " + Addr; } diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 99615dbd8ba..52b4f425927 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -45,8 +45,8 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): AlignmentIsInBytes = false; TextAlignFillValue = 0x90; - - + + if (!is64Bit) Data64bitsDirective = 0; // we can't emit a 64-bit unit ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. @@ -64,7 +64,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): // Leopard and above support aligned common symbols. COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9); HasDotTypeDotSizeDirective = false; - + if (is64Bit) { PersonalityPrefix = ""; PersonalitySuffix = "+4@GOTPCREL"; diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 3491b1c85bf..f9d7864423d 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -73,7 +73,7 @@ namespace { std::string getDescription() const { return std::string((IsArg ? "Argument #" : "Return value #")) - + utostr(Idx) + " of function " + F->getName(); + + utostr(Idx) + " of function " + F->getNameStr(); } }; diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index a0193992a75..2a91b0e80d3 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -307,11 +307,11 @@ Function *CodeExtractor::constructFunction(const Values &inputs, Value *Idx[2]; Idx[0] = Context.getNullValue(Type::Int32Ty); Idx[1] = Context.getConstantInt(Type::Int32Ty, i); - std::string GEPname = "gep_" + inputs[i]->getName(); TerminatorInst *TI = newFunction->begin()->getTerminator(); - GetElementPtrInst *GEP = GetElementPtrInst::Create(AI, Idx, Idx+2, - GEPname, TI); - RewriteVal = new LoadInst(GEP, "load" + GEPname, TI); + GetElementPtrInst *GEP = + GetElementPtrInst::Create(AI, Idx, Idx+2, + "gep_" + inputs[i]->getName(), TI); + RewriteVal = new LoadInst(GEP, "loadgep_" + inputs[i]->getName(), TI); } else RewriteVal = AI++; diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index e9f7f938a7e..f315f672ecb 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -353,7 +353,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const // If the BB doesn't have a name, give it one so we have something to key // off of. if (!BB->hasName()) BB->setName("tmpbb"); - BlocksToNotExtractFile << BB->getParent()->getName() << " " + BlocksToNotExtractFile << BB->getParent()->getNameStr() << " " << BB->getName() << "\n"; } BlocksToNotExtractFile.close(); -- 2.34.1