1 //===-- llvm/Support/Mangler.h - Self-contained name mangler ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Unified name mangler for various backends.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_SUPPORT_MANGLER_H
15 #define LLVM_SUPPORT_MANGLER_H
28 /// This keeps track of which global values have had their names
29 /// mangled in the current module.
31 std::set<const Value *> MangledGlobals;
37 std::map<const Type*, unsigned> TypeMap;
39 typedef std::map<const Value *, std::string> ValueMap;
44 void InsertName(GlobalValue *GV, std::map<std::string, GlobalValue*> &Names);
47 // Mangler ctor - if a prefix is specified, it will be prepended onto all
49 Mangler(Module &M, const char *Prefix = "");
51 /// getTypeID - Return a unique ID for the specified LLVM type.
53 unsigned getTypeID(const Type *Ty);
55 /// getValueName - Returns the mangled name of V, an LLVM Value,
56 /// in the current module.
58 std::string getValueName(const Value *V);
60 /// makeNameProper - We don't want identifier names with ., space, or
61 /// - in them, so we mangle these characters into the strings "d_",
62 /// "s_", and "D_", respectively. This is a very simple mangling that
63 /// doesn't guarantee unique names for values. getValueName already
64 /// does this for you, so there's no point calling it on the result
65 /// from getValueName.
67 static std::string makeNameProper(const std::string &x);
70 } // End llvm namespace
72 #endif // LLVM_SUPPORT_MANGLER_H