Fold the useful features of alist and alist_node into ilist, and
[oota-llvm.git] / include / llvm / Support / Mangler.h
index d52ff6ae5566caeb138144a700bd9fbcbed2dd85..94f0adb267ddca9ae906752e5fa19a0f7f31183e 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -14,9 +14,8 @@
 #ifndef LLVM_SUPPORT_MANGLER_H
 #define LLVM_SUPPORT_MANGLER_H
 
-#include "llvm/System/IncludeFile.h"
-#include <map>
-#include <set>
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include <string>
 
 namespace llvm {
@@ -41,7 +40,7 @@ class Mangler {
   
   /// Memo - This is used to remember the name that we assign a value.
   ///
-  std::map<const Value*, std::string> Memo;
+  DenseMap<const Value*, std::string> Memo;
 
   /// Count - This simple counter is used to unique value names.
   ///
@@ -49,13 +48,13 @@ class Mangler {
   
   /// TypeMap - If the client wants us to unique types, this keeps track of the
   /// current assignments and TypeCounter keeps track of the next id to assign.
-  std::map<const Type*, unsigned> TypeMap;
+  DenseMap<const Type*, unsigned> TypeMap;
   unsigned TypeCounter;
 
   /// This keeps track of which global values have had their names
   /// mangled in the current module.
   ///
-  std::set<const GlobalValue*> MangledGlobals;
+  SmallPtrSet<const GlobalValue*, 16> MangledGlobals;
   
   /// AcceptableChars - This bitfield contains a one for each character that is
   /// allowed to be part of an unmangled name.
@@ -87,10 +86,6 @@ public:
     return (AcceptableChars[X/32] & (1 << (X&31))) != 0;
   }
   
-  /// getTypeID - Return a unique ID for the specified LLVM type.
-  ///
-  unsigned getTypeID(const Type *Ty);
-
   /// getValueName - Returns the mangled name of V, an LLVM Value,
   /// in the current module.
   ///
@@ -105,14 +100,13 @@ public:
   /// from getValueName.
   ///
   std::string makeNameProper(const std::string &x, const char *Prefix = "");
-  
+
 private:
-  void InsertName(GlobalValue *GV, std::map<std::string, GlobalValue*> &Names);
+  /// getTypeID - Return a unique ID for the specified LLVM type.
+  ///
+  unsigned getTypeID(const Type *Ty);
 };
 
 } // End llvm namespace
 
-// Force the Mangler.cpp file to be linked when this header is #included
-FORCE_DEFINING_FILE_TO_BE_LINKED(Mangler)
-
 #endif // LLVM_SUPPORT_MANGLER_H