[llvm-commits] [llvm] r102594 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h lib/MC/MCAsmInfo.cpp lib/Target/Mangler.cpp
Mon P Wang
wangmp at apple.com
Wed Apr 28 21:00:56 PDT 2010
Author: wangmp
Date: Wed Apr 28 23:00:56 2010
New Revision: 102594
URL: http://llvm.org/viewvc/llvm-project?rev=102594&view=rev
Log:
Add support for assemblers that don't support periods in a name
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfo.h
llvm/trunk/lib/MC/MCAsmInfo.cpp
llvm/trunk/lib/Target/Mangler.cpp
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=102594&r1=102593&r2=102594&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Wed Apr 28 23:00:56 2010
@@ -97,7 +97,11 @@
/// AllowNameToStartWithDigit - This is true if the assembler allows symbol
/// names to start with a digit (e.g., "0x0021"). This defaults to false.
bool AllowNameToStartWithDigit;
-
+
+ /// AllowPeriodsInName - This is true if the assembler allows periods in
+ /// symbol names. This defaults to true.
+ bool AllowPeriodsInName;
+
//===--- Data Emission Directives -------------------------------------===//
/// ZeroDirective - this should be set to the directive used to get some
@@ -341,6 +345,9 @@
bool doesAllowNameToStartWithDigit() const {
return AllowNameToStartWithDigit;
}
+ bool doesAllowPeriodsInName() const {
+ return AllowPeriodsInName;
+ }
const char *getZeroDirective() const {
return ZeroDirective;
}
Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=102594&r1=102593&r2=102594&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Wed Apr 28 23:00:56 2010
@@ -35,6 +35,7 @@
AssemblerDialect = 0;
AllowQuotesInName = false;
AllowNameToStartWithDigit = false;
+ AllowPeriodsInName = true;
ZeroDirective = "\t.zero\t";
AsciiDirective = "\t.ascii\t";
AscizDirective = "\t.asciz\t";
Modified: llvm/trunk/lib/Target/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mangler.cpp?rev=102594&r1=102593&r2=102594&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mangler.cpp (original)
+++ llvm/trunk/lib/Target/Mangler.cpp Wed Apr 28 23:00:56 2010
@@ -22,11 +22,12 @@
#include "llvm/ADT/Twine.h"
using namespace llvm;
-static bool isAcceptableChar(char C) {
+static bool isAcceptableChar(char C, bool AllowPeriod) {
if ((C < 'a' || C > 'z') &&
(C < 'A' || C > 'Z') &&
(C < '0' || C > '9') &&
- C != '_' && C != '$' && C != '.' && C != '@')
+ C != '_' && C != '$' && C != '@' &&
+ !(AllowPeriod && C == '.'))
return false;
return true;
}
@@ -54,8 +55,9 @@
// If any of the characters in the string is an unacceptable character, force
// quotes.
+ bool AllowPeriod = MAI.doesAllowPeriodsInName();
for (unsigned i = 0, e = Str.size(); i != e; ++i)
- if (!isAcceptableChar(Str[i]))
+ if (!isAcceptableChar(Str[i], AllowPeriod))
return true;
return false;
}
@@ -70,9 +72,10 @@
MangleLetter(OutName, Str[0]);
Str = Str.substr(1);
}
-
+
+ bool AllowPeriod = MAI.doesAllowPeriodsInName();
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
- if (!isAcceptableChar(Str[i]))
+ if (!isAcceptableChar(Str[i], AllowPeriod))
MangleLetter(OutName, Str[i]);
else
OutName.push_back(Str[i]);
More information about the llvm-commits
mailing list