From: Chris Lattner Date: Thu, 10 Nov 2005 21:39:12 +0000 (+0000) Subject: Allow per-character control over what target assemblers allow in symbol X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d35f6056137788fcee34b25e70b0d14b453490fc;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24291 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Mangler.h b/include/llvm/Support/Mangler.h index 6499b9d54b2..30a48a82ae4 100644 --- a/include/llvm/Support/Mangler.h +++ b/include/llvm/Support/Mangler.h @@ -51,6 +51,10 @@ class Mangler { /// mangled in the current module. /// std::set 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 @@ public: /// 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);