[PATCH] MC: Allow targets to stop symbol name quoting
Rafael EspĂndola
rafael.espindola at gmail.com
Mon Apr 27 10:05:00 PDT 2015
>> This function is used to print assembly. You have an assembler that can
>> handle any characters in the name? How?
>
> No, but it also does not accept quoted symbols to avoid them. There is
> currently a suboptimal pass that handles a subset of the character
> restrictions HSAIL has which renames globals and replaces the disallowed
> characters with something else.
>
> The real problem with this is that the characters used for different kinds
> of symbol prefixes (% and &) are rejected, causing the disallowed quotes to
> be added. The character rules are unlike other assembly targets and needs to
> be specially handled in some way, so I need a way to avoid assumptions about
> the allowed characters like this.
So, there are two things at play in here:
* What characters can an assembler handle without quotes.
* Can an assembler handle quoted names.
We should probably make that explicit with
* A isValidUnquotedName(StringRef Name) virtual function.
* A SupportsQuotedNames bool variable.
The logic for printing a symbol then is
if (isValidUnquotedName(name))
print the name
else if (SupportsQuotedNames)
print the name in quotes
else
show an error.
Cheers,
Rafael
More information about the llvm-commits
mailing list