/// the space character. By default, this is false.
bool UseQuotes;
+ /// PreserveAsmNames - If this is set, the asm escape character is not removed
+ /// from names with 'asm' specifiers.
+ bool PreserveAsmNames;
+
/// Memo - This is used to remember the name that we assign a value.
///
std::map<const Value*, std::string> Memo;
/// strings for assembler labels.
void setUseQuotes(bool Val) { UseQuotes = Val; }
+ /// setPreserveAsmNames - If the mangler should not strip off the asm name
+ /// identifier (\001), this should be set.
+ void setPreserveAsmNames(bool Val) { PreserveAsmNames = Val; }
+
/// Acceptable Characters - This allows the target to specify which characters
/// are acceptable to the assembler without being mangled. By default we
/// allow letters, numbers, '_', '$', and '.', which is what GAS accepts.
std::string Result;
if (X.empty()) return X; // Empty names are uniqued by the caller.
+ // If PreserveAsmNames is set, names with asm identifiers are not modified.
+ if (PreserveAsmNames && X[0] == 1)
+ return X;
+
if (!UseQuotes) {
// If X does not start with (char)1, add the prefix.
std::string::const_iterator I = X.begin();
Mangler::Mangler(Module &M, const char *prefix)
- : Prefix(prefix), UseQuotes(false), Count(0), TypeCounter(0) {
+ : Prefix(prefix), UseQuotes(false), PreserveAsmNames(false),
+ Count(0), TypeCounter(0) {
std::fill(AcceptableChars,
AcceptableChars+sizeof(AcceptableChars)/sizeof(AcceptableChars[0]),
0);