llvm.org GIT mirror llvm / 3420e7f
Output UTF-8-encoded characters as identifier characters into assembly by default. This is a behaviour configurable in the MCAsmInfo. I've decided to turn it on by default in (possibly optimistic) hopes that most assemblers are reasonably sane. If this proves a problem, switching to default seems reasonable. I'm not sure if this is the opportune place to test, but it seemed good to make sure it was tested somewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154235 91177308-0d34-0410-b5e6-96231b3b80d8 Sean Hunt 8 years ago
4 changed file(s) with 19 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
142142 /// symbol names. This defaults to true.
143143 bool AllowPeriodsInName;
144144
145 /// AllowUTF8 - This is true if the assembler accepts UTF-8 input.
146 // FIXME: Make this a more general encoding setting?
147 bool AllowUTF8;
148
145149 //===--- Data Emission Directives -------------------------------------===//
146150
147151 /// ZeroDirective - this should be set to the directive used to get some
484488 bool doesAllowPeriodsInName() const {
485489 return AllowPeriodsInName;
486490 }
491 bool doesAllowUTF8() const {
492 return AllowUTF8;
493 }
487494 const char *getZeroDirective() const {
488495 return ZeroDirective;
489496 }
4848 AllowQuotesInName = false;
4949 AllowNameToStartWithDigit = false;
5050 AllowPeriodsInName = true;
51 AllowUTF8 = true;
5152 ZeroDirective = "\t.zero\t";
5253 AsciiDirective = "\t.ascii\t";
5354 AscizDirective = "\t.asciz\t";
2121 #include "llvm/ADT/Twine.h"
2222 using namespace llvm;
2323
24 static bool isAcceptableChar(char C, bool AllowPeriod) {
24 static bool isAcceptableChar(char C, bool AllowPeriod, bool AllowUTF8) {
2525 if ((C < 'a' || C > 'z') &&
2626 (C < 'A' || C > 'Z') &&
2727 (C < '0' || C > '9') &&
2828 C != '_' && C != '$' && C != '@' &&
29 !(AllowPeriod && C == '.'))
29 !(AllowPeriod && C == '.') &&
30 !(AllowUTF8 && (C & 0x80)))
3031 return false;
3132 return true;
3233 }
5556 // If any of the characters in the string is an unacceptable character, force
5657 // quotes.
5758 bool AllowPeriod = MAI.doesAllowPeriodsInName();
59 bool AllowUTF8 = MAI.doesAllowUTF8();
5860 for (unsigned i = 0, e = Str.size(); i != e; ++i)
59 if (!isAcceptableChar(Str[i], AllowPeriod))
61 if (!isAcceptableChar(Str[i], AllowPeriod, AllowUTF8))
6062 return true;
6163 return false;
6264 }
7375 }
7476
7577 bool AllowPeriod = MAI.doesAllowPeriodsInName();
78 bool AllowUTF8 = MAI.doesAllowUTF8();
7679 for (unsigned i = 0, e = Str.size(); i != e; ++i) {
77 if (!isAcceptableChar(Str[i], AllowPeriod))
80 if (!isAcceptableChar(Str[i], AllowPeriod, AllowUTF8))
7881 MangleLetter(OutName, Str[i]);
7982 else
8083 OutName.push_back(Str[i]);
0 ; RUN: llc < %s -march=x86 | FileCheck %s
1
2 ; CHECK: "iΔ",4,4
3 @"i\CE\94" = common global i32 0, align 4