[llvm-commits] CVS: llvm/include/llvm/Support/Mangler.h
Brian Gaeke
gaeke at cs.uiuc.edu
Thu Jul 24 15:22:31 PDT 2003
Changes in directory llvm/include/llvm/Support:
Mangler.h added (r1.1)
---
Log message:
Factor out name-mangling from X86/Printer, which is derived from CWriter,
into this new support class.
---
Diffs of the changes:
Index: llvm/include/llvm/Support/Mangler.h
diff -c /dev/null llvm/include/llvm/Support/Mangler.h:1.1
*** /dev/null Thu Jul 24 15:21:09 2003
--- llvm/include/llvm/Support/Mangler.h Thu Jul 24 15:20:58 2003
***************
*** 0 ****
--- 1,45 ----
+ //===-- Mangler.h - Self-contained c/asm llvm name mangler ----------------===//
+ //
+ // Unified name mangler for CWriter and assembly backends.
+ //
+ //===----------------------------------------------------------------------===//
+
+ #ifndef LLVM_SUPPORT_MANGLER_H
+ #define LLVM_SUPPORT_MANGLER_H
+
+ class Value;
+ #include <map>
+
+ class Mangler {
+ public:
+ /// getValueName - Returns the mangled name of V, an LLVM Value,
+ /// in the current module.
+ ///
+ std::string getValueName(const Value *V);
+
+ Mangler(Module &_M);
+
+ /// makeNameProper - We don't want identifier names with ., space, or
+ /// - in them, so we mangle these characters into the strings "d_",
+ /// "s_", and "D_", respectively. This is a very simple mangling that
+ /// doesn't guarantee unique names for values. getValueName already
+ /// does this for you, so there's no point calling it on the result
+ /// from getValueName.
+ ///
+ static std::string makeNameProper(std::string x);
+
+ private:
+ /// This keeps track of which global values have had their names
+ /// mangled in the current module.
+ ///
+ std::set<const Value *> MangledGlobals;
+
+ Module &M;
+
+ typedef std::map<const Value *, std::string> ValueMap;
+ ValueMap Memo;
+
+ long long Count;
+ };
+
+ #endif // LLVM_SUPPORT_MANGLER_H
More information about the llvm-commits
mailing list