1 //===-- Mangler.h - Self-contained c/asm llvm name mangler -*- C++ -*- ----===//
3 // Unified name mangler for CWriter and assembly backends.
5 //===----------------------------------------------------------------------===//
7 #ifndef LLVM_SUPPORT_MANGLER_H
8 #define LLVM_SUPPORT_MANGLER_H
17 /// This keeps track of which global values have had their names
18 /// mangled in the current module.
20 std::set<const Value *> MangledGlobals;
23 bool AddUnderscorePrefix;
25 typedef std::map<const Value *, std::string> ValueMap;
31 // Mangler ctor - if AddUnderscorePrefix is true, then all public global
32 // symbols will be prefixed with an underscore.
33 Mangler(Module &M, bool AddUnderscorePrefix = false);
35 /// getValueName - Returns the mangled name of V, an LLVM Value,
36 /// in the current module.
38 std::string getValueName(const Value *V);
40 /// makeNameProper - We don't want identifier names with ., space, or
41 /// - in them, so we mangle these characters into the strings "d_",
42 /// "s_", and "D_", respectively. This is a very simple mangling that
43 /// doesn't guarantee unique names for values. getValueName already
44 /// does this for you, so there's no point calling it on the result
45 /// from getValueName.
47 static std::string makeNameProper(const std::string &x);
50 #endif // LLVM_SUPPORT_MANGLER_H