Hey, I have an odd problem with printing prefixed global symbols in my AsmPrinter. In my MCAsmInfo subclass implementation, I set GlobalPrefix = "%"; because my assembler needs this to avoid name collisions. Now, whenever a global symbol (be it a label, mbb operand ,etc.) gets printed, it is encapsulated in quotes. With other chars than '%' everything is okay... I also explicitly set AllowQuotesInName = false (which should be the default). Here is a shortened output example: .file "main.c" .text .global "%main" .align 4 .type "%main", at function "%main": [...] .Ltmp0: .size "%main", .Ltmp0-"%main" Is this working as intended? Because I really need to use the percent as prefix and can't have the quotes in the symbol name. Greetings, Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130329/dca59497/attachment.html>
> Hey, > > I have an odd problem with printing prefixed global symbols in my > AsmPrinter. > > In my MCAsmInfo subclass implementation, I set > > GlobalPrefix = "%"; > > > because my assembler needs this to avoid name collisions. > Now, whenever a global symbol (be it a label, mbb operand ,etc.) gets > printed, it is encapsulated in quotes. > With other chars than '%' everything is okay... > > I also explicitly set AllowQuotesInName = false (which should be the > default). > > Here is a shortened output example: > > .file "main.c" > .text > .global "%main" > .align 4 > .type "%main", at function > "%main": > [...] > .Ltmp0: > .size "%main", .Ltmp0-"%main" > > > Is this working as intended? Because I really need to use the percent > as prefix and can't have the quotes in the symbol name. > > Greetings, JanSorry for bumping, but I'm no step further and would really appreciate some help with that! Is there something special about the '%' that leads to the quotation marks? If not, I assume it's a bug or am I missing something? Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130330/5a21e9e1/attachment.html>
On 03/30/2013 12:42 AM, Jan Tlatlik wrote:>> Hey, >> >> I have an odd problem with printing prefixed global symbols in my >> AsmPrinter. >> >> In my MCAsmInfo subclass implementation, I set >> >> GlobalPrefix = "%"; >> >> >> because my assembler needs this to avoid name collisions. >> Now, whenever a global symbol (be it a label, mbb operand ,etc.) gets >> printed, it is encapsulated in quotes. >> With other chars than '%' everything is okay... >> >> I also explicitly set AllowQuotesInName = false (which should be the >> default). >>Okay, I managed to find out that in MCSymbol all symbol names with chars containting not one of the following get quoted (independently of the AllowQuotesInName setting): static bool isAcceptableChar(char C) { if ((C < 'a' || C > 'z') && (C < 'A' || C > 'Z') && (C < '0' || C > '9') && C != '_' && C != '$' && C != '.' && C != '@') return false; return true; } If I add C!='%' there, it works fine for me. But, isn't there any way to do this in a target-only manner, like overriding that existing implementation in a subclass? Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130330/55673cb9/attachment.html>