For PR645:
authorReid Spencer <rspencer@reidspencer.com>
Fri, 26 Jan 2007 08:01:30 +0000 (08:01 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Fri, 26 Jan 2007 08:01:30 +0000 (08:01 +0000)
Remove the Function::renameLocalSymbols function as it is no longer
needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33522 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Function.h
lib/Target/CBackend/CBackend.cpp
lib/VMCore/Function.cpp

index a31e7f48347a5581173aa9cd6f86d890d0e82aa8..803e5e8decd29344dab2b56d2e21cf6120219324 100644 (file)
@@ -111,13 +111,6 @@ public:
   unsigned getCallingConv() const { return CallingConvention; }
   void setCallingConv(unsigned CC) { CallingConvention = CC; }
 
-  /// renameLocalSymbols - This method goes through the Function's symbol table
-  /// and renames any symbols that conflict with symbols at global scope.  This
-  /// is required before printing out to a textual form, to ensure that there is
-  /// no ambiguity when parsing.
-  void renameLocalSymbols();
-
-
   /// deleteBody - This method deletes the body of the function, and converts
   /// the linkage to external.
   ///
index 737a346ca48858ccf2bd84033b57628bb48f6cff..9faba6bd8160e4ac379c6405f5a98302c4c3eda0 100644 (file)
@@ -99,9 +99,6 @@ namespace {
       // Output all floating point constants that cannot be printed accurately.
       printFloatingPointConstants(F);
 
-      // Ensure that no local symbols conflict with global symbols.
-      F.renameLocalSymbols();
-
       printFunction(F);
       FPConstantMap.clear();
       return false;
index 4bc93dbb2cca173b0755a74cdc834248d34222c2..cf8fcdec6a879d2f88d88c711a4912c902545173 100644 (file)
@@ -139,45 +139,6 @@ void Function::eraseFromParent() {
 }
 
 
-/// renameLocalSymbols - This method goes through the Function's symbol table
-/// and renames any symbols that conflict with symbols at global scope.  This is
-/// required before printing out to a textual form, to ensure that there is no
-/// ambiguity when parsing.
-void Function::renameLocalSymbols() {
-  SymbolTable &LST = getValueSymbolTable();                 // Local Symtab
-  SymbolTable &GST = getParent()->getValueSymbolTable();    // Global Symtab
-
-  for (SymbolTable::plane_iterator LPI = LST.plane_begin(), E = LST.plane_end();
-       LPI != E; ++LPI)
-    // All global symbols are of pointer type, ignore any non-pointer planes.
-    if (isa<PointerType>(LPI->first)) {
-      // Only check if the global plane has any symbols of this type.
-      SymbolTable::plane_iterator GPI = GST.find(LPI->first);
-      if (GPI != GST.plane_end()) {
-        SymbolTable::ValueMap &LVM       = LPI->second;
-        const SymbolTable::ValueMap &GVM = GPI->second;
-
-        // Loop over all local symbols, renaming those that are in the global
-        // symbol table already.
-        for (SymbolTable::value_iterator VI = LVM.begin(), E = LVM.end();
-             VI != E;) {
-          Value *V                = VI->second;
-          const std::string &Name = VI->first;
-          ++VI;
-          if (GVM.count(Name)) {
-            static unsigned UniqueNum = 0;
-            // Find a name that does not conflict!
-            while (GVM.count(Name + "_" + utostr(++UniqueNum)) ||
-                   LVM.count(Name + "_" + utostr(UniqueNum)))
-              /* scan for UniqueNum that works */;
-            V->setName(Name + "_" + utostr(UniqueNum));
-          }
-        }
-      }
-    }
-}
-
-
 // dropAllReferences() - This function causes all the subinstructions to "let
 // go" of all references that they are maintaining.  This allows one to
 // 'delete' a whole class at a time, even though there may be circular