#ifndef LLVM_SUPPORT_MANGLER_H
#define LLVM_SUPPORT_MANGLER_H
-#include <map>
-#include <set>
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include <string>
namespace llvm {
/// 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.
///
/// 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.
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.
///
/// 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