[llvm-commits] CVS: llvm/include/llvm/Support/Mangler.h

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 10 13:39:24 PST 2005



Changes in directory llvm/include/llvm/Support:

Mangler.h updated: 1.18 -> 1.19
---
Log message:

Allow per-character control over what target assemblers allow in symbol
names.  This also changes the default to allow all of "$_." in addition
to letters and numbers as symbol names.  If you don't want this, use 
markCharUnacceptable to remove one of these or markCharAcceptable to add
to the set.  This corresponds with what GAS accepts by default.



---
Diffs of the changes:  (+17 -0)

 Mangler.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+)


Index: llvm/include/llvm/Support/Mangler.h
diff -u llvm/include/llvm/Support/Mangler.h:1.18 llvm/include/llvm/Support/Mangler.h:1.19
--- llvm/include/llvm/Support/Mangler.h:1.18	Thu Nov 10 13:29:31 2005
+++ llvm/include/llvm/Support/Mangler.h	Thu Nov 10 15:39:12 2005
@@ -51,6 +51,10 @@
   /// mangled in the current module.
   ///
   std::set<const GlobalValue*> MangledGlobals;
+  
+  /// AcceptableChars - This bitfield contains a one for each character that is
+  /// allowed to be part of an unmangled name.
+  unsigned AcceptableChars[256/32];
 public:
 
   // Mangler ctor - if a prefix is specified, it will be prepended onto all
@@ -61,6 +65,19 @@
   /// strings for assembler labels.
   void setUseQuotes(bool Val) { UseQuotes = 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.
+  void markCharAcceptable(unsigned char X) {
+    AcceptableChars[X/32] |= 1 << (X&31);
+  }
+  void markCharUnacceptable(unsigned char X) {
+    AcceptableChars[X/32] &= ~(1 << (X&31));
+  }
+  bool isCharAcceptable(unsigned char X) const {
+    return (AcceptableChars[X/32] & (1 << (X&31))) != 0;
+  }
+  
   /// getTypeID - Return a unique ID for the specified LLVM type.
   ///
   unsigned getTypeID(const Type *Ty);






More information about the llvm-commits mailing list